@hyperfrontend/string-utils
Advanced tools
| /** | ||
| * Converts a base64 encoded string to a Uint8Array (browser implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param base64 - The base64 encoded string to convert | ||
| * @returns The decoded Uint8Array | ||
| */ | ||
| export declare function base64ToUint8Array(base64: string): Uint8Array; | ||
| //# sourceMappingURL=base64-to-uint8-array.d.ts.map |
| {"version":3,"file":"base64-to-uint8-array.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAE7D"} |
| /** | ||
| * Converts a base64 encoded string to a Uint8Array (Node.js implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param base64 - The base64 encoded string to convert | ||
| * @returns The decoded Uint8Array | ||
| */ | ||
| export declare function base64ToUint8Array(base64: string): Uint8Array; | ||
| //# sourceMappingURL=base64-to-uint8-array.d.ts.map |
| {"version":3,"file":"base64-to-uint8-array.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/node/base64-to-uint8-array.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAG7D"} |
| /** | ||
| * Decodes a base64 encoded string to a UTF-8 string (browser implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param base64 - The base64 encoded string to decode | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| export declare function fromBase64(base64: string): string; | ||
| //# sourceMappingURL=from-base64.d.ts.map |
| {"version":3,"file":"from-base64.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD"} |
| /** | ||
| * Decodes a base64 encoded string to a UTF-8 string (Node.js implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param text - The base64 encoded string to decode | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| export declare function fromBase64(text: string): string; | ||
| //# sourceMappingURL=from-base64.d.ts.map |
| {"version":3,"file":"from-base64.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/from-base64/node/from-base64.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"} |
| /** | ||
| * Encodes a UTF-8 string to base64 format (browser implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param text - The UTF-8 string to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function toBase64(text: string, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=to-base64.d.ts.map |
| {"version":3,"file":"to-base64.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAEnF"} |
| /** | ||
| * Encodes a UTF-8 string to base64 format (Node.js implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param text - The UTF-8 string to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function toBase64(text: string, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=to-base64.d.ts.map |
| {"version":3,"file":"to-base64.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/to-base64/node/to-base64.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAKnF"} |
| /** | ||
| * Converts a Uint8Array to a base64 encoded string (browser implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param bytes - The Uint8Array to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function uint8ArrayToBase64(bytes: Uint8Array, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=uint8-array-to-base64.d.ts.map |
| {"version":3,"file":"uint8-array-to-base64.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAKlG"} |
| /** | ||
| * Converts a Uint8Array to a base64 encoded string (Node.js implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param bytes - The Uint8Array to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function uint8ArrayToBase64(bytes: Uint8Array, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=uint8-array-to-base64.d.ts.map |
| {"version":3,"file":"uint8-array-to-base64.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/node/uint8-array-to-base64.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAElG"} |
| /** | ||
| * Converts a Uint8Array to a UTF-8 encoded string. | ||
| * | ||
| * @param uint8Array - The Uint8Array to convert | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| export declare function uint8ArrayToUtf8String(uint8Array: Uint8Array): string; | ||
| //# sourceMappingURL=uint8-array-to-utf8-string.d.ts.map |
| {"version":3,"file":"uint8-array-to-utf8-string.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAErE"} |
| /** | ||
| * Converts a UTF-8 string to a Uint8Array (browser implementation). | ||
| * | ||
| * @param text - The UTF-8 string to convert | ||
| * @returns The encoded Uint8Array | ||
| */ | ||
| export declare function utf8StringToUint8Array(text: string): Uint8Array; | ||
| //# sourceMappingURL=utf8-string-to-uint8-array.d.ts.map |
| {"version":3,"file":"utf8-string-to-uint8-array.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE/D"} |
| /** | ||
| * Converts a UTF-8 string to a Uint8Array (Node.js implementation). | ||
| * | ||
| * @param text - The UTF-8 string to convert | ||
| * @returns The encoded Uint8Array | ||
| */ | ||
| export declare function utf8StringToUint8Array(text: string): Uint8Array; | ||
| //# sourceMappingURL=utf8-string-to-uint8-array.d.ts.map |
| {"version":3,"file":"utf8-string-to-uint8-array.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/node/utf8-string-to-uint8-array.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE/D"} |
+40
-40
@@ -17,25 +17,2 @@ 'use strict'; | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Latin-1 "binary string" to Uint8Array. | ||
@@ -57,19 +34,2 @@ * | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
@@ -123,2 +83,42 @@ * Restores standard characters and adds padding if needed. | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Encodes a UTF-8 string to base64 format (browser implementation). | ||
@@ -125,0 +125,0 @@ * Supports optional URL-safe encoding and padding control. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts","../../../../../../libs/utils/string/src/lib/from-base64/browser.ts","../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts","../../../../../../libs/utils/string/src/lib/to-base64/browser.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;IACxH,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACrBA;;;;;;;AAOG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;AAC9C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC;AACA,IAAA,OAAO,KAAK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AY,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;IACzE,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACnH;;ACXA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;IACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;QAC7D,OAAO;QACP,WAAW;AACZ,KAAA,CAAC;AACJ;;ACdA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;;;;;;;"} | ||
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint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CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACnH;;ACXA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;IACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;QAC7D,OAAO;QACP,WAAW;AACZ,KAAA,CAAC;AACJ;;ACfA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;;;;;;;"} |
| export * from '../lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string'; | ||
| export * from '../lib/base64-to-uint8-array/browser'; | ||
| export * from '../lib/from-base64/browser'; | ||
| export * from '../lib/utf8-string-to-uint8-array/browser'; | ||
| export * from '../lib/to-base64/browser'; | ||
| export * from '../lib/uint8-array-to-base64/browser'; | ||
| export * from '../lib/uint8-array-to-utf8-string'; | ||
| export * from '../lib/base64-to-uint8-array/browser/base64-to-uint8-array'; | ||
| export * from '../lib/from-base64/browser/from-base64'; | ||
| export * from '../lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array'; | ||
| export * from '../lib/to-base64/browser/to-base64'; | ||
| export * from '../lib/uint8-array-to-base64/browser/uint8-array-to-base64'; | ||
| export * from '../lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/utils/string/src/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,gEAAgE,CAAA;AAC9E,cAAc,sCAAsC,CAAA;AACpD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2CAA2C,CAAA;AACzD,cAAc,0BAA0B,CAAA;AACxC,cAAc,sCAAsC,CAAA;AACpD,cAAc,mCAAmC,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/utils/string/src/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,gEAAgE,CAAA;AAC9E,cAAc,4DAA4D,CAAA;AAC1E,cAAc,wCAAwC,CAAA;AACtD,cAAc,sEAAsE,CAAA;AACpF,cAAc,oCAAoC,CAAA;AAClD,cAAc,4DAA4D,CAAA;AAC1E,cAAc,8DAA8D,CAAA"} |
+40
-40
@@ -15,25 +15,2 @@ new TextEncoder(); | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Latin-1 "binary string" to Uint8Array. | ||
@@ -55,19 +32,2 @@ * | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
@@ -121,2 +81,42 @@ * Restores standard characters and adds padding if needed. | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Encodes a UTF-8 string to base64 format (browser implementation). | ||
@@ -123,0 +123,0 @@ * Supports optional URL-safe encoding and padding control. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.esm.js","sources":["../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts","../../../../../../libs/utils/string/src/lib/from-base64/browser.ts","../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts","../../../../../../libs/utils/string/src/lib/to-base64/browser.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":"AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;IACxH,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACrBA;;;;;;;AAOG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;AAC9C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;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AAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;AACvC;;ACNA;;;;;;;;AAQG;AACG,SAAU,QAAQ,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;IACzE,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACnH;;ACXA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;IACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;QAC7D,OAAO;QACP,WAAW;AACZ,KAAA,CAAC;AACJ;;ACdA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;"} | ||
| {"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":"AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;;AAOG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;AAC9C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC;AACA,IAAA,OAAO,KAAK;AACd;;ACdA;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,aAAqB,EAAA;AACzD,IAAA,IAAI,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AAC9E,IAAA,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC;IACvC,IAAI,GAAG,EAAE;AACP,QAAA,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC;IACtF;AACA,IAAA,OAAO,gBAAgB;AACzB;;ACXA;;;;;;AAMG;AACG,SAAU,kBAAkB,CAAC,MAAc,EAAA;IAC/C,OAAO,mBAAmB,CAAC,IAAI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O,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACnH;;ACXA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;IACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;QAC7D,OAAO;QACP,WAAW;AACZ,KAAA,CAAC;AACJ;;ACfA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;"} |
+40
-40
@@ -18,25 +18,2 @@ var HyperfrontendStringUtils = (function (exports) { | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Latin-1 "binary string" to Uint8Array. | ||
@@ -58,19 +35,2 @@ * | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
@@ -124,2 +84,42 @@ * Restores standard characters and adds padding if needed. | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Encodes a UTF-8 string to base64 format (browser implementation). | ||
@@ -126,0 +126,0 @@ * Supports optional URL-safe encoding and padding control. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.iife.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;IAAuB,IAAI,WAAW;IAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ICCnD;;;;;IAKG;IACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;IAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;ICVA;;;;;;;;;IASG;IACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;QACxH,IAAI,OAAO,EAAE;IACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;IACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;IAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;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M,CAAC,CAAC,CAAC;IACjE;;ICTA;;;;;;IAMG;IACG,SAAU,UAAU,CAAC,MAAc,EAAA;IACvC,IAAA,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3F;;ICXA;;;;;IAKG;IACG,SAAU,sBAAsB,CAAC,IAAY,EAAA;QACjD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;IACvC;;ICNA;;;;;;;;IAQG;IACG,SAAU,QAAQ,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;QACzE,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IACnH;;ICXA;;;;;;;;IAQG;IACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;QACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;YAC7D,OAAO;YACP,WAAW;IACZ,KAAA,CAAC;IACJ;;ICdA;;;;;IAKG;IACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;IAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"index.iife.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;IAAuB,IAAI,WAAW;IAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ICCnD;;;;;IAKG;IACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;IAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;ICVA;;;;;;;IAOG;IACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;QACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;IAC9C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACpC;IACA,IAAA,OAAO,KAAK;IACd;;ICdA;;;;;;IAMG;IACG,SAAU,qBAAqB,CAAC,aAAqB,EAAA;IACzD,IAAA,IAAI,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;IAC9E,IAAA,MAAM,GAAG,GAAG,gBAA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GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzC;IACA,IAAA,OAAO,MAAM;IACf;;ICZA;;;;;;;;IAQG;IACG,SAAU,QAAQ,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;QACzE,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IACnH;;ICXA;;;;;;;;IAQG;IACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;QACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;YAC7D,OAAO;YACP,WAAW;IACZ,KAAA,CAAC;IACJ;;ICfA;;;;;IAKG;IACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;IAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;;;;;;;;;;;;;;;"} |
@@ -1,2 +0,2 @@ | ||
| var HyperfrontendStringUtils=function(e){"use strict";new TextEncoder;const n=new TextDecoder("utf8");function t(e,{urlSafe:n,keepPadding:t}){if(n&&(e=e.replaceAll("+","-").replaceAll("/","_"),!1===t))for(;e.endsWith("=");)e=e.slice(0,-1);return e}function r(e){const n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}function o(e){let n="";for(let t=0;t<e.length;t+=1)n+=String.fromCharCode(e[t]);return n}function u(e){let n=e.replaceAll("-","+").replaceAll("_","/");const t=n.length%4;return t&&(n=n.padEnd(n.length+(4-t),"=")),n}return e.arrayBufferToUtf8String=function(e){return n.decode(e)},e.base64ToUint8Array=function(e){return r(atob(u(e)))},e.fromBase64=function(e){return(new TextDecoder).decode(r(atob(u(e))))},e.toBase64=function(e,n=!1,r=!1){return t(btoa(o((new TextEncoder).encode(e))),{urlSafe:n,keepPadding:r})},e.uint8ArrayToBase64=function(e,n=!1,r=!1){return t(btoa(o(e)),{urlSafe:n,keepPadding:r})},e.uint8ArrayToUtf8String=function(e){return n.decode(e)},e.utf8StringToUint8Array=function(e){return(new TextEncoder).encode(e)},e}({}); | ||
| var HyperfrontendStringUtils=function(e){"use strict";new TextEncoder;const n=new TextDecoder("utf8");function t(e){const n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}function r(e){let n=e.replaceAll("-","+").replaceAll("_","/");const t=n.length%4;return t&&(n=n.padEnd(n.length+(4-t),"=")),n}function o(e,{urlSafe:n,keepPadding:t}){if(n&&(e=e.replaceAll("+","-").replaceAll("/","_"),!1===t))for(;e.endsWith("=");)e=e.slice(0,-1);return e}function u(e){let n="";for(let t=0;t<e.length;t+=1)n+=String.fromCharCode(e[t]);return n}return e.arrayBufferToUtf8String=function(e){return n.decode(e)},e.base64ToUint8Array=function(e){return t(atob(r(e)))},e.fromBase64=function(e){return(new TextDecoder).decode(t(atob(r(e))))},e.toBase64=function(e,n=!1,t=!1){return o(btoa(u((new TextEncoder).encode(e))),{urlSafe:n,keepPadding:t})},e.uint8ArrayToBase64=function(e,n=!1,t=!1){return o(btoa(u(e)),{urlSafe:n,keepPadding:t})},e.uint8ArrayToUtf8String=function(e){return n.decode(e)},e.utf8StringToUint8Array=function(e){return(new TextEncoder).encode(e)},e}({}); | ||
| //# sourceMappingURL=index.iife.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.iife.min.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["TextEncoder","UTF8_DECODER","TextDecoder","base64ToUrlSafeBase64","base64","urlSafe","keepPadding","replaceAll","endsWith","slice","binaryStringToBytes","binaryStr","bytes","Uint8Array","length","i","charCodeAt","bytesToBinaryString","binary","String","fromCharCode","urlSafeBase64ToBase64","urlSafeBase64","normalizedBase64","pad","padEnd","uint8Array","decode","atob","text","btoa","encode"],"mappings":"sDAAuB,IAAIA,YACpB,MAAMC,EAAe,IAAIC,YAAY,QCStC,SAAUC,EAAsBC,GAAgBC,QAAEA,EAAOC,YAAEA,IAC/D,GAAID,IACFD,EAASA,EAAOG,WAAW,IAAK,KAAKA,WAAW,IAAK,MACjC,IAAhBD,GAEF,KAAOF,EAAOI,SAAS,MACrBJ,EAASA,EAAOK,MAAM,GAAG,GAI/B,OAAOL,CACT,CCbM,SAAUM,EAAoBC,GAClC,MAAMC,EAAQ,IAAIC,WAAWF,EAAUG,QACvC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAUG,OAAQC,GAAK,EACzCH,EAAMG,GAAKJ,EAAUK,WAAWD,GAElC,OAAOH,CACT,CCLM,SAAUK,EAAoBL,GAClC,IAAIM,EAAS,GACb,IAAK,IAAIH,EAAI,EAAGA,EAAIH,EAAME,OAAQC,GAAK,EACrCG,GAAUC,OAAOC,aAAaR,EAAMG,IAEtC,OAAOG,CACT,CCRM,SAAUG,EAAsBC,GACpC,IAAIC,EAAmBD,EAAcf,WAAW,IAAK,KAAKA,WAAW,IAAK,KAC1E,MAAMiB,EAAMD,EAAiBT,OAAS,EAItC,OAHIU,IACFD,EAAmBA,EAAiBE,OAAOF,EAAiBT,QAAU,EAAIU,GAAM,MAE3ED,CACT,kCCNM,SAAkCG,GACtC,OAAOzB,EAAa0B,OAAOD,EAC7B,uBCDM,SAA6BtB,GACjC,OAAOM,EAAoBkB,KAAKP,EAAsBjB,IACxD,eCFM,SAAqBA,GACzB,OAAO,IAAIF,aAAcyB,OAAOjB,EAAoBkB,KAAKP,EAAsBjB,KACjF,aCAM,SAAmByB,EAAcxB,GAAU,EAAOC,GAAc,GACpE,OAAOH,EAAsB2B,KAAKb,GAAoB,IAAIjB,aAAc+B,OAAOF,KAAS,CAAExB,UAASC,eACrG,uBCFM,SAA6BM,EAAmBP,GAAU,EAAOC,GAAc,GACnF,OAAOH,EAAsB2B,KAAKb,EAAoBL,IAAS,CAC7DP,UACAC,eAEJ,2BCRM,SAAiCoB,GACrC,OAAOzB,EAAa0B,OAAOD,EAC7B,2BCJM,SAAiCG,GACrC,OAAO,IAAI7B,aAAc+B,OAAOF,EAClC"} | ||
| {"version":3,"file":"index.iife.min.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["TextEncoder","UTF8_DECODER","TextDecoder","binaryStringToBytes","binaryStr","bytes","Uint8Array","length","i","charCodeAt","urlSafeBase64ToBase64","urlSafeBase64","normalizedBase64","replaceAll","pad","padEnd","base64ToUrlSafeBase64","base64","urlSafe","keepPadding","endsWith","slice","bytesToBinaryString","binary","String","fromCharCode","uint8Array","decode","atob","text","btoa","encode"],"mappings":"sDAAuB,IAAIA,YACpB,MAAMC,EAAe,IAAIC,YAAY,QCOtC,SAAUC,EAAoBC,GAClC,MAAMC,EAAQ,IAAIC,WAAWF,EAAUG,QACvC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAUG,OAAQC,GAAK,EACzCH,EAAMG,GAAKJ,EAAUK,WAAWD,GAElC,OAAOH,CACT,CCPM,SAAUK,EAAsBC,GACpC,IAAIC,EAAmBD,EAAcE,WAAW,IAAK,KAAKA,WAAW,IAAK,KAC1E,MAAMC,EAAMF,EAAiBL,OAAS,EAItC,OAHIO,IACFF,EAAmBA,EAAiBG,OAAOH,EAAiBL,QAAU,EAAIO,GAAM,MAE3EF,CACT,CCJM,SAAUI,EAAsBC,GAAgBC,QAAEA,EAAOC,YAAEA,IAC/D,GAAID,IACFD,EAASA,EAAOJ,WAAW,IAAK,KAAKA,WAAW,IAAK,MACjC,IAAhBM,GAEF,KAAOF,EAAOG,SAAS,MACrBH,EAASA,EAAOI,MAAM,GAAG,GAI/B,OAAOJ,CACT,CCZM,SAAUK,EAAoBjB,GAClC,IAAIkB,EAAS,GACb,IAAK,IAAIf,EAAI,EAAGA,EAAIH,EAAME,OAAQC,GAAK,EACrCe,GAAUC,OAAOC,aAAapB,EAAMG,IAEtC,OAAOe,CACT,kCCPM,SAAkCG,GACtC,OAAOzB,EAAa0B,OAAOD,EAC7B,uBCAM,SAA6BT,GACjC,OAAOd,EAAoByB,KAAKlB,EAAsBO,IACxD,eCFM,SAAqBA,GACzB,OAAO,IAAIf,aAAcyB,OAAOxB,EAAoByB,KAAKlB,EAAsBO,KACjF,aCAM,SAAmBY,EAAcX,GAAU,EAAOC,GAAc,GACpE,OAAOH,EAAsBc,KAAKR,GAAoB,IAAItB,aAAc+B,OAAOF,KAAS,CAAEX,UAASC,eACrG,uBCFM,SAA6Bd,EAAmBa,GAAU,EAAOC,GAAc,GACnF,OAAOH,EAAsBc,KAAKR,EAAoBjB,IAAS,CAC7Da,UACAC,eAEJ,2BCTM,SAAiCO,GACrC,OAAOzB,EAAa0B,OAAOD,EAC7B,2BCJM,SAAiCG,GACrC,OAAO,IAAI7B,aAAc+B,OAAOF,EAClC"} |
+40
-40
@@ -21,25 +21,2 @@ (function (global, factory) { | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Latin-1 "binary string" to Uint8Array. | ||
@@ -61,19 +38,2 @@ * | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
@@ -127,2 +87,42 @@ * Restores standard characters and adds padding if needed. | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Encodes a UTF-8 string to base64 format (browser implementation). | ||
@@ -129,0 +129,0 @@ * Supports optional URL-safe encoding and padding control. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.umd.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;IAAuB,IAAI,WAAW;IAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ICCnD;;;;;IAKG;IACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;IAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;ICVA;;;;;;;;;IASG;IACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;QACxH,IAAI,OAAO,EAAE;IACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GA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../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;IAAuB,IAAI,WAAW;IAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ICCnD;;;;;IAKG;IACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;IAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;ICVA;;;;;;;IAOG;IACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;QACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;IAC9C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACpC;IACA,IAAA,OAAO,KAAK;IACd;;ICdA;;;;;;IAMG;IACG,SAAU,q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,EAAE,EAAE,CAAC;gBAC9B;YACF;QACF;IACA,IAAA,OAAO,MAAM;IACf;;ICrBA;;;;;;;;IAQG;IACG,SAAU,mBAAmB,CAAC,KAAiB,EAAA;QACnD,IAAI,MAAM,GAAG,EAAE;IACf,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzC;IACA,IAAA,OAAO,MAAM;IACf;;ICZA;;;;;;;;IAQG;IACG,SAAU,QAAQ,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;QACzE,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IACnH;;ICXA;;;;;;;;IAQG;IACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;QACxF,OAAO,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE;YAC7D,OAAO;YACP,WAAW;IACZ,KAAA,CAAC;IACJ;;ICfA;;;;;IAKG;IACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;IAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;IACxC;;;;;;;;;;;;;;"} |
@@ -1,2 +0,2 @@ | ||
| !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendStringUtils={})}(this,function(e){"use strict";new TextEncoder;const n=new TextDecoder("utf8");function t(e,{urlSafe:n,keepPadding:t}){if(n&&(e=e.replaceAll("+","-").replaceAll("/","_"),!1===t))for(;e.endsWith("=");)e=e.slice(0,-1);return e}function r(e){const n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}function o(e){let n="";for(let t=0;t<e.length;t+=1)n+=String.fromCharCode(e[t]);return n}function f(e){let n=e.replaceAll("-","+").replaceAll("_","/");const t=n.length%4;return t&&(n=n.padEnd(n.length+(4-t),"=")),n}e.arrayBufferToUtf8String=function(e){return n.decode(e)},e.base64ToUint8Array=function(e){return r(atob(f(e)))},e.fromBase64=function(e){return(new TextDecoder).decode(r(atob(f(e))))},e.toBase64=function(e,n=!1,r=!1){return t(btoa(o((new TextEncoder).encode(e))),{urlSafe:n,keepPadding:r})},e.uint8ArrayToBase64=function(e,n=!1,r=!1){return t(btoa(o(e)),{urlSafe:n,keepPadding:r})},e.uint8ArrayToUtf8String=function(e){return n.decode(e)},e.utf8StringToUint8Array=function(e){return(new TextEncoder).encode(e)}}); | ||
| !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendStringUtils={})}(this,function(e){"use strict";new TextEncoder;const n=new TextDecoder("utf8");function t(e){const n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}function r(e){let n=e.replaceAll("-","+").replaceAll("_","/");const t=n.length%4;return t&&(n=n.padEnd(n.length+(4-t),"=")),n}function o(e,{urlSafe:n,keepPadding:t}){if(n&&(e=e.replaceAll("+","-").replaceAll("/","_"),!1===t))for(;e.endsWith("=");)e=e.slice(0,-1);return e}function f(e){let n="";for(let t=0;t<e.length;t+=1)n+=String.fromCharCode(e[t]);return n}e.arrayBufferToUtf8String=function(e){return n.decode(e)},e.base64ToUint8Array=function(e){return t(atob(r(e)))},e.fromBase64=function(e){return(new TextDecoder).decode(t(atob(r(e))))},e.toBase64=function(e,n=!1,t=!1){return o(btoa(f((new TextEncoder).encode(e))),{urlSafe:n,keepPadding:t})},e.uint8ArrayToBase64=function(e,n=!1,t=!1){return o(btoa(f(e)),{urlSafe:n,keepPadding:t})},e.uint8ArrayToUtf8String=function(e){return n.decode(e)},e.utf8StringToUint8Array=function(e){return(new TextEncoder).encode(e)}}); | ||
| //# sourceMappingURL=index.umd.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.umd.min.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["TextEncoder","UTF8_DECODER","TextDecoder","base64ToUrlSafeBase64","base64","urlSafe","keepPadding","replaceAll","endsWith","slice","binaryStringToBytes","binaryStr","bytes","Uint8Array","length","i","charCodeAt","bytesToBinaryString","binary","String","fromCharCode","urlSafeBase64ToBase64","urlSafeBase64","normalizedBase64","pad","padEnd","uint8Array","decode","atob","text","btoa","encode"],"mappings":"+PAAuB,IAAIA,YACpB,MAAMC,EAAe,IAAIC,YAAY,QCStC,SAAUC,EAAsBC,GAAgBC,QAAEA,EAAOC,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Ac+B,OAAOF,EAClC"} | ||
| {"version":3,"file":"index.umd.min.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/browser/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/browser/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser/utf8-string-to-uint8-array.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["TextEncoder","UTF8_DECODER","TextDecoder","binaryStringToBytes","binaryStr","bytes","Uint8Array","length","i","charCodeAt","urlSafeBase64ToBase64","urlSafeBase64","normalizedBase64","replaceAll","pad","padEnd","base64ToUrlSafeBase64","base64","urlSafe","keepPadding","endsWith","slice","bytesToBinaryString","binary","String","fromCharCode","uint8Array","decode","atob","text","btoa","encode"],"mappings":"+PAAuB,IAAIA,YACpB,MAAMC,EAAe,IAAIC,YAAY,QCOtC,SAAUC,EAAoBC,GAClC,MAAMC,EAAQ,IAAIC,WAAWF,EAAUG,QACvC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAUG,OAAQC,GAAK,EACzCH,EAAMG,GAAKJ,EAAUK,WAAWD,GAElC,OAAOH,CACT,CCPM,SAAUK,EAAs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fixes | ||
| * **lib-string-utils:** define correct secondary entrypoints ([b71a865](https://github.com/AndrewRedican/hyperfrontend/commit/b71a8655947af996fc5ef926e397243eff379a6e)) | ||
| ## 0.0.1 (2026-02-15) |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"array-buffer-to-utf8-string.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,CAEvE"} | ||
| {"version":3,"file":"array-buffer-to-utf8-string.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,CAEvE"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"shared-consts.d.ts","sourceRoot":"","sources":["../../../../../libs/utils/string/src/lib/shared-consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,aAAoB,CAAA;AACxC,eAAO,MAAM,YAAY,aAA0B,CAAA;AAEnD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAcpC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;CA6BpC,CAAA"} | ||
| {"version":3,"file":"shared-consts.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,aAAoB,CAAA;AACxC,eAAO,MAAM,YAAY,aAA0B,CAAA;AAEnD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAcpC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;CA6BpC,CAAA"} |
+23
-23
@@ -17,25 +17,2 @@ 'use strict'; | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
@@ -90,2 +67,25 @@ * Restores standard characters and adds padding if needed. | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Encodes a UTF-8 string to base64 format (Node.js implementation). | ||
@@ -92,0 +92,0 @@ * Supports optional URL-safe encoding and padding control. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/node.ts","../../../../../../libs/utils/string/src/lib/from-base64/node.ts","../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/node.ts","../../../../../../libs/utils/string/src/lib/to-base64/node.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/node.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;IACxH,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACrBA;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,aAAqB,EAAA;AACzD,IAAA,IAAI,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,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AAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;AACxF,IAAA,OAAO,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAC1I;;ACXA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;;;;;;;"} | ||
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/node/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/node/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/node/utf8-string-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/node/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/node/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;AAMG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E,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACnBA;;;;;;;;AAQG;AACG,SAAU,QAAQ,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;AACzE,IAAA,OAAO,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACzE,OAAO;QACP,WAAW;AACZ,KAAA,CAAC;AACJ;;ACdA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;AACxF,IAAA,OAAO,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAC1I;;ACXA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;;;;;;;"} |
+6
-6
| export * from '../lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string'; | ||
| export * from '../lib/base64-to-uint8-array/node'; | ||
| export * from '../lib/from-base64/node'; | ||
| export * from '../lib/utf8-string-to-uint8-array/node'; | ||
| export * from '../lib/to-base64/node'; | ||
| export * from '../lib/uint8-array-to-base64/node'; | ||
| export * from '../lib/uint8-array-to-utf8-string'; | ||
| export * from '../lib/base64-to-uint8-array/node/base64-to-uint8-array'; | ||
| export * from '../lib/from-base64/node/from-base64'; | ||
| export * from '../lib/utf8-string-to-uint8-array/node/utf8-string-to-uint8-array'; | ||
| export * from '../lib/to-base64/node/to-base64'; | ||
| export * from '../lib/uint8-array-to-base64/node/uint8-array-to-base64'; | ||
| export * from '../lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/utils/string/src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gEAAgE,CAAA;AAC9E,cAAc,mCAAmC,CAAA;AACjD,cAAc,yBAAyB,CAAA;AACvC,cAAc,wCAAwC,CAAA;AACtD,cAAc,uBAAuB,CAAA;AACrC,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/utils/string/src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gEAAgE,CAAA;AAC9E,cAAc,yDAAyD,CAAA;AACvE,cAAc,qCAAqC,CAAA;AACnD,cAAc,mEAAmE,CAAA;AACjF,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yDAAyD,CAAA;AACvE,cAAc,8DAA8D,CAAA"} |
+23
-23
@@ -15,25 +15,2 @@ new TextEncoder(); | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
@@ -88,2 +65,25 @@ * Restores standard characters and adds padding if needed. | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Encodes a UTF-8 string to base64 format (Node.js implementation). | ||
@@ -90,0 +90,0 @@ * Supports optional URL-safe encoding and padding control. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.esm.js","sources":["../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/node.ts","../../../../../../libs/utils/string/src/lib/from-base64/node.ts","../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/node.ts","../../../../../../libs/utils/string/src/lib/to-base64/node.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/node.ts","../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":"AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;IACxH,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACrBA;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,aAAqB,EAAA;AACzD,IAAA,IAAI,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AAC9E,IAAA,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC;IACvC,IAAI,GAAG,EAAE;AACP,QAAA,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC;IACtF;AACA,IAAA,OAAO,gBAAgB;AACzB;;ACZA;;;;;;AAMG;AACG,SAAU,kBAAkB,CAAC,MAAc,EAA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AM,CAAC,UAAU,CAAC;AACxC;;;;"} | ||
| {"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../../../libs/utils/string/src/lib/array-buffer-to-utf8-string/array-buffer-to-utf8-string.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/node/base64-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/from-base64/node/from-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/node/utf8-string-to-uint8-array.ts","../../../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/to-base64/node/to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/node/uint8-array-to-base64.ts","../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/uint8-array-to-utf8-string.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":"AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,uBAAuB,CAAC,UAAuB,EAAA;AAC7D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;ACVA;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,aAAqB,EAAA;AACzD,IAAA,IAAI,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AAC9E,IAAA,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC;IACvC,IAAI,GAAG,EAAE;AACP,QAAA,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE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,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACzE,OAAO;QACP,WAAW;AACZ,KAAA,CAAC;AACJ;;ACdA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAAC,KAAiB,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAA;AACxF,IAAA,OAAO,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAC1I;;ACXA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;"} |
+2
-22
| { | ||
| "name": "@hyperfrontend/string-utils", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "Isomorphic string encoding utilities with unified APIs for browser and Node.js environments.", | ||
@@ -31,7 +31,2 @@ "license": "MIT", | ||
| "./package.json": "./package.json", | ||
| ".": { | ||
| "types": "./index.d.ts", | ||
| "import": "./index.esm.js", | ||
| "require": "./index.cjs.js" | ||
| }, | ||
| "./browser": { | ||
@@ -42,12 +37,2 @@ "types": "./browser/index.d.ts", | ||
| }, | ||
| "./lib/uint8-array-to-utf8-string": { | ||
| "types": "./lib/uint8-array-to-utf8-string/index.d.ts", | ||
| "import": "./lib/uint8-array-to-utf8-string/index.esm.js", | ||
| "require": "./lib/uint8-array-to-utf8-string/index.cjs.js" | ||
| }, | ||
| "./lib/utils": { | ||
| "types": "./lib/utils/index.d.ts", | ||
| "import": "./lib/utils/index.esm.js", | ||
| "require": "./lib/utils/index.cjs.js" | ||
| }, | ||
| "./node": { | ||
@@ -74,8 +59,3 @@ "types": "./node/index.d.ts", | ||
| "url": "https://hyperfrontend.dev" | ||
| }, | ||
| "main": "./index.cjs.js", | ||
| "module": "./index.esm.js", | ||
| "types": "./index.d.ts", | ||
| "unpkg": "./bundle/index.umd.min.js", | ||
| "jsdelivr": "./bundle/index.umd.min.js" | ||
| } | ||
| } |
+3
-4
@@ -29,5 +29,2 @@ # @hyperfrontend/string-utils | ||
| </a> | ||
| <a href="https://bundlephobia.com/package/@hyperfrontend/string-utils"> | ||
| <img src="https://img.shields.io/bundlephobia/minzip/@hyperfrontend/string-utils?style=flat-square" alt="Bundle Size"> | ||
| </a> | ||
| <img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen?style=flat-square&logo=node.js" alt="Node Version"> | ||
@@ -184,4 +181,6 @@ <img src="https://img.shields.io/badge/tree%20shakeable-%E2%9C%93-success?style=flat-square" alt="Tree Shakeable"> | ||
| This library is part of the [hyperfrontend](https://github.com/AndrewRedican/hyperfrontend) monorepo. [Full documentation](https://hyperfrontend.dev). | ||
| This library is part of the [hyperfrontend](https://github.com/AndrewRedican/hyperfrontend) monorepo. | ||
| **📖 [Full documentation](https://www.hyperfrontend.dev/docs/libraries/utils/string)** | ||
| - Used by [@hyperfrontend/cryptography](https://github.com/AndrewRedican/hyperfrontend/tree/main/libs/cryptography) for UTF-8/binary conversions | ||
@@ -188,0 +187,0 @@ |
| 'use strict'; | ||
| //# sourceMappingURL=index.cjs.js.map |
| {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"} |
| export {}; | ||
| /** | ||
| * Nothing to export from this file. | ||
| * This package exposes secondary entry points only. | ||
| * However, \@nx/rollup requires either `"main"` or `"entryFile"` field value | ||
| * which cannot be ommited or be given a blank file. | ||
| */ | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/utils/string/src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"} |
| //# sourceMappingURL=index.esm.js.map |
| {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} |
| /** | ||
| * Converts a base64 encoded string to a Uint8Array (browser implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param base64 - The base64 encoded string to convert | ||
| * @returns The decoded Uint8Array | ||
| */ | ||
| export declare function base64ToUint8Array(base64: string): Uint8Array; | ||
| //# sourceMappingURL=browser.d.ts.map |
| {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/browser.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAE7D"} |
| /** | ||
| * Converts a base64 encoded string to a Uint8Array (Node.js implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param base64 - The base64 encoded string to convert | ||
| * @returns The decoded Uint8Array | ||
| */ | ||
| export declare function base64ToUint8Array(base64: string): Uint8Array; | ||
| //# sourceMappingURL=node.d.ts.map |
| {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/base64-to-uint8-array/node.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAG7D"} |
| /** | ||
| * Decodes a base64 encoded string to a UTF-8 string (browser implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param base64 - The base64 encoded string to decode | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| export declare function fromBase64(base64: string): string; | ||
| //# sourceMappingURL=browser.d.ts.map |
| {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/from-base64/browser.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD"} |
| /** | ||
| * Decodes a base64 encoded string to a UTF-8 string (Node.js implementation). | ||
| * Supports both standard and URL-safe base64 encoding. | ||
| * | ||
| * @param text - The base64 encoded string to decode | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| export declare function fromBase64(text: string): string; | ||
| //# sourceMappingURL=node.d.ts.map |
| {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/from-base64/node.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"} |
| /** | ||
| * Encodes a UTF-8 string to base64 format (browser implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param text - The UTF-8 string to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function toBase64(text: string, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=browser.d.ts.map |
| {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/to-base64/browser.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAEnF"} |
| /** | ||
| * Encodes a UTF-8 string to base64 format (Node.js implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param text - The UTF-8 string to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function toBase64(text: string, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=node.d.ts.map |
| {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/to-base64/node.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAKnF"} |
| /** | ||
| * Converts a Uint8Array to a base64 encoded string (browser implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param bytes - The Uint8Array to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function uint8ArrayToBase64(bytes: Uint8Array, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=browser.d.ts.map |
| {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/browser.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAKlG"} |
| /** | ||
| * Converts a Uint8Array to a base64 encoded string (Node.js implementation). | ||
| * Supports optional URL-safe encoding and padding control. | ||
| * | ||
| * @param bytes - The Uint8Array to encode | ||
| * @param urlSafe - Whether to use URL-safe base64 encoding (replaces + and / with - and _) | ||
| * @param keepPadding - Whether to keep padding characters (=) in the output | ||
| * @returns The base64 encoded string | ||
| */ | ||
| export declare function uint8ArrayToBase64(bytes: Uint8Array, urlSafe?: boolean, keepPadding?: boolean): string; | ||
| //# sourceMappingURL=node.d.ts.map |
| {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/uint8-array-to-base64/node.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,UAAQ,EAAE,WAAW,UAAQ,GAAG,MAAM,CAElG"} |
| 'use strict'; | ||
| new TextEncoder(); | ||
| const UTF8_DECODER = new TextDecoder('utf8'); | ||
| /** | ||
| * Converts a Uint8Array to a UTF-8 encoded string. | ||
| * | ||
| * @param uint8Array - The Uint8Array to convert | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| function uint8ArrayToUtf8String(uint8Array) { | ||
| return UTF8_DECODER.decode(uint8Array); | ||
| } | ||
| exports.uint8ArrayToUtf8String = uint8ArrayToUtf8String; | ||
| //# sourceMappingURL=index.cjs.js.map |
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;"} |
| /** | ||
| * Converts a Uint8Array to a UTF-8 encoded string. | ||
| * | ||
| * @param uint8Array - The Uint8Array to convert | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| export declare function uint8ArrayToUtf8String(uint8Array: Uint8Array): string; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAErE"} |
| new TextEncoder(); | ||
| const UTF8_DECODER = new TextDecoder('utf8'); | ||
| /** | ||
| * Converts a Uint8Array to a UTF-8 encoded string. | ||
| * | ||
| * @param uint8Array - The Uint8Array to convert | ||
| * @returns The decoded UTF-8 string | ||
| */ | ||
| function uint8ArrayToUtf8String(uint8Array) { | ||
| return UTF8_DECODER.decode(uint8Array); | ||
| } | ||
| export { uint8ArrayToUtf8String }; | ||
| //# sourceMappingURL=index.esm.js.map |
| {"version":3,"file":"index.esm.js","sources":["../../../../../../../../libs/utils/string/src/lib/shared-consts.ts","../../../../../../../../libs/utils/string/src/lib/uint8-array-to-utf8-string/index.ts"],"sourcesContent":[null,null],"names":[],"mappings":"AAAuB,IAAI,WAAW;AAC/B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;;ACCnD;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,UAAsB,EAAA;AAC3D,IAAA,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AACxC;;;;"} |
| /** | ||
| * Converts a UTF-8 string to a Uint8Array (browser implementation). | ||
| * | ||
| * @param text - The UTF-8 string to convert | ||
| * @returns The encoded Uint8Array | ||
| */ | ||
| export declare function utf8StringToUint8Array(text: string): Uint8Array; | ||
| //# sourceMappingURL=browser.d.ts.map |
| {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE/D"} |
| /** | ||
| * Converts a UTF-8 string to a Uint8Array (Node.js implementation). | ||
| * | ||
| * @param text - The UTF-8 string to convert | ||
| * @returns The encoded Uint8Array | ||
| */ | ||
| export declare function utf8StringToUint8Array(text: string): Uint8Array; | ||
| //# sourceMappingURL=node.d.ts.map |
| {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../../../libs/utils/string/src/lib/utf8-string-to-uint8-array/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE/D"} |
| 'use strict'; | ||
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Latin-1 "binary string" to Uint8Array. | ||
| * | ||
| * Truncates code units above 255 (U+0100+). Not unicode-safe. | ||
| * | ||
| * @param binaryStr - The Latin-1 binary string to convert | ||
| * @returns A Uint8Array containing the byte values from the string | ||
| */ | ||
| function binaryStringToBytes(binaryStr) { | ||
| const bytes = new Uint8Array(binaryStr.length); | ||
| for (let i = 0; i < binaryStr.length; i += 1) { | ||
| bytes[i] = binaryStr.charCodeAt(i); | ||
| } | ||
| return bytes; | ||
| } | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
| * Restores standard characters and adds padding if needed. | ||
| * | ||
| * @param urlSafeBase64 - The URL-safe base64 encoded string to convert | ||
| * @returns The standard base64 encoded string with proper padding | ||
| */ | ||
| function urlSafeBase64ToBase64(urlSafeBase64) { | ||
| let normalizedBase64 = urlSafeBase64.replaceAll('-', '+').replaceAll('_', '/'); | ||
| const pad = normalizedBase64.length % 4; | ||
| if (pad) { | ||
| normalizedBase64 = normalizedBase64.padEnd(normalizedBase64.length + (4 - pad), '='); | ||
| } | ||
| return normalizedBase64; | ||
| } | ||
| exports.base64ToUrlSafeBase64 = base64ToUrlSafeBase64; | ||
| exports.binaryStringToBytes = binaryStringToBytes; | ||
| exports.bytesToBinaryString = bytesToBinaryString; | ||
| exports.urlSafeBase64ToBase64 = urlSafeBase64ToBase64; | ||
| //# sourceMappingURL=index.cjs.js.map |
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;AAAA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;IACxH,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACrBA;;;;;;;AAOG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;AAC9C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC;AACA,IAAA,OAAO,KAAK;AACd;;ACdA;;;;;;;;AAQG;AACG,SAAU,mBAAmB,CAAC,KAAiB,EAAA;IACnD,IAAI,MAAM,GAAG,EAAE;AACf,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACxC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC;AACA,IAAA,OAAO,MAAM;AACf;;ACfA;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,aAAqB,EAAA;AACzD,IAAA,IAAI,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AAC9E,IAAA,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC;IACvC,IAAI,GAAG,EAAE;AACP,QAAA,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC;IACtF;AACA,IAAA,OAAO,gBAAgB;AACzB;;;;;;;"} |
| export * from './base64-to-url-safe-base64'; | ||
| export * from './binary-string-to-bytes'; | ||
| export * from './bytes-to-binary-string'; | ||
| export * from './url-safe-base64-to-base64'; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/string/src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA"} |
| /** | ||
| * Converts standard base64 encoding to URL-safe base64 encoding. | ||
| * Optionally removes padding characters for more compact representation. | ||
| * | ||
| * @param base64 - The standard base64 encoded string | ||
| * @param root0 - Configuration options | ||
| * @param root0.urlSafe - Whether to apply URL-safe transformations (+ → -, / → _) | ||
| * @param root0.keepPadding - Whether to preserve padding characters (=) | ||
| * @returns The URL-safe base64 encoded string | ||
| */ | ||
| function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) { | ||
| if (urlSafe) { | ||
| base64 = base64.replaceAll('+', '-').replaceAll('/', '_'); | ||
| if (keepPadding === false) { | ||
| // Remove trailing = padding characters without regex to avoid ReDoS | ||
| while (base64.endsWith('=')) { | ||
| base64 = base64.slice(0, -1); | ||
| } | ||
| } | ||
| } | ||
| return base64; | ||
| } | ||
| /** | ||
| * Converts a Latin-1 "binary string" to Uint8Array. | ||
| * | ||
| * Truncates code units above 255 (U+0100+). Not unicode-safe. | ||
| * | ||
| * @param binaryStr - The Latin-1 binary string to convert | ||
| * @returns A Uint8Array containing the byte values from the string | ||
| */ | ||
| function binaryStringToBytes(binaryStr) { | ||
| const bytes = new Uint8Array(binaryStr.length); | ||
| for (let i = 0; i < binaryStr.length; i += 1) { | ||
| bytes[i] = binaryStr.charCodeAt(i); | ||
| } | ||
| return bytes; | ||
| } | ||
| /** | ||
| * Converts a Uint8Array to a Latin-1 "binary string" where | ||
| * each byte becomes a single charCode (0-255). | ||
| * | ||
| * Use only for binary <-> base64 interop in browsers. | ||
| * | ||
| * @param bytes - The Uint8Array to convert | ||
| * @returns A Latin-1 binary string representation | ||
| */ | ||
| function bytesToBinaryString(bytes) { | ||
| let binary = ''; | ||
| for (let i = 0; i < bytes.length; i += 1) { | ||
| binary += String.fromCharCode(bytes[i]); | ||
| } | ||
| return binary; | ||
| } | ||
| /** | ||
| * Converts URL-safe base64 encoding back to standard base64 encoding. | ||
| * Restores standard characters and adds padding if needed. | ||
| * | ||
| * @param urlSafeBase64 - The URL-safe base64 encoded string to convert | ||
| * @returns The standard base64 encoded string with proper padding | ||
| */ | ||
| function urlSafeBase64ToBase64(urlSafeBase64) { | ||
| let normalizedBase64 = urlSafeBase64.replaceAll('-', '+').replaceAll('_', '/'); | ||
| const pad = normalizedBase64.length % 4; | ||
| if (pad) { | ||
| normalizedBase64 = normalizedBase64.padEnd(normalizedBase64.length + (4 - pad), '='); | ||
| } | ||
| return normalizedBase64; | ||
| } | ||
| export { base64ToUrlSafeBase64, binaryStringToBytes, bytesToBinaryString, urlSafeBase64ToBase64 }; | ||
| //# sourceMappingURL=index.esm.js.map |
| {"version":3,"file":"index.esm.js","sources":["../../../../../../../../libs/utils/string/src/lib/utils/base64-to-url-safe-base64.ts","../../../../../../../../libs/utils/string/src/lib/utils/binary-string-to-bytes.ts","../../../../../../../../libs/utils/string/src/lib/utils/bytes-to-binary-string.ts","../../../../../../../../libs/utils/string/src/lib/utils/url-safe-base64-to-base64.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":"AAAA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CAAC,MAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAA8C,EAAA;IACxH,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,WAAW,KAAK,KAAK,EAAE;;AAEzB,YAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC9B;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACrBA;;;;;;;AAOG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;AAC9C,IAAA,KAAK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