@truto/truto-jsonata 2.0.0 → 2.0.1
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/README.md +1 -1
- package/dist/browser/index.js +12 -5
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/presets/core.js +12 -5
- package/dist/browser/presets/core.js.map +3 -3
- package/dist/cjs/index.cjs +12 -5
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/presets/core.cjs +12 -5
- package/dist/cjs/presets/core.cjs.map +3 -3
- package/dist/esm/index.js +12 -5
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/presets/core.js +12 -5
- package/dist/esm/presets/core.js.map +3 -3
- package/dist/functions/base64encode.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ Each preset is bundled independently for tree-shaking — unused presets don't i
|
|
|
136
136
|
|
|
137
137
|
| Function | Description |
|
|
138
138
|
|---|---|
|
|
139
|
-
| [`$base64encode()`](#base64encode) | Encode a string to Base64 |
|
|
139
|
+
| [`$base64encode()`](#base64encode) | Encode a string, ArrayBuffer, or Uint8Array to Base64 |
|
|
140
140
|
| [`$base64decode()`](#base64decode) | Decode a Base64 string |
|
|
141
141
|
| [`$base64ToBlob()`](#base64toblob) | Convert Base64 to a Blob |
|
|
142
142
|
| [`$blob()`](#blob) | Create a Blob from content |
|
package/dist/browser/index.js
CHANGED
|
@@ -63644,11 +63644,18 @@ var base64decode_default = base64decode;
|
|
|
63644
63644
|
|
|
63645
63645
|
// src/functions/base64encode.ts
|
|
63646
63646
|
function base64encode(input, urlSafe = false) {
|
|
63647
|
+
let bytes;
|
|
63648
|
+
if (input instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && input instanceof SharedArrayBuffer) {
|
|
63649
|
+
bytes = new Uint8Array(input);
|
|
63650
|
+
} else if (input instanceof Uint8Array) {
|
|
63651
|
+
bytes = input;
|
|
63652
|
+
} else {
|
|
63653
|
+
bytes = new TextEncoder().encode(input);
|
|
63654
|
+
}
|
|
63655
|
+
const CHUNK = 8192;
|
|
63647
63656
|
let binary = "";
|
|
63648
|
-
|
|
63649
|
-
|
|
63650
|
-
for (let i2 = 0;i2 < len; i2++) {
|
|
63651
|
-
binary += String.fromCharCode(bytes[i2]);
|
|
63657
|
+
for (let i2 = 0;i2 < bytes.length; i2 += CHUNK) {
|
|
63658
|
+
binary += String.fromCharCode.apply(null, Array.from(bytes.subarray(i2, i2 + CHUNK)));
|
|
63652
63659
|
}
|
|
63653
63660
|
let base642 = btoa(binary);
|
|
63654
63661
|
if (urlSafe) {
|
|
@@ -79720,4 +79727,4 @@ export {
|
|
|
79720
79727
|
trutoJsonata as default
|
|
79721
79728
|
};
|
|
79722
79729
|
|
|
79723
|
-
//# debugId=
|
|
79730
|
+
//# debugId=C25DC749B9985A9864756E2164756E21
|