apache / cordova-js
Showing 1 of 1 files from the diff.

@@ -22,21 +22,15 @@
Loading
22 22
var base64 = exports;
23 23
24 24
base64.fromArrayBuffer = function (arrayBuffer) {
25 -
    var array = new Uint8Array(arrayBuffer);
26 -
    return btoa(bytesToBinaryString(array));
25 +
    return btoa(bufferToBinaryString(arrayBuffer));
27 26
};
28 27
29 28
base64.toArrayBuffer = function (str) {
30 -
    var decodedStr = atob(str);
31 -
    var arrayBuffer = new ArrayBuffer(decodedStr.length);
32 -
    var array = new Uint8Array(arrayBuffer);
33 -
    for (var i = 0, len = decodedStr.length; i < len; i++) {
34 -
        array[i] = decodedStr.charCodeAt(i);
35 -
    }
36 -
    return arrayBuffer;
29 +
    return binaryStringToBuffer(atob(str));
37 30
};
38 31
39 -
function bytesToBinaryString (bytes) {
32 +
function bufferToBinaryString (buffer) {
33 +
    var bytes = new Uint8Array(buffer);
40 34
    var CHUNK_SIZE = 1 << 15;
41 35
    var string = '';
42 36
    for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
@@ -45,3 +39,11 @@
Loading
45 39
    }
46 40
    return string;
47 41
}
42 +
43 +
function binaryStringToBuffer (binaryString) {
44 +
    var bytes = new Uint8Array(binaryString.length);
45 +
    for (var i = 0; i < bytes.length; i++) {
46 +
        bytes[i] = binaryString.charCodeAt(i);
47 +
    }
48 +
    return bytes.buffer;
49 +
}
Files Coverage
src 83.56%
test/test-platform-modules 100.00%
Project Totals (14 files) 83.62%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading