mam 1.11.742 → 1.11.744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.d.ts +3 -3
- package/node.deps.json +1 -1
- package/node.js +6 -5
- package/node.js.map +1 -1
- package/node.mjs +6 -5
- package/node.test.js +10 -6
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.mjs
CHANGED
|
@@ -5188,7 +5188,7 @@ var $;
|
|
|
5188
5188
|
var $;
|
|
5189
5189
|
(function ($) {
|
|
5190
5190
|
function $mol_base64_encode(src) {
|
|
5191
|
-
|
|
5191
|
+
return src.toBase64();
|
|
5192
5192
|
}
|
|
5193
5193
|
$.$mol_base64_encode = $mol_base64_encode;
|
|
5194
5194
|
})($ || ($ = {}));
|
|
@@ -5200,12 +5200,13 @@ var $;
|
|
|
5200
5200
|
function $mol_base64_encode_node(str) {
|
|
5201
5201
|
if (!str)
|
|
5202
5202
|
return '';
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
return Buffer.from(str).toString('base64');
|
|
5203
|
+
const buf = Buffer.isBuffer(str) ? str : Buffer.from(str);
|
|
5204
|
+
return buf.toString('base64');
|
|
5206
5205
|
}
|
|
5207
5206
|
$.$mol_base64_encode_node = $mol_base64_encode_node;
|
|
5208
|
-
|
|
5207
|
+
if (!('toBase64' in Uint8Array.prototype)) {
|
|
5208
|
+
$.$mol_base64_encode = $mol_base64_encode_node;
|
|
5209
|
+
}
|
|
5209
5210
|
})($ || ($ = {}));
|
|
5210
5211
|
|
|
5211
5212
|
;
|
package/node.test.js
CHANGED
|
@@ -5179,7 +5179,7 @@ var $;
|
|
|
5179
5179
|
var $;
|
|
5180
5180
|
(function ($) {
|
|
5181
5181
|
function $mol_base64_encode(src) {
|
|
5182
|
-
|
|
5182
|
+
return src.toBase64();
|
|
5183
5183
|
}
|
|
5184
5184
|
$.$mol_base64_encode = $mol_base64_encode;
|
|
5185
5185
|
})($ || ($ = {}));
|
|
@@ -5191,12 +5191,13 @@ var $;
|
|
|
5191
5191
|
function $mol_base64_encode_node(str) {
|
|
5192
5192
|
if (!str)
|
|
5193
5193
|
return '';
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
return Buffer.from(str).toString('base64');
|
|
5194
|
+
const buf = Buffer.isBuffer(str) ? str : Buffer.from(str);
|
|
5195
|
+
return buf.toString('base64');
|
|
5197
5196
|
}
|
|
5198
5197
|
$.$mol_base64_encode_node = $mol_base64_encode_node;
|
|
5199
|
-
|
|
5198
|
+
if (!('toBase64' in Uint8Array.prototype)) {
|
|
5199
|
+
$.$mol_base64_encode = $mol_base64_encode_node;
|
|
5200
|
+
}
|
|
5200
5201
|
})($ || ($ = {}));
|
|
5201
5202
|
|
|
5202
5203
|
;
|
|
@@ -13855,11 +13856,14 @@ var $;
|
|
|
13855
13856
|
const png = new Uint8Array([0x1a, 0x0a, 0x00, 0x49, 0x48, 0x78, 0xda]);
|
|
13856
13857
|
$mol_test({
|
|
13857
13858
|
'base64 encode string'() {
|
|
13858
|
-
$mol_assert_equal($mol_base64_encode('Hello, ΧΨΩЫ'), 'SGVsbG8sIM6nzqjOqdCr');
|
|
13859
|
+
$mol_assert_equal($mol_base64_encode($mol_charset_encode('Hello, ΧΨΩЫ')), 'SGVsbG8sIM6nzqjOqdCr');
|
|
13859
13860
|
},
|
|
13860
13861
|
'base64 encode binary'() {
|
|
13861
13862
|
$mol_assert_equal($mol_base64_encode(png), 'GgoASUh42g==');
|
|
13862
13863
|
},
|
|
13864
|
+
'base64 encode string with plus'() {
|
|
13865
|
+
$mol_assert_equal($mol_base64_encode($mol_charset_encode('шоешпо')), '0YjQvtC10YjQv9C+');
|
|
13866
|
+
},
|
|
13863
13867
|
});
|
|
13864
13868
|
})($ || ($ = {}));
|
|
13865
13869
|
|