cafe-utility 10.20.0 → 10.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.js +7 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ declare type StringSegment = {
|
|
|
169
169
|
declare function segmentizeString(string: string, symbol: string): StringSegment[];
|
|
170
170
|
declare function base64ToUint8Array(base64: string): Uint8Array;
|
|
171
171
|
declare function hexToUint8Array(hex: string): Uint8Array;
|
|
172
|
+
declare function uint8ArrayToHex(array: Uint8Array): string;
|
|
172
173
|
declare function route(pattern: string, actual: string): Record<string, unknown> | null;
|
|
173
174
|
declare function parseHtmlAttributes(string: string): Record<string, string>;
|
|
174
175
|
declare function readNextWord(string: string, index: number, allowedCharacters?: string[]): string;
|
|
@@ -621,6 +622,7 @@ export declare const Strings: {
|
|
|
621
622
|
textToFormat: typeof textToFormat;
|
|
622
623
|
segmentize: typeof segmentizeString;
|
|
623
624
|
hexToUint8Array: typeof hexToUint8Array;
|
|
625
|
+
uint8ArrayToHex: typeof uint8ArrayToHex;
|
|
624
626
|
base64ToUint8Array: typeof base64ToUint8Array;
|
|
625
627
|
route: typeof route;
|
|
626
628
|
};
|
package/index.js
CHANGED
|
@@ -1193,6 +1193,12 @@ function hexToUint8Array(hex) {
|
|
|
1193
1193
|
return result
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
|
+
function uint8ArrayToHex(array) {
|
|
1197
|
+
return Array.from(array)
|
|
1198
|
+
.map(byte => byte.toString(16).padStart(2, '0'))
|
|
1199
|
+
.join('')
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1196
1202
|
function route(pattern, actual) {
|
|
1197
1203
|
const patternPieces = pattern.split('/').filter(x => x)
|
|
1198
1204
|
const actualPieces = actual.split('/').filter(x => x)
|
|
@@ -2942,6 +2948,7 @@ exports.Strings = {
|
|
|
2942
2948
|
textToFormat,
|
|
2943
2949
|
segmentize: segmentizeString,
|
|
2944
2950
|
hexToUint8Array,
|
|
2951
|
+
uint8ArrayToHex,
|
|
2945
2952
|
base64ToUint8Array,
|
|
2946
2953
|
route
|
|
2947
2954
|
}
|