@evlop/commons 1.0.117 → 1.0.118
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/helpers/base64.d.ts +3 -0
- package/dist/src/helpers/base64.d.ts.map +1 -0
- package/dist/src/helpers/base64.js +68 -0
- package/dist/src/helpers/base64.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/helpers/base64/index.d.ts +0 -3
- package/dist/src/helpers/base64/index.d.ts.map +0 -1
- package/dist/src/helpers/base64/index.js +0 -6
- package/dist/src/helpers/base64/index.js.map +0 -1
- package/dist/src/helpers/base64/index.native.d.ts +0 -3
- package/dist/src/helpers/base64/index.native.d.ts.map +0 -1
- package/dist/src/helpers/base64/index.native.js +0 -10
- package/dist/src/helpers/base64/index.native.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/helpers/base64.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAoB,MAAM,WAgClD,CAAC;AAEF,eAAO,MAAM,YAAY,UAAoB,MAAM,WAwClD,CAAC"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.decodeBase64 = exports.encodeBase64 = void 0;
|
4
|
+
const keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
5
|
+
const encodeBase64 = function (input) {
|
6
|
+
let output = [];
|
7
|
+
let chr1, chr2, chr3 = "";
|
8
|
+
let enc1, enc2, enc3, enc4 = "";
|
9
|
+
let i = 0;
|
10
|
+
do {
|
11
|
+
chr1 = input.charCodeAt(i++);
|
12
|
+
chr2 = input.charCodeAt(i++);
|
13
|
+
chr3 = input.charCodeAt(i++);
|
14
|
+
enc1 = chr1 >> 2;
|
15
|
+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
16
|
+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
17
|
+
enc4 = chr3 & 63;
|
18
|
+
if (isNaN(chr2)) {
|
19
|
+
enc3 = enc4 = 64;
|
20
|
+
}
|
21
|
+
else if (isNaN(chr3)) {
|
22
|
+
enc4 = 64;
|
23
|
+
}
|
24
|
+
output.push(keyStr.charAt(enc1) +
|
25
|
+
keyStr.charAt(enc2) +
|
26
|
+
keyStr.charAt(enc3) +
|
27
|
+
keyStr.charAt(enc4));
|
28
|
+
chr1 = chr2 = chr3 = "";
|
29
|
+
enc1 = enc2 = enc3 = enc4 = "";
|
30
|
+
} while (i < input.length);
|
31
|
+
return output.join('');
|
32
|
+
};
|
33
|
+
exports.encodeBase64 = encodeBase64;
|
34
|
+
const decodeBase64 = function (input) {
|
35
|
+
let output = "";
|
36
|
+
let chr1, chr2, chr3 = "";
|
37
|
+
let enc1, enc2, enc3, enc4 = "";
|
38
|
+
let i = 0;
|
39
|
+
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
|
40
|
+
var base64test = /[^A-Za-z0-9\+\/\=]/g;
|
41
|
+
if (base64test.exec(input)) {
|
42
|
+
throw new Error("There were invalid base64 characters in the input text.\n" +
|
43
|
+
"Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
|
44
|
+
"Expect errors in decoding.");
|
45
|
+
}
|
46
|
+
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
47
|
+
do {
|
48
|
+
enc1 = keyStr.indexOf(input.charAt(i++));
|
49
|
+
enc2 = keyStr.indexOf(input.charAt(i++));
|
50
|
+
enc3 = keyStr.indexOf(input.charAt(i++));
|
51
|
+
enc4 = keyStr.indexOf(input.charAt(i++));
|
52
|
+
chr1 = (enc1 << 2) | (enc2 >> 4);
|
53
|
+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
54
|
+
chr3 = ((enc3 & 3) << 6) | enc4;
|
55
|
+
output = output + String.fromCharCode(chr1);
|
56
|
+
if (enc3 != 64) {
|
57
|
+
output = output + String.fromCharCode(chr2);
|
58
|
+
}
|
59
|
+
if (enc4 != 64) {
|
60
|
+
output = output + String.fromCharCode(chr3);
|
61
|
+
}
|
62
|
+
chr1 = chr2 = chr3 = "";
|
63
|
+
enc1 = enc2 = enc3 = enc4 = "";
|
64
|
+
} while (i < input.length);
|
65
|
+
return output;
|
66
|
+
};
|
67
|
+
exports.decodeBase64 = decodeBase64;
|
68
|
+
//# sourceMappingURL=base64.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../src/helpers/base64.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG,mEAAmE,CAAC;AAE5E,MAAM,YAAY,GAAG,UAAU,KAAa;IAC/C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,IAAS,EAAE,IAAS,EAAE,IAAI,GAAQ,EAAE,CAAC;IACzC,IAAI,IAAS,EAAE,IAAS,EAAE,IAAS,EAAE,IAAI,GAAQ,EAAE,CAAC;IACpD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,GAAG;QACC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;QAE7B,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC;QACjB,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QACvC,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QACxC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QAEjB,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;YACb,IAAI,GAAG,IAAI,GAAG,EAAE,CAA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AC;AACjC,eAAO,MAAM,YAAY,aAAO,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/base64/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,YAAY,GAAG,IAAI,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../src/helpers/base64/index.native.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,KAAgB,CAAC;AAC1C,eAAO,MAAM,YAAY,KAAgB,CAAC"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.decodeBase64 = exports.encodeBase64 = void 0;
|
7
|
-
const react_native_base64_1 = __importDefault(require("react-native-base64"));
|
8
|
-
exports.encodeBase64 = react_native_base64_1.default.encode;
|
9
|
-
exports.decodeBase64 = react_native_base64_1.default.decode;
|
10
|
-
//# sourceMappingURL=index.native.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../../../src/helpers/base64/index.native.ts"],"names":[],"mappings":";;;;;;AAAA,8EAAyC;AAE5B,QAAA,YAAY,GAAG,6BAAM,CAAC,MAAM,CAAC;AAC7B,QAAA,YAAY,GAAG,6BAAM,CAAC,MAAM,CAAC"}
|