@svta/cml-utils 1.0.1 → 1.2.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/dist/index.d.ts +54 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* @param buffer - The ArrayBuffer to encode.
|
|
6
6
|
* @returns The hexadecimal string representation.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* @beta
|
|
8
|
+
* @public
|
|
10
9
|
*
|
|
11
10
|
* @example
|
|
12
11
|
* {@includeCode ../test/arrayBufferToHex.test.ts#example}
|
|
@@ -20,8 +19,7 @@ declare function arrayBufferToHex(buffer: ArrayBuffer): string;
|
|
|
20
19
|
* @param buffer - The ArrayBuffer to convert.
|
|
21
20
|
* @returns The UUID string representation.
|
|
22
21
|
*
|
|
23
|
-
*
|
|
24
|
-
* @beta
|
|
22
|
+
* @public
|
|
25
23
|
*
|
|
26
24
|
* @example
|
|
27
25
|
* {@includeCode ../test/arrayBufferToUuid.test.ts#example}
|
|
@@ -35,8 +33,7 @@ declare function arrayBufferToUuid(buffer: ArrayBuffer): string;
|
|
|
35
33
|
* @param str - The base64 encoded string to decode
|
|
36
34
|
* @returns The decoded binary data
|
|
37
35
|
*
|
|
38
|
-
*
|
|
39
|
-
* @beta
|
|
36
|
+
* @public
|
|
40
37
|
*/
|
|
41
38
|
declare function decodeBase64(str: string): Uint8Array;
|
|
42
39
|
//#endregion
|
|
@@ -47,8 +44,7 @@ declare function decodeBase64(str: string): Uint8Array;
|
|
|
47
44
|
* @param str - The base64 encoded string to decode
|
|
48
45
|
* @returns The decoded binary data
|
|
49
46
|
*
|
|
50
|
-
*
|
|
51
|
-
* @beta
|
|
47
|
+
* @public
|
|
52
48
|
*
|
|
53
49
|
* @deprecated Use {@link decodeBase64} instead.
|
|
54
50
|
*
|
|
@@ -63,8 +59,7 @@ declare const base64decode: typeof decodeBase64;
|
|
|
63
59
|
* @param binary - The binary data to encode
|
|
64
60
|
* @returns The base64 encoded string
|
|
65
61
|
*
|
|
66
|
-
*
|
|
67
|
-
* @beta
|
|
62
|
+
* @public
|
|
68
63
|
*/
|
|
69
64
|
declare function encodeBase64(binary: Uint8Array): string;
|
|
70
65
|
//#endregion
|
|
@@ -75,8 +70,7 @@ declare function encodeBase64(binary: Uint8Array): string;
|
|
|
75
70
|
* @param binary - The binary data to encode
|
|
76
71
|
* @returns The base64 encoded string
|
|
77
72
|
*
|
|
78
|
-
*
|
|
79
|
-
* @beta
|
|
73
|
+
* @public
|
|
80
74
|
*
|
|
81
75
|
* @deprecated Use {@link encodeBase64} instead.
|
|
82
76
|
*
|
|
@@ -91,7 +85,7 @@ declare const base64encode: typeof encodeBase64;
|
|
|
91
85
|
* @param input - The Uint8Array to convert
|
|
92
86
|
* @returns A properly aligned Uint16Array
|
|
93
87
|
*
|
|
94
|
-
* @
|
|
88
|
+
* @public
|
|
95
89
|
*/
|
|
96
90
|
declare function convertUint8ToUint16(input: Uint8Array): Uint16Array;
|
|
97
91
|
//#endregion
|
|
@@ -99,8 +93,7 @@ declare function convertUint8ToUint16(input: Uint8Array): Uint16Array;
|
|
|
99
93
|
/**
|
|
100
94
|
* UTF-16 Encoding.
|
|
101
95
|
*
|
|
102
|
-
*
|
|
103
|
-
* @beta
|
|
96
|
+
* @public
|
|
104
97
|
*/
|
|
105
98
|
declare const UTF_16 = "utf-16";
|
|
106
99
|
//#endregion
|
|
@@ -108,8 +101,7 @@ declare const UTF_16 = "utf-16";
|
|
|
108
101
|
/**
|
|
109
102
|
* UTF-16 Big Endian Encoding.
|
|
110
103
|
*
|
|
111
|
-
*
|
|
112
|
-
* @beta
|
|
104
|
+
* @public
|
|
113
105
|
*/
|
|
114
106
|
declare const UTF_16_BE = "utf-16be";
|
|
115
107
|
//#endregion
|
|
@@ -117,8 +109,7 @@ declare const UTF_16_BE = "utf-16be";
|
|
|
117
109
|
/**
|
|
118
110
|
* UTF-16 Little Endian Encoding.
|
|
119
111
|
*
|
|
120
|
-
*
|
|
121
|
-
* @beta
|
|
112
|
+
* @public
|
|
122
113
|
*/
|
|
123
114
|
declare const UTF_16_LE = "utf-16le";
|
|
124
115
|
//#endregion
|
|
@@ -126,8 +117,7 @@ declare const UTF_16_LE = "utf-16le";
|
|
|
126
117
|
/**
|
|
127
118
|
* UTF-8 Encoding.
|
|
128
119
|
*
|
|
129
|
-
*
|
|
130
|
-
* @beta
|
|
120
|
+
* @public
|
|
131
121
|
*/
|
|
132
122
|
declare const UTF_8 = "utf-8";
|
|
133
123
|
//#endregion
|
|
@@ -135,8 +125,7 @@ declare const UTF_8 = "utf-8";
|
|
|
135
125
|
/**
|
|
136
126
|
* Utility type to get the value of a given object type.
|
|
137
127
|
*
|
|
138
|
-
*
|
|
139
|
-
* @beta
|
|
128
|
+
* @public
|
|
140
129
|
*/
|
|
141
130
|
type ValueOf<T> = T[keyof T];
|
|
142
131
|
//#endregion
|
|
@@ -144,8 +133,7 @@ type ValueOf<T> = T[keyof T];
|
|
|
144
133
|
/**
|
|
145
134
|
* Text encoding types.
|
|
146
135
|
*
|
|
147
|
-
*
|
|
148
|
-
* @beta
|
|
136
|
+
* @public
|
|
149
137
|
*/
|
|
150
138
|
declare const Encoding: {
|
|
151
139
|
readonly UTF8: typeof UTF_8;
|
|
@@ -156,8 +144,7 @@ declare const Encoding: {
|
|
|
156
144
|
/**
|
|
157
145
|
* Text encoding types.
|
|
158
146
|
*
|
|
159
|
-
*
|
|
160
|
-
* @beta
|
|
147
|
+
* @public
|
|
161
148
|
*/
|
|
162
149
|
type Encoding = ValueOf<typeof Encoding>;
|
|
163
150
|
//#endregion
|
|
@@ -165,8 +152,7 @@ type Encoding = ValueOf<typeof Encoding>;
|
|
|
165
152
|
/**
|
|
166
153
|
* Options for the `decodeText` function.
|
|
167
154
|
*
|
|
168
|
-
*
|
|
169
|
-
* @beta
|
|
155
|
+
* @public
|
|
170
156
|
*/
|
|
171
157
|
type DecodeTextOptions = {
|
|
172
158
|
/**
|
|
@@ -184,20 +170,41 @@ type DecodeTextOptions = {
|
|
|
184
170
|
* @param options - The options for the decoding.
|
|
185
171
|
* @returns The string representation of the ArrayBuffer.
|
|
186
172
|
*
|
|
187
|
-
*
|
|
188
|
-
* @beta
|
|
173
|
+
* @public
|
|
189
174
|
*
|
|
190
175
|
* @example
|
|
191
176
|
* {@includeCode ../test/decodeText.test.ts#example}
|
|
192
177
|
*/
|
|
193
178
|
declare function decodeText(data: ArrayBuffer | ArrayBufferView<ArrayBuffer>, options?: DecodeTextOptions): string;
|
|
194
179
|
//#endregion
|
|
180
|
+
//#region src/encodeText.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* Converts a string to a Uint8Array. Similar to `TextEncoder.encode`
|
|
183
|
+
* but with a fallback for environments that don't support `TextEncoder`.
|
|
184
|
+
*
|
|
185
|
+
* @param data - The string to encode.
|
|
186
|
+
* @returns The Uint8Array representation of the string.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* {@includeCode ../test/encodeText.test.ts#example}
|
|
192
|
+
*/
|
|
193
|
+
declare function encodeText(data: string): Uint8Array;
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/ExclusiveRecord.d.ts
|
|
196
|
+
/**
|
|
197
|
+
* A record that is exclusive to a given key.
|
|
198
|
+
*
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
type ExclusiveRecord<K extends PropertyKey, V> = { [P in K]: Record<P, V> & Partial<Record<Exclude<K, P>, never>> extends infer O ? { [Q in keyof O]: O[Q] } : never }[K];
|
|
202
|
+
//#endregion
|
|
195
203
|
//#region src/ResourceTiming.d.ts
|
|
196
204
|
/**
|
|
197
205
|
* Resource Timing.
|
|
198
206
|
*
|
|
199
|
-
*
|
|
200
|
-
* @beta
|
|
207
|
+
* @public
|
|
201
208
|
*/
|
|
202
209
|
type ResourceTiming = {
|
|
203
210
|
startTime: number;
|
|
@@ -213,8 +220,7 @@ type ResourceTiming = {
|
|
|
213
220
|
* @param sample - A ResourceTiming sample
|
|
214
221
|
* @returns
|
|
215
222
|
*
|
|
216
|
-
*
|
|
217
|
-
* @beta
|
|
223
|
+
* @public
|
|
218
224
|
*/
|
|
219
225
|
declare function getBandwidthBps(sample: ResourceTiming): number;
|
|
220
226
|
//#endregion
|
|
@@ -225,8 +231,7 @@ declare function getBandwidthBps(sample: ResourceTiming): number;
|
|
|
225
231
|
* @param hex - The hexadecimal string to decode.
|
|
226
232
|
* @returns The decoded ArrayBuffer.
|
|
227
233
|
*
|
|
228
|
-
*
|
|
229
|
-
* @beta
|
|
234
|
+
* @public
|
|
230
235
|
*
|
|
231
236
|
* @example
|
|
232
237
|
* {@includeCode ../test/hexToArrayBuffer.test.ts#example}
|
|
@@ -240,7 +245,7 @@ declare function hexToArrayBuffer(hex: string): ArrayBuffer;
|
|
|
240
245
|
*
|
|
241
246
|
* @enum
|
|
242
247
|
*
|
|
243
|
-
* @
|
|
248
|
+
* @public
|
|
244
249
|
*/
|
|
245
250
|
declare const RequestType: {
|
|
246
251
|
readonly TEXT: "text";
|
|
@@ -250,7 +255,7 @@ declare const RequestType: {
|
|
|
250
255
|
readonly DOCUMENT: "document";
|
|
251
256
|
};
|
|
252
257
|
/**
|
|
253
|
-
* @
|
|
258
|
+
* @public
|
|
254
259
|
*/
|
|
255
260
|
type RequestType = ValueOf<typeof RequestType>;
|
|
256
261
|
//#endregion
|
|
@@ -258,8 +263,7 @@ type RequestType = ValueOf<typeof RequestType>;
|
|
|
258
263
|
/**
|
|
259
264
|
* Generic request API.
|
|
260
265
|
*
|
|
261
|
-
*
|
|
262
|
-
* @beta
|
|
266
|
+
* @public
|
|
263
267
|
*/
|
|
264
268
|
type Request<D = any> = {
|
|
265
269
|
/**
|
|
@@ -310,8 +314,7 @@ type Request<D = any> = {
|
|
|
310
314
|
* @param precision - The number of decimal places to round to
|
|
311
315
|
* @returns The rounded value
|
|
312
316
|
*
|
|
313
|
-
*
|
|
314
|
-
* @beta
|
|
317
|
+
* @public
|
|
315
318
|
*/
|
|
316
319
|
declare function roundToEven(value: number, precision: number): number;
|
|
317
320
|
//#endregion
|
|
@@ -322,8 +325,7 @@ declare function roundToEven(value: number, precision: number): number;
|
|
|
322
325
|
* @param str - The string to convert
|
|
323
326
|
* @returns A Uint16Array representation of the string
|
|
324
327
|
*
|
|
325
|
-
*
|
|
326
|
-
* @beta
|
|
328
|
+
* @public
|
|
327
329
|
*
|
|
328
330
|
* @example
|
|
329
331
|
* {@includeCode ../test/stringToUint16.test.ts#example}
|
|
@@ -334,8 +336,7 @@ declare function stringToUint16(str: string): Uint16Array<ArrayBuffer>;
|
|
|
334
336
|
/**
|
|
335
337
|
* Utility type to create a typed result.
|
|
336
338
|
*
|
|
337
|
-
*
|
|
338
|
-
* @beta
|
|
339
|
+
* @public
|
|
339
340
|
*/
|
|
340
341
|
type TypedResult<T, D> = {
|
|
341
342
|
type: T;
|
|
@@ -349,8 +350,7 @@ type TypedResult<T, D> = {
|
|
|
349
350
|
* @param text - The text to unescape
|
|
350
351
|
* @returns The unescaped text
|
|
351
352
|
*
|
|
352
|
-
*
|
|
353
|
-
* @beta
|
|
353
|
+
* @public
|
|
354
354
|
*
|
|
355
355
|
* @example
|
|
356
356
|
* {@includeCode ../test/unescapeHtml.test.ts#example}
|
|
@@ -365,8 +365,7 @@ declare function unescapeHtml(text: string): string;
|
|
|
365
365
|
* @param base - The base URL
|
|
366
366
|
* @returns The relative path
|
|
367
367
|
*
|
|
368
|
-
*
|
|
369
|
-
* @beta
|
|
368
|
+
* @public
|
|
370
369
|
*/
|
|
371
370
|
declare function urlToRelativePath(url: string, base: string): string;
|
|
372
371
|
//#endregion
|
|
@@ -376,8 +375,7 @@ declare function urlToRelativePath(url: string, base: string): string;
|
|
|
376
375
|
*
|
|
377
376
|
* @returns A random v4 UUID
|
|
378
377
|
*
|
|
379
|
-
*
|
|
380
|
-
* @beta
|
|
378
|
+
* @public
|
|
381
379
|
*/
|
|
382
380
|
declare function uuid(): string;
|
|
383
381
|
//#endregion
|
|
@@ -388,8 +386,7 @@ declare function uuid(): string;
|
|
|
388
386
|
* @param uuid - The UUID string to convert.
|
|
389
387
|
* @returns The ArrayBuffer representation.
|
|
390
388
|
*
|
|
391
|
-
*
|
|
392
|
-
* @beta
|
|
389
|
+
* @public
|
|
393
390
|
*
|
|
394
391
|
* @example
|
|
395
392
|
* {@includeCode ../test/uuidToArrayBuffer.test.ts#example}
|
|
@@ -400,10 +397,9 @@ declare function uuidToArrayBuffer(uuid: string): ArrayBuffer;
|
|
|
400
397
|
/**
|
|
401
398
|
* A type that represents either a single value or an array of values.
|
|
402
399
|
*
|
|
403
|
-
*
|
|
404
|
-
* @beta
|
|
400
|
+
* @public
|
|
405
401
|
*/
|
|
406
402
|
type ValueOrArray<T> = T | T[];
|
|
407
403
|
//#endregion
|
|
408
|
-
export { DecodeTextOptions, Encoding, Request, RequestType, ResourceTiming, TypedResult, UTF_16, UTF_16_BE, UTF_16_LE, UTF_8, ValueOf, ValueOrArray, arrayBufferToHex, arrayBufferToUuid, base64decode, base64encode, convertUint8ToUint16, decodeBase64, decodeText, encodeBase64, getBandwidthBps, hexToArrayBuffer, roundToEven, stringToUint16, unescapeHtml, urlToRelativePath, uuid, uuidToArrayBuffer };
|
|
404
|
+
export { DecodeTextOptions, Encoding, ExclusiveRecord, Request, RequestType, ResourceTiming, TypedResult, UTF_16, UTF_16_BE, UTF_16_LE, UTF_8, ValueOf, ValueOrArray, arrayBufferToHex, arrayBufferToUuid, base64decode, base64encode, convertUint8ToUint16, decodeBase64, decodeText, encodeBase64, encodeText, getBandwidthBps, hexToArrayBuffer, roundToEven, stringToUint16, unescapeHtml, urlToRelativePath, uuid, uuidToArrayBuffer };
|
|
409
405
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["base64decode: typeof decodeBase64","base64encode: typeof encodeBase64"],"sources":["../src/arrayBufferToHex.ts","../src/arrayBufferToUuid.ts","../src/decodeBase64.ts","../src/base64decode.ts","../src/encodeBase64.ts","../src/base64encode.ts","../src/convertUint8ToUint16.ts","../src/UTF_16.ts","../src/UTF_16_BE.ts","../src/UTF_16_LE.ts","../src/UTF_8.ts","../src/ValueOf.ts","../src/Encoding.ts","../src/DecodeTextOptions.ts","../src/decodeText.ts","../src/ResourceTiming.ts","../src/getBandwidthBps.ts","../src/hexToArrayBuffer.ts","../src/RequestType.ts","../src/Request.ts","../src/roundToEven.ts","../src/stringToUint16.ts","../src/TypedResult.ts","../src/unescapeHtml.ts","../src/urlToRelativePath.ts","../src/uuid.ts","../src/uuidToArrayBuffer.ts","../src/ValueOrArray.ts"],"sourcesContent":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["base64decode: typeof decodeBase64","base64encode: typeof encodeBase64"],"sources":["../src/arrayBufferToHex.ts","../src/arrayBufferToUuid.ts","../src/decodeBase64.ts","../src/base64decode.ts","../src/encodeBase64.ts","../src/base64encode.ts","../src/convertUint8ToUint16.ts","../src/UTF_16.ts","../src/UTF_16_BE.ts","../src/UTF_16_LE.ts","../src/UTF_8.ts","../src/ValueOf.ts","../src/Encoding.ts","../src/DecodeTextOptions.ts","../src/decodeText.ts","../src/encodeText.ts","../src/ExclusiveRecord.ts","../src/ResourceTiming.ts","../src/getBandwidthBps.ts","../src/hexToArrayBuffer.ts","../src/RequestType.ts","../src/Request.ts","../src/roundToEven.ts","../src/stringToUint16.ts","../src/TypedResult.ts","../src/unescapeHtml.ts","../src/urlToRelativePath.ts","../src/uuid.ts","../src/uuidToArrayBuffer.ts","../src/ValueOrArray.ts"],"sourcesContent":[],"mappings":";;AAWA;;;;ACEA;;;;ACLA;;iBFGgB,gBAAA,SAAyB;;;;AAAzC;;;;ACEA;;;;ACL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;;ACEA;;;;ACLA;;iBiBGgB,gBAAA,eAA+B;;;AnBA/C;;;;ACEA;;;;ACLgB,ckBEH,WlBF8B,EAAA;;;;ECM3C,SAAaD,YAAqB,EAAA,aAAA;;;;ACNlC;;KgBaY,WAAA,GAAc,eAAe;;;ApBVzC;;;;ACEA;KoBNY;;;AnBCZ;;;;ACMA;;;;ACNA;SiBcQ;;;AhBRR;iBgBagB;;;AfnBhB;YewBW;;;Ad3BX;gBcgCe;;;AbhCf;SaqCQ;;;AZrCR;;;;ACAA;;eWgDc;;;;;ArB1Cd;;;;ACEA;;;;ACLA;iBoBEgB,WAAA;;;;AtBChB;;;;ACEA;;;;ACLA;;iBqBGgB,cAAA,eAA6B,YAAY;;;;AvBAzD;;;;ACEgB,KuBRJ,WvBQI;ECLhB,IAAgB,EsBFT,CtBES;QsBDT;;;;;AxBIP;;;;ACEA;;;;ACLA;;iBuBKgB,YAAA;;;;AzBFhB;;;;ACEA;;;;ACLgB,iBwBCA,iBAAA,CxBD2B,GAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;AFG3C;;;;ACEA;;iB0BNgB,IAAA,CAAA;;;;A3BIhB;;;;ACEA;;;;ACLA;;iB0BKgB,iBAAA,gBAAiC;;;;A5BFjD;;;;ACEgB,K4BRJ,Y5BQI,CAAA,CAAA,CAAA,G4BRc,C5BQd,G4BRkB,C5BQQ,EAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* @param buffer - The ArrayBuffer to encode.
|
|
6
6
|
* @returns The hexadecimal string representation.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* @beta
|
|
8
|
+
* @public
|
|
10
9
|
*
|
|
11
10
|
* @example
|
|
12
11
|
* {@includeCode ../test/arrayBufferToHex.test.ts#example}
|
|
@@ -23,8 +22,7 @@ function arrayBufferToHex(buffer) {
|
|
|
23
22
|
* @param buffer - The ArrayBuffer to convert.
|
|
24
23
|
* @returns The UUID string representation.
|
|
25
24
|
*
|
|
26
|
-
*
|
|
27
|
-
* @beta
|
|
25
|
+
* @public
|
|
28
26
|
*
|
|
29
27
|
* @example
|
|
30
28
|
* {@includeCode ../test/arrayBufferToUuid.test.ts#example}
|
|
@@ -41,8 +39,7 @@ function arrayBufferToUuid(buffer) {
|
|
|
41
39
|
* @param str - The base64 encoded string to decode
|
|
42
40
|
* @returns The decoded binary data
|
|
43
41
|
*
|
|
44
|
-
*
|
|
45
|
-
* @beta
|
|
42
|
+
* @public
|
|
46
43
|
*/
|
|
47
44
|
function decodeBase64(str) {
|
|
48
45
|
return new Uint8Array([...atob(str)].map((a) => a.charCodeAt(0)));
|
|
@@ -56,8 +53,7 @@ function decodeBase64(str) {
|
|
|
56
53
|
* @param str - The base64 encoded string to decode
|
|
57
54
|
* @returns The decoded binary data
|
|
58
55
|
*
|
|
59
|
-
*
|
|
60
|
-
* @beta
|
|
56
|
+
* @public
|
|
61
57
|
*
|
|
62
58
|
* @deprecated Use {@link decodeBase64} instead.
|
|
63
59
|
*
|
|
@@ -73,8 +69,7 @@ const base64decode = decodeBase64;
|
|
|
73
69
|
* @param binary - The binary data to encode
|
|
74
70
|
* @returns The base64 encoded string
|
|
75
71
|
*
|
|
76
|
-
*
|
|
77
|
-
* @beta
|
|
72
|
+
* @public
|
|
78
73
|
*/
|
|
79
74
|
function encodeBase64(binary) {
|
|
80
75
|
return btoa(String.fromCharCode(...binary));
|
|
@@ -88,8 +83,7 @@ function encodeBase64(binary) {
|
|
|
88
83
|
* @param binary - The binary data to encode
|
|
89
84
|
* @returns The base64 encoded string
|
|
90
85
|
*
|
|
91
|
-
*
|
|
92
|
-
* @beta
|
|
86
|
+
* @public
|
|
93
87
|
*
|
|
94
88
|
* @deprecated Use {@link encodeBase64} instead.
|
|
95
89
|
*
|
|
@@ -105,7 +99,7 @@ const base64encode = encodeBase64;
|
|
|
105
99
|
* @param input - The Uint8Array to convert
|
|
106
100
|
* @returns A properly aligned Uint16Array
|
|
107
101
|
*
|
|
108
|
-
* @
|
|
102
|
+
* @public
|
|
109
103
|
*/
|
|
110
104
|
function convertUint8ToUint16(input) {
|
|
111
105
|
if (input.length % 2 !== 0) {
|
|
@@ -121,8 +115,7 @@ function convertUint8ToUint16(input) {
|
|
|
121
115
|
/**
|
|
122
116
|
* UTF-16 Encoding.
|
|
123
117
|
*
|
|
124
|
-
*
|
|
125
|
-
* @beta
|
|
118
|
+
* @public
|
|
126
119
|
*/
|
|
127
120
|
const UTF_16 = "utf-16";
|
|
128
121
|
|
|
@@ -131,8 +124,7 @@ const UTF_16 = "utf-16";
|
|
|
131
124
|
/**
|
|
132
125
|
* UTF-16 Big Endian Encoding.
|
|
133
126
|
*
|
|
134
|
-
*
|
|
135
|
-
* @beta
|
|
127
|
+
* @public
|
|
136
128
|
*/
|
|
137
129
|
const UTF_16_BE = "utf-16be";
|
|
138
130
|
|
|
@@ -141,8 +133,7 @@ const UTF_16_BE = "utf-16be";
|
|
|
141
133
|
/**
|
|
142
134
|
* UTF-16 Little Endian Encoding.
|
|
143
135
|
*
|
|
144
|
-
*
|
|
145
|
-
* @beta
|
|
136
|
+
* @public
|
|
146
137
|
*/
|
|
147
138
|
const UTF_16_LE = "utf-16le";
|
|
148
139
|
|
|
@@ -151,8 +142,7 @@ const UTF_16_LE = "utf-16le";
|
|
|
151
142
|
/**
|
|
152
143
|
* UTF-8 Encoding.
|
|
153
144
|
*
|
|
154
|
-
*
|
|
155
|
-
* @beta
|
|
145
|
+
* @public
|
|
156
146
|
*/
|
|
157
147
|
const UTF_8 = "utf-8";
|
|
158
148
|
|
|
@@ -166,8 +156,7 @@ const UTF_8 = "utf-8";
|
|
|
166
156
|
* @param options - The options for the decoding.
|
|
167
157
|
* @returns The string representation of the ArrayBuffer.
|
|
168
158
|
*
|
|
169
|
-
*
|
|
170
|
-
* @beta
|
|
159
|
+
* @public
|
|
171
160
|
*
|
|
172
161
|
* @example
|
|
173
162
|
* {@includeCode ../test/decodeText.test.ts#example}
|
|
@@ -240,13 +229,30 @@ function decodeText(data, options = {}) {
|
|
|
240
229
|
return str;
|
|
241
230
|
}
|
|
242
231
|
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/encodeText.ts
|
|
234
|
+
/**
|
|
235
|
+
* Converts a string to a Uint8Array. Similar to `TextEncoder.encode`
|
|
236
|
+
* but with a fallback for environments that don't support `TextEncoder`.
|
|
237
|
+
*
|
|
238
|
+
* @param data - The string to encode.
|
|
239
|
+
* @returns The Uint8Array representation of the string.
|
|
240
|
+
*
|
|
241
|
+
* @public
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* {@includeCode ../test/encodeText.test.ts#example}
|
|
245
|
+
*/
|
|
246
|
+
function encodeText(data) {
|
|
247
|
+
return new TextEncoder().encode(data);
|
|
248
|
+
}
|
|
249
|
+
|
|
243
250
|
//#endregion
|
|
244
251
|
//#region src/Encoding.ts
|
|
245
252
|
/**
|
|
246
253
|
* Text encoding types.
|
|
247
254
|
*
|
|
248
|
-
*
|
|
249
|
-
* @beta
|
|
255
|
+
* @public
|
|
250
256
|
*/
|
|
251
257
|
const Encoding = {
|
|
252
258
|
UTF8: UTF_8,
|
|
@@ -263,8 +269,7 @@ const Encoding = {
|
|
|
263
269
|
* @param sample - A ResourceTiming sample
|
|
264
270
|
* @returns
|
|
265
271
|
*
|
|
266
|
-
*
|
|
267
|
-
* @beta
|
|
272
|
+
* @public
|
|
268
273
|
*/
|
|
269
274
|
function getBandwidthBps(sample) {
|
|
270
275
|
const durationSeconds = sample.duration / 1e3;
|
|
@@ -279,8 +284,7 @@ function getBandwidthBps(sample) {
|
|
|
279
284
|
* @param hex - The hexadecimal string to decode.
|
|
280
285
|
* @returns The decoded ArrayBuffer.
|
|
281
286
|
*
|
|
282
|
-
*
|
|
283
|
-
* @beta
|
|
287
|
+
* @public
|
|
284
288
|
*
|
|
285
289
|
* @example
|
|
286
290
|
* {@includeCode ../test/hexToArrayBuffer.test.ts#example}
|
|
@@ -300,7 +304,7 @@ function hexToArrayBuffer(hex) {
|
|
|
300
304
|
*
|
|
301
305
|
* @enum
|
|
302
306
|
*
|
|
303
|
-
* @
|
|
307
|
+
* @public
|
|
304
308
|
*/
|
|
305
309
|
const RequestType = {
|
|
306
310
|
TEXT: "text",
|
|
@@ -320,8 +324,7 @@ const RequestType = {
|
|
|
320
324
|
* @param precision - The number of decimal places to round to
|
|
321
325
|
* @returns The rounded value
|
|
322
326
|
*
|
|
323
|
-
*
|
|
324
|
-
* @beta
|
|
327
|
+
* @public
|
|
325
328
|
*/
|
|
326
329
|
function roundToEven(value, precision) {
|
|
327
330
|
if (value < 0) return -roundToEven(-value, precision);
|
|
@@ -340,8 +343,7 @@ function roundToEven(value, precision) {
|
|
|
340
343
|
* @param str - The string to convert
|
|
341
344
|
* @returns A Uint16Array representation of the string
|
|
342
345
|
*
|
|
343
|
-
*
|
|
344
|
-
* @beta
|
|
346
|
+
* @public
|
|
345
347
|
*
|
|
346
348
|
* @example
|
|
347
349
|
* {@includeCode ../test/stringToUint16.test.ts#example}
|
|
@@ -362,8 +364,7 @@ const escapedHtml = /&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g
|
|
|
362
364
|
* @param text - The text to unescape
|
|
363
365
|
* @returns The unescaped text
|
|
364
366
|
*
|
|
365
|
-
*
|
|
366
|
-
* @beta
|
|
367
|
+
* @public
|
|
367
368
|
*
|
|
368
369
|
* @example
|
|
369
370
|
* {@includeCode ../test/unescapeHtml.test.ts#example}
|
|
@@ -399,8 +400,7 @@ function unescapeHtml(text) {
|
|
|
399
400
|
* @param base - The base URL
|
|
400
401
|
* @returns The relative path
|
|
401
402
|
*
|
|
402
|
-
*
|
|
403
|
-
* @beta
|
|
403
|
+
* @public
|
|
404
404
|
*/
|
|
405
405
|
function urlToRelativePath(url, base) {
|
|
406
406
|
const to = new URL(url);
|
|
@@ -428,8 +428,7 @@ function urlToRelativePath(url, base) {
|
|
|
428
428
|
*
|
|
429
429
|
* @returns A random v4 UUID
|
|
430
430
|
*
|
|
431
|
-
*
|
|
432
|
-
* @beta
|
|
431
|
+
* @public
|
|
433
432
|
*/
|
|
434
433
|
function uuid() {
|
|
435
434
|
try {
|
|
@@ -459,8 +458,7 @@ function uuid() {
|
|
|
459
458
|
* @param uuid - The UUID string to convert.
|
|
460
459
|
* @returns The ArrayBuffer representation.
|
|
461
460
|
*
|
|
462
|
-
*
|
|
463
|
-
* @beta
|
|
461
|
+
* @public
|
|
464
462
|
*
|
|
465
463
|
* @example
|
|
466
464
|
* {@includeCode ../test/uuidToArrayBuffer.test.ts#example}
|
|
@@ -470,5 +468,5 @@ function uuidToArrayBuffer(uuid$1) {
|
|
|
470
468
|
}
|
|
471
469
|
|
|
472
470
|
//#endregion
|
|
473
|
-
export { Encoding, RequestType, UTF_16, UTF_16_BE, UTF_16_LE, UTF_8, arrayBufferToHex, arrayBufferToUuid, base64decode, base64encode, convertUint8ToUint16, decodeBase64, decodeText, encodeBase64, getBandwidthBps, hexToArrayBuffer, roundToEven, stringToUint16, unescapeHtml, urlToRelativePath, uuid, uuidToArrayBuffer };
|
|
471
|
+
export { Encoding, RequestType, UTF_16, UTF_16_BE, UTF_16_LE, UTF_8, arrayBufferToHex, arrayBufferToUuid, base64decode, base64encode, convertUint8ToUint16, decodeBase64, decodeText, encodeBase64, encodeText, getBandwidthBps, hexToArrayBuffer, roundToEven, stringToUint16, unescapeHtml, urlToRelativePath, uuid, uuidToArrayBuffer };
|
|
474
472
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["base64decode: typeof decodeBase64","base64encode: typeof encodeBase64","view: DataView<ArrayBuffer>","char!: number","uuid","error","uuid"],"sources":["../src/arrayBufferToHex.ts","../src/arrayBufferToUuid.ts","../src/decodeBase64.ts","../src/base64decode.ts","../src/encodeBase64.ts","../src/base64encode.ts","../src/convertUint8ToUint16.ts","../src/UTF_16.ts","../src/UTF_16_BE.ts","../src/UTF_16_LE.ts","../src/UTF_8.ts","../src/decodeText.ts","../src/Encoding.ts","../src/getBandwidthBps.ts","../src/hexToArrayBuffer.ts","../src/RequestType.ts","../src/roundToEven.ts","../src/stringToUint16.ts","../src/unescapeHtml.ts","../src/urlToRelativePath.ts","../src/uuid.ts","../src/uuidToArrayBuffer.ts"],"sourcesContent":["/**\n * Encodes an ArrayBuffer as a hexadecimal string.\n *\n * @param buffer - The ArrayBuffer to encode.\n * @returns The hexadecimal string representation.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/arrayBufferToHex.test.ts#example}\n */\nexport function arrayBufferToHex(buffer: ArrayBuffer): string {\n\tconst view = new Uint8Array(buffer)\n\treturn view.reduce((result, byte) => result + byte.toString(16).padStart(2, '0'), '')\n}\n","import { arrayBufferToHex } from './arrayBufferToHex.ts'\n\n/**\n * Converts an ArrayBuffer to a UUID string.\n *\n * @param buffer - The ArrayBuffer to convert.\n * @returns The UUID string representation.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/arrayBufferToUuid.test.ts#example}\n */\nexport function arrayBufferToUuid(buffer: ArrayBuffer): string {\n\tconst hex = arrayBufferToHex(buffer)\n\treturn hex.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5')\n}\n","/**\n * Decodes a base64 encoded string into binary data\n *\n * @param str - The base64 encoded string to decode\n * @returns The decoded binary data\n *\n *\n * @beta\n */\nexport function decodeBase64(str: string): Uint8Array {\n\treturn new Uint8Array([...atob(str)].map((a) => a.charCodeAt(0)))\n}\n","import { decodeBase64 } from './decodeBase64.ts'\n\n/**\n * Decodes a base64 encoded string into binary data\n *\n * @param str - The base64 encoded string to decode\n * @returns The decoded binary data\n *\n *\n * @beta\n *\n * @deprecated Use {@link decodeBase64} instead.\n *\n * @see {@link decodeBase64}\n */\nexport const base64decode: typeof decodeBase64 = decodeBase64\n","/**\n * Encodes binary data to base64\n *\n * @param binary - The binary data to encode\n * @returns The base64 encoded string\n *\n *\n * @beta\n */\nexport function encodeBase64(binary: Uint8Array): string {\n\treturn btoa(String.fromCharCode(...binary))\n}\n","import { encodeBase64 } from './encodeBase64.ts'\n\n/**\n * Encodes binary data to base64\n *\n * @param binary - The binary data to encode\n * @returns The base64 encoded string\n *\n *\n * @beta\n *\n * @deprecated Use {@link encodeBase64} instead.\n *\n * @see {@link encodeBase64}\n */\nexport const base64encode: typeof encodeBase64 = encodeBase64\n","/**\n * Converts a Uint8Array to a Uint16Array by aligning its buffer.\n *\n * @param input - The Uint8Array to convert\n * @returns A properly aligned Uint16Array\n *\n * @beta\n */\nexport function convertUint8ToUint16(input: Uint8Array): Uint16Array {\n\tif (input.length % 2 !== 0) {\n\t\tconst padded = new Uint8Array(input.length + 1)\n\t\tpadded.set(input)\n\t\treturn new Uint16Array(padded.buffer)\n\t}\n\treturn new Uint16Array(input.buffer)\n}\n","/**\n * UTF-16 Encoding.\n *\n *\n * @beta\n */\nexport const UTF_16 = 'utf-16'\n","/**\n * UTF-16 Big Endian Encoding.\n *\n *\n * @beta\n */\nexport const UTF_16_BE = 'utf-16be'\n","/**\n * UTF-16 Little Endian Encoding.\n *\n *\n * @beta\n */\nexport const UTF_16_LE = 'utf-16le'\n","/**\n * UTF-8 Encoding.\n *\n *\n * @beta\n */\nexport const UTF_8 = 'utf-8'\n","import type { DecodeTextOptions } from './DecodeTextOptions.ts'\nimport { UTF_16 } from './UTF_16.ts'\nimport { UTF_16_BE } from './UTF_16_BE.ts'\nimport { UTF_16_LE } from './UTF_16_LE.ts'\nimport { UTF_8 } from './UTF_8.ts'\n\n/**\n * Converts an ArrayBuffer or ArrayBufferView to a string. Similar to `TextDecoder.decode`\n * but with a fallback for environments that don't support `TextDecoder`.\n *\n * @param data - The data to decode.\n * @param options - The options for the decoding.\n * @returns The string representation of the ArrayBuffer.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/decodeText.test.ts#example}\n */\nexport function decodeText(data: ArrayBuffer | ArrayBufferView<ArrayBuffer>, options: DecodeTextOptions = {}): string {\n\tlet view: DataView<ArrayBuffer>\n\n\tif (data instanceof ArrayBuffer) {\n\t\tview = new DataView(data)\n\t}\n\telse {\n\t\tview = new DataView(data.buffer, data.byteOffset, data.byteLength)\n\t}\n\n\tlet byteOffset = 0\n\tlet { encoding } = options\n\n\t// If no encoding is provided, try to detect it from the BOM\n\tif (!encoding) {\n\t\tconst first = view.getUint8(0)\n\t\tconst second = view.getUint8(1)\n\n\t\t// UTF-8 BOM\n\t\tif (first == 0xef && second == 0xbb && view.getUint8(2) == 0xbf) {\n\t\t\tencoding = UTF_8\n\t\t\tbyteOffset = 3\n\t\t}\n\t\t// UTF-16 BE BOM\n\t\telse if (first == 0xfe && second == 0xff) {\n\t\t\tencoding = UTF_16_BE\n\t\t\tbyteOffset = 2\n\t\t}\n\t\t// UTF-16 LE BOM\n\t\telse if (first == 0xff && second == 0xfe) {\n\t\t\tencoding = UTF_16_LE\n\t\t\tbyteOffset = 2\n\t\t}\n\t\telse {\n\t\t\tencoding = UTF_8\n\t\t}\n\t}\n\n\tif (typeof TextDecoder !== 'undefined') {\n\t\treturn new TextDecoder(encoding).decode(view)\n\t}\n\n\tconst { byteLength } = view\n\tconst endian = encoding !== UTF_16_BE\n\tlet str = ''\n\tlet char!: number\n\n\twhile (byteOffset < byteLength) {\n\t\tswitch (encoding) {\n\t\t\tcase UTF_8:\n\t\t\t\tchar = view.getUint8(byteOffset)\n\n\t\t\t\t// Single byte (ASCII)\n\t\t\t\tif (char < 128) {\n\t\t\t\t\tbyteOffset++\n\t\t\t\t}\n\t\t\t\t// 2-byte sequence\n\t\t\t\telse if (char >= 194 && char <= 223) {\n\t\t\t\t\tif (byteOffset + 1 < byteLength) {\n\t\t\t\t\t\tconst byte2 = view.getUint8(byteOffset + 1)\n\t\t\t\t\t\tif (byte2 >= 128 && byte2 <= 191) {\n\t\t\t\t\t\t\tchar = ((char & 0x1F) << 6) | (byte2 & 0x3F)\n\t\t\t\t\t\t\tbyteOffset += 2\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Invalid sequence, skip\n\t\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Incomplete sequence, skip\n\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 3-byte sequence\n\t\t\t\telse if (char >= 224 && char <= 239) {\n\t\t\t\t\tif (byteOffset + 2 <= byteLength - 1) {\n\t\t\t\t\t\tconst byte2 = view.getUint8(byteOffset + 1)\n\t\t\t\t\t\tconst byte3 = view.getUint8(byteOffset + 2)\n\t\t\t\t\t\tif (byte2 >= 128 && byte2 <= 191 && byte3 >= 128 && byte3 <= 191) {\n\t\t\t\t\t\t\tchar = ((char & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F)\n\t\t\t\t\t\t\tbyteOffset += 3\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Invalid sequence, skip\n\t\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Incomplete sequence, skip\n\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 4-byte sequence\n\t\t\t\telse if (char >= 240 && char <= 244) {\n\t\t\t\t\tif (byteOffset + 3 <= byteLength - 1) {\n\t\t\t\t\t\tconst byte2 = view.getUint8(byteOffset + 1)\n\t\t\t\t\t\tconst byte3 = view.getUint8(byteOffset + 2)\n\t\t\t\t\t\tconst byte4 = view.getUint8(byteOffset + 3)\n\t\t\t\t\t\tif (byte2 >= 128 && byte2 <= 191 && byte3 >= 128 && byte3 <= 191 && byte4 >= 128 && byte4 <= 191) {\n\t\t\t\t\t\t\tchar = ((char & 0x07) << 18) | ((byte2 & 0x3F) << 12) | ((byte3 & 0x3F) << 6) | (byte4 & 0x3F)\n\t\t\t\t\t\t\tbyteOffset += 4\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Invalid sequence, skip\n\t\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Incomplete sequence, skip\n\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid byte, skip\n\t\t\t\telse {\n\t\t\t\t\tbyteOffset++\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase UTF_16_BE:\n\t\t\tcase UTF_16:\n\t\t\tcase UTF_16_LE:\n\t\t\t\tchar = view.getUint16(byteOffset, endian)\n\t\t\t\tbyteOffset += 2\n\t\t\t\tbreak\n\t\t}\n\n\t\tstr += String.fromCodePoint(char)\n\t}\n\n\treturn str\n}\n","import { UTF_16 } from './UTF_16.ts'\nimport { UTF_16_BE } from './UTF_16_BE.ts'\nimport { UTF_16_LE } from './UTF_16_LE.ts'\nimport { UTF_8 } from './UTF_8.ts'\nimport type { ValueOf } from './ValueOf.ts'\n\n/**\n * Text encoding types.\n *\n *\n * @beta\n */\nexport const Encoding = {\n\tUTF8: UTF_8 as typeof UTF_8,\n\tUTF16: UTF_16 as typeof UTF_16,\n\tUTF16BE: UTF_16_BE as typeof UTF_16_BE,\n\tUTF16LE: UTF_16_LE as typeof UTF_16_LE,\n} as const\n\n/**\n * Text encoding types.\n *\n *\n * @beta\n */\nexport type Encoding = ValueOf<typeof Encoding>;\n","import type { ResourceTiming } from './ResourceTiming.ts'\n\n/**\n * Converts a ResourceTiming sample to bandwidth in bits per second (bps).\n *\n * @param sample - A ResourceTiming sample\n * @returns\n *\n *\n * @beta\n */\nexport function getBandwidthBps(sample: ResourceTiming): number {\n\tconst durationSeconds = sample.duration / 1000\n\tconst bandwidthBps = sample.encodedBodySize * 8 / durationSeconds\n\treturn bandwidthBps\n}\n","/**\n * Decodes a hexadecimal string into an ArrayBuffer.\n *\n * @param hex - The hexadecimal string to decode.\n * @returns The decoded ArrayBuffer.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/hexToArrayBuffer.test.ts#example}\n */\nexport function hexToArrayBuffer(hex: string): ArrayBuffer {\n\tconst buffer = new ArrayBuffer(hex.length / 2)\n\tconst view = new Uint8Array(buffer)\n\tfor (let i = 0; i < hex.length; i += 2) {\n\t\tview[i / 2] = parseInt(hex.slice(i, i + 2), 16)\n\t}\n\treturn buffer\n}\n","import type { ValueOf } from './ValueOf.ts'\n\n/**\n * The content type of the request.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const RequestType = {\n\tTEXT: 'text' as const,\n\tJSON: 'json' as const,\n\tBLOB: 'blob' as const,\n\tARRAY_BUFFER: 'arrayBuffer' as const,\n\tDOCUMENT: 'document' as const,\n} as const\n\n/**\n * @beta\n */\nexport type RequestType = ValueOf<typeof RequestType>;\n","/**\n * This implements the rounding procedure described in step 2 of the \"Serializing a Decimal\" specification.\n * This rounding style is known as \"even rounding\", \"banker's rounding\", or \"commercial rounding\".\n *\n * @param value - The value to round\n * @param precision - The number of decimal places to round to\n * @returns The rounded value\n *\n *\n * @beta\n */\nexport function roundToEven(value: number, precision: number): number {\n\tif (value < 0) {\n\t\treturn -roundToEven(-value, precision)\n\t}\n\n\tconst decimalShift = Math.pow(10, precision)\n\tconst isEquidistant = Math.abs(((value * decimalShift) % 1) - 0.5) < Number.EPSILON\n\n\tif (isEquidistant) {\n\t\t// If the tail of the decimal place is 'equidistant' we round to the nearest even value\n\t\tconst flooredValue = Math.floor(value * decimalShift)\n\t\treturn (flooredValue % 2 === 0 ? flooredValue : flooredValue + 1) / decimalShift\n\t}\n\telse {\n\t\t// Otherwise, proceed as normal\n\t\treturn Math.round(value * decimalShift) / decimalShift\n\t}\n}\n","/**\n * Converts a string to a Uint16Array.\n *\n * @param str - The string to convert\n * @returns A Uint16Array representation of the string\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/stringToUint16.test.ts#example}\n */\nexport function stringToUint16(str: string): Uint16Array<ArrayBuffer> {\n\tconst buffer = new ArrayBuffer(str.length * 2)\n\tconst view = new DataView(buffer)\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tview.setUint16(i * 2, str.charCodeAt(i), true) // true for little-endian\n\t}\n\n\treturn new Uint16Array(buffer)\n}\n","const escapedHtml = /&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g\n\n/**\n * Unescapes HTML entities\n *\n * @param text - The text to unescape\n * @returns The unescaped text\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/unescapeHtml.test.ts#example}\n */\nexport function unescapeHtml(text: string): string {\n\tif (text.indexOf('&') === -1) {\n\t\treturn text\n\t}\n\n\treturn text.replace(escapedHtml, (match) => {\n\t\tswitch (match) {\n\t\t\tcase '&': return '&'\n\t\t\tcase '<': return '<'\n\t\t\tcase '>': return '>'\n\t\t\tcase '"': return '\"'\n\t\t\tcase ''': return '\\''\n\t\t\tcase ' ': return '\\u{a0}'\n\t\t\tcase '‎': return '\\u{200e}'\n\t\t\tcase '‏': return '\\u{200f}'\n\t\t\tdefault: {\n\t\t\t\tif (match[1] === '#') {\n\t\t\t\t\tconst code = match[2] === 'x' || match[2] === 'X' ? parseInt(match.slice(3), 16) : parseInt(match.slice(2), 10)\n\t\t\t\t\treturn String.fromCodePoint(code)\n\t\t\t\t}\n\t\t\t\treturn match\n\t\t\t}\n\t\t}\n\t})\n}\n","/**\n * Constructs a relative path from a URL.\n *\n * @param url - The destination URL\n * @param base - The base URL\n * @returns The relative path\n *\n *\n * @beta\n */\nexport function urlToRelativePath(url: string, base: string): string {\n\tconst to = new URL(url)\n\tconst from = new URL(base)\n\n\tif (to.origin !== from.origin) {\n\t\treturn url\n\t}\n\n\tconst toPath = to.pathname.split('/').slice(1)\n\tconst fromPath = from.pathname.split('/').slice(1, -1)\n\n\t// remove common parents\n\tconst length = Math.min(toPath.length, fromPath.length)\n\n\tfor (let i = 0; i < length; i++) {\n\t\tif (toPath[i] !== fromPath[i]) {\n\t\t\tbreak\n\t\t}\n\n\t\ttoPath.shift()\n\t\tfromPath.shift()\n\t}\n\n\t// add back paths\n\twhile (fromPath.length) {\n\t\tfromPath.shift()\n\t\ttoPath.unshift('..')\n\t}\n\n\tconst relativePath = toPath.join('/')\n\n\t// preserve query parameters and hash of the destination url\n\treturn relativePath + to.search + to.hash\n}\n","/**\n * Generate a random v4 UUID\n *\n * @returns A random v4 UUID\n *\n *\n * @beta\n */\nexport function uuid(): string {\n\ttry {\n\t\treturn crypto.randomUUID()\n\t}\n\tcatch (error) {\n\t\ttry {\n\t\t\tconst url = URL.createObjectURL(new Blob())\n\t\t\tconst uuid = url.toString()\n\t\t\tURL.revokeObjectURL(url)\n\t\t\treturn uuid.slice(uuid.lastIndexOf('/') + 1)\n\t\t}\n\t\tcatch (error) {\n\t\t\tlet dt = new Date().getTime()\n\t\t\tconst uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n\t\t\t\tconst r = (dt + Math.random() * 16) % 16 | 0\n\t\t\t\tdt = Math.floor(dt / 16)\n\t\t\t\treturn (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16)\n\t\t\t})\n\t\t\treturn uuid\n\t\t}\n\t}\n}\n","import { hexToArrayBuffer } from './hexToArrayBuffer.ts'\n\n/**\n * Converts a UUID string to an ArrayBuffer.\n *\n * @param uuid - The UUID string to convert.\n * @returns The ArrayBuffer representation.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/uuidToArrayBuffer.test.ts#example}\n */\nexport function uuidToArrayBuffer(uuid: string): ArrayBuffer {\n\tconst hex = uuid.replace(/-/g, '')\n\treturn hexToArrayBuffer(hex)\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,iBAAiB,QAA6B;AAE7D,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MAAI,OAAO,OAAO,SAAS,GAC1B;AAGD,SAAO,OAAO;AACd,WAAS,OAAO;;AAIjB,QAAO,SAAS,QAAQ;AACvB,WAAS,OAAO;AAChB,SAAO,QAAQ,KAAK;;AAMrB,QAHqB,OAAO,KAAK,IAAI,GAGf,GAAG,SAAS,GAAG;;;;;;;;;;;;;AClCtC,SAAgB,OAAe;AAC9B,KAAI;AACH,SAAO,OAAO,YAAY;UAEpB,OAAO;AACb,MAAI;GACH,MAAM,MAAM,IAAI,gBAAgB,IAAI,MAAM,CAAC;GAC3C,MAAMC,SAAO,IAAI,UAAU;AAC3B,OAAI,gBAAgB,IAAI;AACxB,UAAOA,OAAK,MAAMA,OAAK,YAAY,IAAI,GAAG,EAAE;WAEtCC,SAAO;GACb,IAAI,sBAAK,IAAI,MAAM,EAAC,SAAS;AAM7B,UALa,uCAAuC,QAAQ,UAAU,MAAM;IAC3E,MAAM,KAAK,KAAK,KAAK,QAAQ,GAAG,MAAM,KAAK;AAC3C,SAAK,KAAK,MAAM,KAAK,GAAG;AACxB,YAAQ,KAAK,MAAM,IAAK,IAAI,IAAM,GAAM,SAAS,GAAG;KACnD;;;;;;;;;;;;;;;;;;;ACXL,SAAgB,kBAAkB,QAA2B;AAE5D,QAAO,iBADKC,OAAK,QAAQ,MAAM,GAAG,CACN"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["base64decode: typeof decodeBase64","base64encode: typeof encodeBase64","view: DataView<ArrayBuffer>","char!: number","uuid","error","uuid"],"sources":["../src/arrayBufferToHex.ts","../src/arrayBufferToUuid.ts","../src/decodeBase64.ts","../src/base64decode.ts","../src/encodeBase64.ts","../src/base64encode.ts","../src/convertUint8ToUint16.ts","../src/UTF_16.ts","../src/UTF_16_BE.ts","../src/UTF_16_LE.ts","../src/UTF_8.ts","../src/decodeText.ts","../src/encodeText.ts","../src/Encoding.ts","../src/getBandwidthBps.ts","../src/hexToArrayBuffer.ts","../src/RequestType.ts","../src/roundToEven.ts","../src/stringToUint16.ts","../src/unescapeHtml.ts","../src/urlToRelativePath.ts","../src/uuid.ts","../src/uuidToArrayBuffer.ts"],"sourcesContent":["/**\n * Encodes an ArrayBuffer as a hexadecimal string.\n *\n * @param buffer - The ArrayBuffer to encode.\n * @returns The hexadecimal string representation.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/arrayBufferToHex.test.ts#example}\n */\nexport function arrayBufferToHex(buffer: ArrayBuffer): string {\n\tconst view = new Uint8Array(buffer)\n\treturn view.reduce((result, byte) => result + byte.toString(16).padStart(2, '0'), '')\n}\n","import { arrayBufferToHex } from './arrayBufferToHex.ts'\n\n/**\n * Converts an ArrayBuffer to a UUID string.\n *\n * @param buffer - The ArrayBuffer to convert.\n * @returns The UUID string representation.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/arrayBufferToUuid.test.ts#example}\n */\nexport function arrayBufferToUuid(buffer: ArrayBuffer): string {\n\tconst hex = arrayBufferToHex(buffer)\n\treturn hex.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5')\n}\n","/**\n * Decodes a base64 encoded string into binary data\n *\n * @param str - The base64 encoded string to decode\n * @returns The decoded binary data\n *\n * @public\n */\nexport function decodeBase64(str: string): Uint8Array {\n\treturn new Uint8Array([...atob(str)].map((a) => a.charCodeAt(0)))\n}\n","import { decodeBase64 } from './decodeBase64.ts'\n\n/**\n * Decodes a base64 encoded string into binary data\n *\n * @param str - The base64 encoded string to decode\n * @returns The decoded binary data\n *\n * @public\n *\n * @deprecated Use {@link decodeBase64} instead.\n *\n * @see {@link decodeBase64}\n */\nexport const base64decode: typeof decodeBase64 = decodeBase64\n","/**\n * Encodes binary data to base64\n *\n * @param binary - The binary data to encode\n * @returns The base64 encoded string\n *\n * @public\n */\nexport function encodeBase64(binary: Uint8Array): string {\n\treturn btoa(String.fromCharCode(...binary))\n}\n","import { encodeBase64 } from './encodeBase64.ts'\n\n/**\n * Encodes binary data to base64\n *\n * @param binary - The binary data to encode\n * @returns The base64 encoded string\n *\n * @public\n *\n * @deprecated Use {@link encodeBase64} instead.\n *\n * @see {@link encodeBase64}\n */\nexport const base64encode: typeof encodeBase64 = encodeBase64\n","/**\n * Converts a Uint8Array to a Uint16Array by aligning its buffer.\n *\n * @param input - The Uint8Array to convert\n * @returns A properly aligned Uint16Array\n *\n * @public\n */\nexport function convertUint8ToUint16(input: Uint8Array): Uint16Array {\n\tif (input.length % 2 !== 0) {\n\t\tconst padded = new Uint8Array(input.length + 1)\n\t\tpadded.set(input)\n\t\treturn new Uint16Array(padded.buffer)\n\t}\n\treturn new Uint16Array(input.buffer)\n}\n","/**\n * UTF-16 Encoding.\n *\n * @public\n */\nexport const UTF_16 = 'utf-16'\n","/**\n * UTF-16 Big Endian Encoding.\n *\n * @public\n */\nexport const UTF_16_BE = 'utf-16be'\n","/**\n * UTF-16 Little Endian Encoding.\n *\n * @public\n */\nexport const UTF_16_LE = 'utf-16le'\n","/**\n * UTF-8 Encoding.\n *\n * @public\n */\nexport const UTF_8 = 'utf-8'\n","import type { DecodeTextOptions } from './DecodeTextOptions.ts'\nimport { UTF_16 } from './UTF_16.ts'\nimport { UTF_16_BE } from './UTF_16_BE.ts'\nimport { UTF_16_LE } from './UTF_16_LE.ts'\nimport { UTF_8 } from './UTF_8.ts'\n\n/**\n * Converts an ArrayBuffer or ArrayBufferView to a string. Similar to `TextDecoder.decode`\n * but with a fallback for environments that don't support `TextDecoder`.\n *\n * @param data - The data to decode.\n * @param options - The options for the decoding.\n * @returns The string representation of the ArrayBuffer.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/decodeText.test.ts#example}\n */\nexport function decodeText(data: ArrayBuffer | ArrayBufferView<ArrayBuffer>, options: DecodeTextOptions = {}): string {\n\tlet view: DataView<ArrayBuffer>\n\n\tif (data instanceof ArrayBuffer) {\n\t\tview = new DataView(data)\n\t}\n\telse {\n\t\tview = new DataView(data.buffer, data.byteOffset, data.byteLength)\n\t}\n\n\tlet byteOffset = 0\n\tlet { encoding } = options\n\n\t// If no encoding is provided, try to detect it from the BOM\n\tif (!encoding) {\n\t\tconst first = view.getUint8(0)\n\t\tconst second = view.getUint8(1)\n\n\t\t// UTF-8 BOM\n\t\tif (first == 0xef && second == 0xbb && view.getUint8(2) == 0xbf) {\n\t\t\tencoding = UTF_8\n\t\t\tbyteOffset = 3\n\t\t}\n\t\t// UTF-16 BE BOM\n\t\telse if (first == 0xfe && second == 0xff) {\n\t\t\tencoding = UTF_16_BE\n\t\t\tbyteOffset = 2\n\t\t}\n\t\t// UTF-16 LE BOM\n\t\telse if (first == 0xff && second == 0xfe) {\n\t\t\tencoding = UTF_16_LE\n\t\t\tbyteOffset = 2\n\t\t}\n\t\telse {\n\t\t\tencoding = UTF_8\n\t\t}\n\t}\n\n\tif (typeof TextDecoder !== 'undefined') {\n\t\treturn new TextDecoder(encoding).decode(view)\n\t}\n\n\tconst { byteLength } = view\n\tconst endian = encoding !== UTF_16_BE\n\tlet str = ''\n\tlet char!: number\n\n\twhile (byteOffset < byteLength) {\n\t\tswitch (encoding) {\n\t\t\tcase UTF_8:\n\t\t\t\tchar = view.getUint8(byteOffset)\n\n\t\t\t\t// Single byte (ASCII)\n\t\t\t\tif (char < 128) {\n\t\t\t\t\tbyteOffset++\n\t\t\t\t}\n\t\t\t\t// 2-byte sequence\n\t\t\t\telse if (char >= 194 && char <= 223) {\n\t\t\t\t\tif (byteOffset + 1 < byteLength) {\n\t\t\t\t\t\tconst byte2 = view.getUint8(byteOffset + 1)\n\t\t\t\t\t\tif (byte2 >= 128 && byte2 <= 191) {\n\t\t\t\t\t\t\tchar = ((char & 0x1F) << 6) | (byte2 & 0x3F)\n\t\t\t\t\t\t\tbyteOffset += 2\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Invalid sequence, skip\n\t\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Incomplete sequence, skip\n\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 3-byte sequence\n\t\t\t\telse if (char >= 224 && char <= 239) {\n\t\t\t\t\tif (byteOffset + 2 <= byteLength - 1) {\n\t\t\t\t\t\tconst byte2 = view.getUint8(byteOffset + 1)\n\t\t\t\t\t\tconst byte3 = view.getUint8(byteOffset + 2)\n\t\t\t\t\t\tif (byte2 >= 128 && byte2 <= 191 && byte3 >= 128 && byte3 <= 191) {\n\t\t\t\t\t\t\tchar = ((char & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F)\n\t\t\t\t\t\t\tbyteOffset += 3\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Invalid sequence, skip\n\t\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Incomplete sequence, skip\n\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 4-byte sequence\n\t\t\t\telse if (char >= 240 && char <= 244) {\n\t\t\t\t\tif (byteOffset + 3 <= byteLength - 1) {\n\t\t\t\t\t\tconst byte2 = view.getUint8(byteOffset + 1)\n\t\t\t\t\t\tconst byte3 = view.getUint8(byteOffset + 2)\n\t\t\t\t\t\tconst byte4 = view.getUint8(byteOffset + 3)\n\t\t\t\t\t\tif (byte2 >= 128 && byte2 <= 191 && byte3 >= 128 && byte3 <= 191 && byte4 >= 128 && byte4 <= 191) {\n\t\t\t\t\t\t\tchar = ((char & 0x07) << 18) | ((byte2 & 0x3F) << 12) | ((byte3 & 0x3F) << 6) | (byte4 & 0x3F)\n\t\t\t\t\t\t\tbyteOffset += 4\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Invalid sequence, skip\n\t\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Incomplete sequence, skip\n\t\t\t\t\t\tbyteOffset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid byte, skip\n\t\t\t\telse {\n\t\t\t\t\tbyteOffset++\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase UTF_16_BE:\n\t\t\tcase UTF_16:\n\t\t\tcase UTF_16_LE:\n\t\t\t\tchar = view.getUint16(byteOffset, endian)\n\t\t\t\tbyteOffset += 2\n\t\t\t\tbreak\n\t\t}\n\n\t\tstr += String.fromCodePoint(char)\n\t}\n\n\treturn str\n}\n","\n/**\n * Converts a string to a Uint8Array. Similar to `TextEncoder.encode`\n * but with a fallback for environments that don't support `TextEncoder`.\n *\n * @param data - The string to encode.\n * @returns The Uint8Array representation of the string.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/encodeText.test.ts#example}\n */\nexport function encodeText(data: string): Uint8Array {\n\treturn new TextEncoder().encode(data)\n}\n","import { UTF_16 } from './UTF_16.ts'\nimport { UTF_16_BE } from './UTF_16_BE.ts'\nimport { UTF_16_LE } from './UTF_16_LE.ts'\nimport { UTF_8 } from './UTF_8.ts'\nimport type { ValueOf } from './ValueOf.ts'\n\n/**\n * Text encoding types.\n *\n * @public\n */\nexport const Encoding = {\n\tUTF8: UTF_8 as typeof UTF_8,\n\tUTF16: UTF_16 as typeof UTF_16,\n\tUTF16BE: UTF_16_BE as typeof UTF_16_BE,\n\tUTF16LE: UTF_16_LE as typeof UTF_16_LE,\n} as const\n\n/**\n * Text encoding types.\n *\n * @public\n */\nexport type Encoding = ValueOf<typeof Encoding>;\n","import type { ResourceTiming } from './ResourceTiming.ts'\n\n/**\n * Converts a ResourceTiming sample to bandwidth in bits per second (bps).\n *\n * @param sample - A ResourceTiming sample\n * @returns\n *\n * @public\n */\nexport function getBandwidthBps(sample: ResourceTiming): number {\n\tconst durationSeconds = sample.duration / 1000\n\tconst bandwidthBps = sample.encodedBodySize * 8 / durationSeconds\n\treturn bandwidthBps\n}\n","/**\n * Decodes a hexadecimal string into an ArrayBuffer.\n *\n * @param hex - The hexadecimal string to decode.\n * @returns The decoded ArrayBuffer.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/hexToArrayBuffer.test.ts#example}\n */\nexport function hexToArrayBuffer(hex: string): ArrayBuffer {\n\tconst buffer = new ArrayBuffer(hex.length / 2)\n\tconst view = new Uint8Array(buffer)\n\tfor (let i = 0; i < hex.length; i += 2) {\n\t\tview[i / 2] = parseInt(hex.slice(i, i + 2), 16)\n\t}\n\treturn buffer\n}\n","import type { ValueOf } from './ValueOf.ts'\n\n/**\n * The content type of the request.\n *\n *\n * @enum\n *\n * @public\n */\nexport const RequestType = {\n\tTEXT: 'text' as const,\n\tJSON: 'json' as const,\n\tBLOB: 'blob' as const,\n\tARRAY_BUFFER: 'arrayBuffer' as const,\n\tDOCUMENT: 'document' as const,\n} as const\n\n/**\n * @public\n */\nexport type RequestType = ValueOf<typeof RequestType>;\n","/**\n * This implements the rounding procedure described in step 2 of the \"Serializing a Decimal\" specification.\n * This rounding style is known as \"even rounding\", \"banker's rounding\", or \"commercial rounding\".\n *\n * @param value - The value to round\n * @param precision - The number of decimal places to round to\n * @returns The rounded value\n *\n * @public\n */\nexport function roundToEven(value: number, precision: number): number {\n\tif (value < 0) {\n\t\treturn -roundToEven(-value, precision)\n\t}\n\n\tconst decimalShift = Math.pow(10, precision)\n\tconst isEquidistant = Math.abs(((value * decimalShift) % 1) - 0.5) < Number.EPSILON\n\n\tif (isEquidistant) {\n\t\t// If the tail of the decimal place is 'equidistant' we round to the nearest even value\n\t\tconst flooredValue = Math.floor(value * decimalShift)\n\t\treturn (flooredValue % 2 === 0 ? flooredValue : flooredValue + 1) / decimalShift\n\t}\n\telse {\n\t\t// Otherwise, proceed as normal\n\t\treturn Math.round(value * decimalShift) / decimalShift\n\t}\n}\n","/**\n * Converts a string to a Uint16Array.\n *\n * @param str - The string to convert\n * @returns A Uint16Array representation of the string\n *\n * @public\n *\n * @example\n * {@includeCode ../test/stringToUint16.test.ts#example}\n */\nexport function stringToUint16(str: string): Uint16Array<ArrayBuffer> {\n\tconst buffer = new ArrayBuffer(str.length * 2)\n\tconst view = new DataView(buffer)\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tview.setUint16(i * 2, str.charCodeAt(i), true) // true for little-endian\n\t}\n\n\treturn new Uint16Array(buffer)\n}\n","const escapedHtml = /&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g\n\n/**\n * Unescapes HTML entities\n *\n * @param text - The text to unescape\n * @returns The unescaped text\n *\n * @public\n *\n * @example\n * {@includeCode ../test/unescapeHtml.test.ts#example}\n */\nexport function unescapeHtml(text: string): string {\n\tif (text.indexOf('&') === -1) {\n\t\treturn text\n\t}\n\n\treturn text.replace(escapedHtml, (match) => {\n\t\tswitch (match) {\n\t\t\tcase '&': return '&'\n\t\t\tcase '<': return '<'\n\t\t\tcase '>': return '>'\n\t\t\tcase '"': return '\"'\n\t\t\tcase ''': return '\\''\n\t\t\tcase ' ': return '\\u{a0}'\n\t\t\tcase '‎': return '\\u{200e}'\n\t\t\tcase '‏': return '\\u{200f}'\n\t\t\tdefault: {\n\t\t\t\tif (match[1] === '#') {\n\t\t\t\t\tconst code = match[2] === 'x' || match[2] === 'X' ? parseInt(match.slice(3), 16) : parseInt(match.slice(2), 10)\n\t\t\t\t\treturn String.fromCodePoint(code)\n\t\t\t\t}\n\t\t\t\treturn match\n\t\t\t}\n\t\t}\n\t})\n}\n","/**\n * Constructs a relative path from a URL.\n *\n * @param url - The destination URL\n * @param base - The base URL\n * @returns The relative path\n *\n * @public\n */\nexport function urlToRelativePath(url: string, base: string): string {\n\tconst to = new URL(url)\n\tconst from = new URL(base)\n\n\tif (to.origin !== from.origin) {\n\t\treturn url\n\t}\n\n\tconst toPath = to.pathname.split('/').slice(1)\n\tconst fromPath = from.pathname.split('/').slice(1, -1)\n\n\t// remove common parents\n\tconst length = Math.min(toPath.length, fromPath.length)\n\n\tfor (let i = 0; i < length; i++) {\n\t\tif (toPath[i] !== fromPath[i]) {\n\t\t\tbreak\n\t\t}\n\n\t\ttoPath.shift()\n\t\tfromPath.shift()\n\t}\n\n\t// add back paths\n\twhile (fromPath.length) {\n\t\tfromPath.shift()\n\t\ttoPath.unshift('..')\n\t}\n\n\tconst relativePath = toPath.join('/')\n\n\t// preserve query parameters and hash of the destination url\n\treturn relativePath + to.search + to.hash\n}\n","/**\n * Generate a random v4 UUID\n *\n * @returns A random v4 UUID\n *\n * @public\n */\nexport function uuid(): string {\n\ttry {\n\t\treturn crypto.randomUUID()\n\t}\n\tcatch (error) {\n\t\ttry {\n\t\t\tconst url = URL.createObjectURL(new Blob())\n\t\t\tconst uuid = url.toString()\n\t\t\tURL.revokeObjectURL(url)\n\t\t\treturn uuid.slice(uuid.lastIndexOf('/') + 1)\n\t\t}\n\t\tcatch (error) {\n\t\t\tlet dt = new Date().getTime()\n\t\t\tconst uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n\t\t\t\tconst r = (dt + Math.random() * 16) % 16 | 0\n\t\t\t\tdt = Math.floor(dt / 16)\n\t\t\t\treturn (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16)\n\t\t\t})\n\t\t\treturn uuid\n\t\t}\n\t}\n}\n","import { hexToArrayBuffer } from './hexToArrayBuffer.ts'\n\n/**\n * Converts a UUID string to an ArrayBuffer.\n *\n * @param uuid - The UUID string to convert.\n * @returns The ArrayBuffer representation.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/uuidToArrayBuffer.test.ts#example}\n */\nexport function uuidToArrayBuffer(uuid: string): ArrayBuffer {\n\tconst hex = uuid.replace(/-/g, '')\n\treturn hexToArrayBuffer(hex)\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,iBAAiB,QAA6B;AAE7D,QADa,IAAI,WAAW,OAAO,CACvB,QAAQ,QAAQ,SAAS,SAAS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