@svta/cml-utils 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,39 +21,31 @@ import {
21
21
  } from "@svta/cml-utils";
22
22
 
23
23
  // Unescape HTML entities
24
- const unescaped = unescapeHtml(""<Hello&World>"");
25
- assert(unescaped === `"<Hello&World>"`);
24
+ console.log(unescapeHtml("&quot;&lt;Hello&amp;World&gt;&quot;"));
25
+ // "<Hello&World>"
26
26
 
27
27
  // Convert string to Uint16Array
28
- const uint16Array = stringToUint16("hello world");
29
- assert(
30
- uint16Array ===
31
- new Uint16Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])
32
- );
28
+ console.log(stringToUint16("hello world"));
29
+ // Uint16Array(11) [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
33
30
 
34
31
  // Convert hex string to ArrayBuffer
35
32
  const hex = "a0564af760c2d94b9610c7ae70d5d970";
36
33
  const arrayBuffer = hexToArrayBuffer(hex);
37
- const expected = new Uint8Array([
38
- 160, 86, 74, 247, 96, 194, 217, 75, 150, 16, 199, 174, 112, 213, 217, 112,
39
- ]);
40
- assert(new Uint8Array(arrayBuffer) === expected);
34
+ console.log(new Uint8Array(arrayBuffer));
35
+ // Uint8Array(16) [160, 86, 74, 247, 96, 194, 217, 75, 150, 16, 199, 174, 112, 213, 217, 112]
41
36
 
42
37
  // Decode base64
43
- const decoded = decodeBase64("SGVsbG8gV29ybGQ=");
44
- assert(
45
- decoded ===
46
- new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
47
- );
38
+ console.log(decodeBase64("SGVsbG8gV29ybGQ="));
39
+ // Uint8Array(11) [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]
48
40
 
49
41
  // Convert ArrayBuffer to UUID
50
42
  const data = new Uint8Array([
51
43
  160, 86, 74, 247, 96, 194, 217, 75, 150, 16, 199, 174, 112, 213, 217, 112,
52
44
  ]);
53
- const uuid = arrayBufferToUuid(data.buffer);
54
- assert(uuid === "a0564af7-60c2-d94b-9610-c7ae70d5d970");
45
+ console.log(arrayBufferToUuid(data.buffer));
46
+ // a0564af7-60c2-d94b-9610-c7ae70d5d970
55
47
 
56
48
  // Convert ArrayBuffer to hex string
57
- const hexString = arrayBufferToHex(data.buffer);
58
- assert(hexString === "a0564af760c2d94b9610c7ae70d5d970");
49
+ console.log(arrayBufferToHex(data.buffer));
50
+ // a0564af760c2d94b9610c7ae70d5d970
59
51
  ```
package/dist/index.d.ts CHANGED
@@ -60,6 +60,9 @@ declare const base64decode: typeof decodeBase64;
60
60
  * @returns The base64 encoded string
61
61
  *
62
62
  * @public
63
+ *
64
+ * @example
65
+ * {@includeCode ../test/encodeBase64.test.ts#example}
63
66
  */
64
67
  declare function encodeBase64(binary: Uint8Array): string;
65
68
  //#endregion
@@ -156,15 +159,15 @@ type Encoding = ValueOf<typeof Encoding>;
156
159
  */
157
160
  type DecodeTextOptions = {
158
161
  /**
159
- * The encoding to use. If not provided, the function will try to detect the encoding from the BOM.
162
+ * The encoding to use. If omitted, the function tries to detect the encoding from the BOM.
160
163
  */
161
164
  encoding?: Encoding;
162
165
  };
163
166
  //#endregion
164
167
  //#region src/decodeText.d.ts
165
168
  /**
166
- * Converts an ArrayBuffer or ArrayBufferView to a string. Similar to `TextDecoder.decode`
167
- * but with a fallback for environments that don't support `TextDecoder`.
169
+ * Converts an ArrayBuffer or ArrayBufferView to a string. The function works like
170
+ * `TextDecoder.decode` and also supports environments without `TextDecoder`.
168
171
  *
169
172
  * @param data - The data to decode.
170
173
  * @param options - The options for the decoding.
@@ -182,12 +185,12 @@ declare function decodeText(data: ArrayBufferLike | ArrayBufferView, options?: D
182
185
  * Utility type that marks every property of a given type as `readonly`,
183
186
  * recursively.
184
187
  *
185
- * `Readonly<T>` stops at the top level, so a nested object stays writable and
186
- * `value.nested.field = …` still compiles. This applies at every depth,
188
+ * `Readonly<T>` stops at the top level, so a nested object remains writable and
189
+ * `value.nested.field = …` still compiles. `DeepReadonly` applies at every depth,
187
190
  * including through arrays.
188
191
  *
189
- * Functions are left unchanged so callbacks carried on a value stay callable,
190
- * and primitives are returned as they are.
192
+ * Functions keep their type, so callbacks on a value remain callable.
193
+ * Primitives keep their type.
191
194
  *
192
195
  * @typeParam T - The type to make deeply readonly.
193
196
  *
@@ -200,8 +203,8 @@ type DeepReadonly<T> = T extends ((...args: never[]) => unknown) ? T : T extends
200
203
  //#endregion
201
204
  //#region src/encodeText.d.ts
202
205
  /**
203
- * Converts a string to a Uint8Array. Similar to `TextEncoder.encode`
204
- * but with a fallback for environments that don't support `TextEncoder`.
206
+ * Converts a string to a Uint8Array. The function works like
207
+ * `TextEncoder.encode` and also supports environments without `TextEncoder`.
205
208
  *
206
209
  * @param data - The string to encode.
207
210
  * @returns The Uint8Array representation of the string.
@@ -223,7 +226,7 @@ type ExclusiveRecord<K extends PropertyKey, V> = { [P in K]: Record<P, V> & Part
223
226
  //#endregion
224
227
  //#region src/ResourceTiming.d.ts
225
228
  /**
226
- * Resource Timing. This is a subset of the `PerformanceResourceTiming` interface.
229
+ * A subset of the `PerformanceResourceTiming` interface.
227
230
  * https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
228
231
  *
229
232
  * @public
@@ -249,10 +252,10 @@ type ResourceTiming = {
249
252
  //#endregion
250
253
  //#region src/getBandwidthBps.d.ts
251
254
  /**
252
- * Converts a ResourceTiming sample to bandwidth in bits per second (bps).
255
+ * Converts a ResourceTiming sample to bandwidth in bits per second.
253
256
  *
254
257
  * @param sample - A ResourceTiming sample
255
- * @returns
258
+ * @returns The bandwidth in bits per second.
256
259
  *
257
260
  * @public
258
261
  */
@@ -260,7 +263,7 @@ declare function getBandwidthBps(sample: ResourceTiming): number;
260
263
  //#endregion
261
264
  //#region src/getBaseUrl.d.ts
262
265
  /**
263
- * Get the base URL from a full URL or a URL object.
266
+ * Gets the base URL from a full URL or a URL object.
264
267
  *
265
268
  * @param fullUrl - The full URL or URL object.
266
269
  * @returns The base URL.
@@ -288,12 +291,11 @@ declare function hexToArrayBuffer(hex: string): ArrayBuffer;
288
291
  //#endregion
289
292
  //#region src/isArrayBufferLike.d.ts
290
293
  /**
291
- * Checks if the given value is `ArrayBufferLike` (i.e. an `ArrayBuffer`
292
- * or a `SharedArrayBuffer`).
294
+ * Checks if the given value is `ArrayBufferLike`: an `ArrayBuffer` or a
295
+ * `SharedArrayBuffer`.
293
296
  *
294
- * This function safely handles environments where
295
- * `SharedArrayBuffer` is not defined, such as non-cross-origin
296
- * isolated browser contexts.
297
+ * The function also works where `SharedArrayBuffer` is not defined, such as
298
+ * browser contexts without cross-origin isolation.
297
299
  *
298
300
  * @param value - The value to check.
299
301
  * @returns `true` if the value is an `ArrayBuffer` or `SharedArrayBuffer`.
@@ -346,7 +348,7 @@ type HttpRequest<D = any> = {
346
348
  */
347
349
  body?: BodyInit;
348
350
  /**
349
- * The response type with which the response from the server shall be compatible.
351
+ * The type that the response from the server must be compatible with.
350
352
  */
351
353
  responseType?: RequestResponseType;
352
354
  /**
@@ -354,16 +356,16 @@ type HttpRequest<D = any> = {
354
356
  */
355
357
  headers?: Record<string, string>;
356
358
  /**
357
- * Indicates whether the user agent should send or receive cookies from the other domain in the case of cross-origin requests.
359
+ * Whether the user agent should send or receive cookies from the other domain in cross-origin requests.
358
360
  */
359
361
  credentials?: RequestCredentials;
360
362
  /**
361
- * The mode of the request (e.g., cors, no-cors, same-origin, etc).
363
+ * The mode of the request, for example cors, no-cors, or same-origin.
362
364
  */
363
365
  mode?: RequestMode;
364
366
  /**
365
- * The number of milliseconds the request can take before automatically being terminated.
366
- * If undefined or value is 0 then there is no timeout.
367
+ * The number of milliseconds the request may take before it is terminated.
368
+ * If the value is undefined or 0, there is no timeout.
367
369
  */
368
370
  timeout?: number;
369
371
  /**
@@ -412,7 +414,7 @@ type HttpResponse<R extends HttpRequest = HttpRequest> = {
412
414
  */
413
415
  url?: string;
414
416
  /**
415
- * Indicates whether or not the request was redirected.
417
+ * Whether the request was redirected.
416
418
  */
417
419
  redirected?: boolean;
418
420
  /**
@@ -452,8 +454,8 @@ type Request = HttpRequest;
452
454
  //#endregion
453
455
  //#region src/roundToEven.d.ts
454
456
  /**
455
- * This implements the rounding procedure described in step 2 of the "Serializing a Decimal" specification.
456
- * This rounding style is known as "even rounding", "banker's rounding", or "commercial rounding".
457
+ * Rounds a value with the procedure from step 2 of the "Serializing a Decimal" specification.
458
+ * The style is known as "even rounding", "banker's rounding", or "commercial rounding".
457
459
  *
458
460
  * @param value - The value to round
459
461
  * @param precision - The number of decimal places to round to
@@ -506,7 +508,7 @@ declare function unescapeHtml(text: string): string;
506
508
  /**
507
509
  * Constructs a relative path from a URL.
508
510
  *
509
- * If `url` is already a relative path, or its origin differs from `base`, it is returned unchanged.
511
+ * If `url` is already relative, or its origin differs from `base`, the function returns `url` unchanged.
510
512
  *
511
513
  * @param url - The destination URL
512
514
  * @param base - The base URL
@@ -521,7 +523,7 @@ declare function urlToRelativePath(url: string, base: string): string;
521
523
  //#endregion
522
524
  //#region src/uuid.d.ts
523
525
  /**
524
- * Generate a random v4 UUID
526
+ * Generates a random v4 UUID
525
527
  *
526
528
  * @returns A random v4 UUID
527
529
  *
@@ -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/DeepReadonly.ts","../src/encodeText.ts","../src/ExclusiveRecord.ts","../src/ResourceTiming.ts","../src/getBandwidthBps.ts","../src/getBaseUrl.ts","../src/hexToArrayBuffer.ts","../src/isArrayBufferLike.ts","../src/RequestResponseType.ts","../src/HttpRequest.ts","../src/XmlNode.ts","../src/ResponseTypeMap.ts","../src/HttpResponse.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;;;;ACLA;;iBDKgB,iBAAA,SAA0B;;;;ADF1C;;;;ACEA;;;iBCLgB,YAAA,eAA2B;;;AFG3C;;;;ACEA;;;;ACLA;;;;ACMaA,cAAAA,YAAqB,EAAA,OAAA,YAAA;;;;AHHlC;;;;ACEA;;;iBGLgB,YAAA,SAAqB;;;AJGrC;;;;ACEA;;;;ACLA;;;;ACMaA,cEAAC,YFAqB,EAAA,OEAA,YFAA;;;;AHHlC;;;;ACEA;;;iBKLgB,oBAAA,QAA4B,aAAa;;;;ANGzD;;;;ACEgB,cMRH,MAAA,GNQG,QAA0B;;;;ADF1C;;;;ACEgB,cORH,SAAA,GPQG,UAA0B;;;;ADF1C;;;;ACEgB,cQRH,SAAA,GRQG,UAA0B;;;;ADF1C;;;;ACEgB,cSRH,KAAA,GTQG,OAA0B;;;;ADF1C;;;;ACEgB,KURJ,OVQI,CAAA,CAAA,CAAA,GURS,CVQT,CAAA,MURiB,CVQjB,CAA0B;;;AAA1C;;;;ACLA;cUGa;wBACU;yBACE;ETCzB,SAAaD,OAAAA,EAAqB,OSAJ,STAI;2BSCJ;;;ARP9B;;;;ACMaC,KOSD,QAAA,GAAW,OPTW,CAAA,OOSI,QPTJ,CAAA;;;ALHlC;;;;ACEA;KYNY,iBAAA;;;AXCZ;aWGY;;;;AbAZ;;;;ACEA;;;;ACLA;;;;ACMA;iBWMgB,UAAA,OAAiB,kBAAkB,2BAA0B;;;;AdT7E;;;;ACE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;;;;ECNA;;;;ECMA;;;;ECNA;;;;ECHA;;;;ECAA;;;YmBuCW;ElBvCX;;;SkB4CQ,gBAAgB;EjB5CxB;;;mBiBiDkB;AhBjDlB,CAAA;;;AXMA;;;;ACEA;;K2BLY,OAAA,GAAU;;;;A5BGtB;;;;ACEA;;;;ACLA;iB2BEgB,WAAA;;;;A7BChB;;;;ACEA;;;;ACLA;;iB4BGgB,cAAA,eAA6B;;;;A9BA7C;;;;ACEgB,K8BRJ,W9BQI;ECLhB,IAAgB,E6BFT,C7BES;Q6BDT;;;;;A/BIP;;;;ACEA;;;;ACLA;;iB8BKgB,YAAA;;;;AhCFhB;;;;ACEA;;;;ACLA;;;;ACMA;iB8BAgB,iBAAA;;;;AjCHhB;;;;ACEA;;;;ACLA;iBgCIgB,IAAA,CAAA;;;;AlCDhB;;;;ACEA;;;;ACLA;;iBiCKgB,iBAAA,gBAAiC;;;;AnCFjD;;;;ACEgB,KmCRJ,YnCQI,CAAA,CAAA,CAAA,GmCRc,CnCQd,GmCRkB,CnCQQ,EAAA"}
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/DeepReadonly.ts","../src/encodeText.ts","../src/ExclusiveRecord.ts","../src/ResourceTiming.ts","../src/getBandwidthBps.ts","../src/getBaseUrl.ts","../src/hexToArrayBuffer.ts","../src/isArrayBufferLike.ts","../src/RequestResponseType.ts","../src/HttpRequest.ts","../src/XmlNode.ts","../src/ResponseTypeMap.ts","../src/HttpResponse.ts","../src/Request.ts","../src/roundToEven.ts","../src/stringToUint16.ts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;;;ACEA;;K2BLY,OAAA,GAAU;;;;A5BGtB;;;;ACEA;;;;ACLA;iB2BEgB,WAAA;;;;A7BChB;;;;ACEA;;;;ACLA;;iB4BGgB,cAAA,eAA6B;;;;A9BA7C;;;;ACEgB,K8BRJ,W9BQI;ECLhB,IAAgB,E6BFT,C7BES;Q6BDT;;;;;A/BIP;;;;ACEA;;;;ACLA;;iB8BKgB,YAAA;;;;AhCFhB;;;;ACEA;;;;ACLA;;;;ACMA;iB8BAgB,iBAAA;;;;AjCHhB;;;;ACEA;;;;ACLA;iBgCIgB,IAAA,CAAA;;;;AlCDhB;;;;ACEA;;;;ACLA;;iBiCKgB,iBAAA,gBAAiC;;;;AnCFjD;;;;ACEgB,KmCRJ,YnCQI,CAAA,CAAA,CAAA,GmCRc,CnCQd,GmCRkB,CnCQQ,EAAA"}
package/dist/index.js CHANGED
@@ -63,6 +63,7 @@ const base64decode = decodeBase64;
63
63
 
64
64
  //#endregion
65
65
  //#region src/encodeBase64.ts
66
+ const CHUNK_SIZE = 32768;
66
67
  /**
67
68
  * Encodes binary data to base64
68
69
  *
@@ -70,9 +71,17 @@ const base64decode = decodeBase64;
70
71
  * @returns The base64 encoded string
71
72
  *
72
73
  * @public
74
+ *
75
+ * @example
76
+ * {@includeCode ../test/encodeBase64.test.ts#example}
73
77
  */
74
78
  function encodeBase64(binary) {
75
- return btoa(String.fromCharCode(...binary));
79
+ let text = "";
80
+ for (let i = 0; i < binary.length; i += CHUNK_SIZE) {
81
+ const chunk = binary.subarray(i, i + CHUNK_SIZE);
82
+ text += String.fromCharCode.apply(null, chunk);
83
+ }
84
+ return btoa(text);
76
85
  }
77
86
 
78
87
  //#endregion
@@ -113,12 +122,11 @@ function convertUint8ToUint16(input) {
113
122
  //#endregion
114
123
  //#region src/isArrayBufferLike.ts
115
124
  /**
116
- * Checks if the given value is `ArrayBufferLike` (i.e. an `ArrayBuffer`
117
- * or a `SharedArrayBuffer`).
125
+ * Checks if the given value is `ArrayBufferLike`: an `ArrayBuffer` or a
126
+ * `SharedArrayBuffer`.
118
127
  *
119
- * This function safely handles environments where
120
- * `SharedArrayBuffer` is not defined, such as non-cross-origin
121
- * isolated browser contexts.
128
+ * The function also works where `SharedArrayBuffer` is not defined, such as
129
+ * browser contexts without cross-origin isolation.
122
130
  *
123
131
  * @param value - The value to check.
124
132
  * @returns `true` if the value is an `ArrayBuffer` or `SharedArrayBuffer`.
@@ -171,8 +179,8 @@ const UTF_8 = "utf-8";
171
179
  //#endregion
172
180
  //#region src/decodeText.ts
173
181
  /**
174
- * Converts an ArrayBuffer or ArrayBufferView to a string. Similar to `TextDecoder.decode`
175
- * but with a fallback for environments that don't support `TextDecoder`.
182
+ * Converts an ArrayBuffer or ArrayBufferView to a string. The function works like
183
+ * `TextDecoder.decode` and also supports environments without `TextDecoder`.
176
184
  *
177
185
  * @param data - The data to decode.
178
186
  * @param options - The options for the decoding.
@@ -254,8 +262,8 @@ function decodeText(data, options = {}) {
254
262
  //#endregion
255
263
  //#region src/encodeText.ts
256
264
  /**
257
- * Converts a string to a Uint8Array. Similar to `TextEncoder.encode`
258
- * but with a fallback for environments that don't support `TextEncoder`.
265
+ * Converts a string to a Uint8Array. The function works like
266
+ * `TextEncoder.encode` and also supports environments without `TextEncoder`.
259
267
  *
260
268
  * @param data - The string to encode.
261
269
  * @returns The Uint8Array representation of the string.
@@ -286,10 +294,10 @@ const Encoding = {
286
294
  //#endregion
287
295
  //#region src/getBandwidthBps.ts
288
296
  /**
289
- * Converts a ResourceTiming sample to bandwidth in bits per second (bps).
297
+ * Converts a ResourceTiming sample to bandwidth in bits per second.
290
298
  *
291
299
  * @param sample - A ResourceTiming sample
292
- * @returns
300
+ * @returns The bandwidth in bits per second.
293
301
  *
294
302
  * @public
295
303
  */
@@ -301,7 +309,7 @@ function getBandwidthBps(sample) {
301
309
  //#endregion
302
310
  //#region src/getBaseUrl.ts
303
311
  /**
304
- * Get the base URL from a full URL or a URL object.
312
+ * Gets the base URL from a full URL or a URL object.
305
313
  *
306
314
  * @param fullUrl - The full URL or URL object.
307
315
  * @returns The base URL.
@@ -357,8 +365,8 @@ const RequestResponseType = {
357
365
  //#endregion
358
366
  //#region src/roundToEven.ts
359
367
  /**
360
- * This implements the rounding procedure described in step 2 of the "Serializing a Decimal" specification.
361
- * This rounding style is known as "even rounding", "banker's rounding", or "commercial rounding".
368
+ * Rounds a value with the procedure from step 2 of the "Serializing a Decimal" specification.
369
+ * The style is known as "even rounding", "banker's rounding", or "commercial rounding".
362
370
  *
363
371
  * @param value - The value to round
364
372
  * @param precision - The number of decimal places to round to
@@ -436,7 +444,7 @@ function unescapeHtml(text) {
436
444
  /**
437
445
  * Constructs a relative path from a URL.
438
446
  *
439
- * If `url` is already a relative path, or its origin differs from `base`, it is returned unchanged.
447
+ * If `url` is already relative, or its origin differs from `base`, the function returns `url` unchanged.
440
448
  *
441
449
  * @param url - The destination URL
442
450
  * @param base - The base URL
@@ -458,23 +466,18 @@ function urlToRelativePath(url, base) {
458
466
  if (to.origin !== from.origin) return url;
459
467
  const toPath = to.pathname.split("/").slice(1);
460
468
  const fromPath = from.pathname.split("/").slice(1, -1);
461
- const length = Math.min(toPath.length, fromPath.length);
462
- for (let i = 0; i < length; i++) {
463
- if (toPath[i] !== fromPath[i]) break;
464
- toPath.shift();
465
- fromPath.shift();
466
- }
467
- while (fromPath.length) {
468
- fromPath.shift();
469
- toPath.unshift("..");
470
- }
471
- return toPath.join("/") + to.search + to.hash;
469
+ let common = 0;
470
+ while (common < toPath.length - 1 && common < fromPath.length && toPath[common] === fromPath[common]) common++;
471
+ const ups = fromPath.length - common;
472
+ let relativePath = "../".repeat(ups) + toPath.slice(common).join("/");
473
+ if (ups === 0 && (relativePath === "" || relativePath.startsWith("/") || toPath[common].includes(":"))) relativePath = "./" + relativePath;
474
+ return relativePath + to.search + to.hash;
472
475
  }
473
476
 
474
477
  //#endregion
475
478
  //#region src/uuid.ts
476
479
  /**
477
- * Generate a random v4 UUID
480
+ * Generates a random v4 UUID
478
481
  *
479
482
  * @returns A random v4 UUID
480
483
  *
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["base64decode: typeof decodeBase64","base64encode: typeof encodeBase64","view: DataView","char!: number","to: URL","error","uuid","uuid"],"sources":["../src/arrayBufferToHex.ts","../src/arrayBufferToUuid.ts","../src/decodeBase64.ts","../src/base64decode.ts","../src/encodeBase64.ts","../src/base64encode.ts","../src/convertUint8ToUint16.ts","../src/isArrayBufferLike.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/getBaseUrl.ts","../src/hexToArrayBuffer.ts","../src/RequestResponseType.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 * Checks if the given value is `ArrayBufferLike` (i.e. an `ArrayBuffer`\n * or a `SharedArrayBuffer`).\n *\n * This function safely handles environments where\n * `SharedArrayBuffer` is not defined, such as non-cross-origin\n * isolated browser contexts.\n *\n * @param value - The value to check.\n * @returns `true` if the value is an `ArrayBuffer` or `SharedArrayBuffer`.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/isArrayBufferLike.test.ts#example}\n */\nexport function isArrayBufferLike(value: unknown): value is ArrayBufferLike {\n\treturn value instanceof ArrayBuffer\n\t\t|| (typeof SharedArrayBuffer !== 'undefined' && value instanceof SharedArrayBuffer)\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 { isArrayBufferLike } from './isArrayBufferLike.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: ArrayBufferLike | ArrayBufferView, options: DecodeTextOptions = {}): string {\n\tlet view: DataView\n\n\tif (isArrayBufferLike(data)) {\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 * Get the base URL from a full URL or a URL object.\n *\n * @param fullUrl - The full URL or URL object.\n * @returns The base URL.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/getBaseUrl.test.ts#example}\n */\nexport function getBaseUrl(fullUrl: string | URL): string {\n\tconst url = typeof fullUrl === 'string' ? new URL(fullUrl) : fullUrl\n\treturn url.origin + url.pathname.substring(0, url.pathname.lastIndexOf('/') + 1)\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 response type of the request.\n *\n * @enum\n *\n * @public\n */\nexport const RequestResponseType = {\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\tSTREAM: 'stream' as const,\n} as const\n\n/**\n * @public\n */\nexport type RequestResponseType = ValueOf<typeof RequestResponseType>;\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 {\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 '&amp;': return '&'\n\t\t\tcase '&lt;': return '<'\n\t\t\tcase '&gt;': return '>'\n\t\t\tcase '&quot;': return '\"'\n\t\t\tcase '&apos;': return '\\''\n\t\t\tcase '&nbsp;': return '\\u{a0}'\n\t\t\tcase '&lrm;': return '\\u{200e}'\n\t\t\tcase '&rlm;': 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 * If `url` is already a relative path, or its origin differs from `base`, it is returned unchanged.\n *\n * @param url - The destination URL\n * @param base - The base URL\n * @returns The relative path\n *\n * @public\n *\n * @example\n * {@includeCode ../test/urlToRelativePath.test.ts#example}\n */\nexport function urlToRelativePath(url: string, base: string): string {\n\tlet to: URL\n\ttry {\n\t\tto = new URL(url)\n\t}\n\tcatch {\n\t\treturn url\n\t}\n\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","import { arrayBufferToUuid } from './arrayBufferToUuid.ts'\n\n/**\n * Generate a random v4 UUID\n *\n * @returns A random v4 UUID\n *\n * @public\n *\n * @example\n * {@includeCode ../test/uuid.test.ts#example}\n */\nexport function uuid(): string {\n\ttry {\n\t\treturn crypto.randomUUID()\n\t}\n\tcatch (error) {\n\t\ttry {\n\t\t\tconst bytes = crypto.getRandomValues(new Uint8Array(16))\n\n\t\t\t// Set the version (4) and variant (RFC 4122) bits\n\t\t\tbytes[6] = (bytes[6] & 0x0f) | 0x40\n\t\t\tbytes[8] = (bytes[8] & 0x3f) | 0x80\n\n\t\t\treturn arrayBufferToUuid(bytes.buffer)\n\t\t}\n\t\tcatch (error) {\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}\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(/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,iBADKC,OAAK,QAAQ,MAAM,GAAG,CACN"}
1
+ {"version":3,"file":"index.js","names":["base64decode: typeof decodeBase64","chunk: ArrayLike<number>","base64encode: typeof encodeBase64","view: DataView","char!: number","to: URL","error","uuid","uuid"],"sources":["../src/arrayBufferToHex.ts","../src/arrayBufferToUuid.ts","../src/decodeBase64.ts","../src/base64decode.ts","../src/encodeBase64.ts","../src/base64encode.ts","../src/convertUint8ToUint16.ts","../src/isArrayBufferLike.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/getBaseUrl.ts","../src/hexToArrayBuffer.ts","../src/RequestResponseType.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","const CHUNK_SIZE = 0x8000\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 * @example\n * {@includeCode ../test/encodeBase64.test.ts#example}\n */\nexport function encodeBase64(binary: Uint8Array): string {\n\tlet text = ''\n\n\tfor (let i = 0; i < binary.length; i += CHUNK_SIZE) {\n\t\tconst chunk: ArrayLike<number> = binary.subarray(i, i + CHUNK_SIZE)\n\t\ttext += String.fromCharCode.apply(null, chunk as number[])\n\t}\n\n\treturn btoa(text)\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 * Checks if the given value is `ArrayBufferLike`: an `ArrayBuffer` or a\n * `SharedArrayBuffer`.\n *\n * The function also works where `SharedArrayBuffer` is not defined, such as\n * browser contexts without cross-origin isolation.\n *\n * @param value - The value to check.\n * @returns `true` if the value is an `ArrayBuffer` or `SharedArrayBuffer`.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/isArrayBufferLike.test.ts#example}\n */\nexport function isArrayBufferLike(value: unknown): value is ArrayBufferLike {\n\treturn value instanceof ArrayBuffer\n\t\t|| (typeof SharedArrayBuffer !== 'undefined' && value instanceof SharedArrayBuffer)\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 { isArrayBufferLike } from './isArrayBufferLike.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. The function works like\n * `TextDecoder.decode` and also supports environments without `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: ArrayBufferLike | ArrayBufferView, options: DecodeTextOptions = {}): string {\n\tlet view: DataView\n\n\tif (isArrayBufferLike(data)) {\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. The function works like\n * `TextEncoder.encode` and also supports environments without `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.\n *\n * @param sample - A ResourceTiming sample\n * @returns The bandwidth in bits per second.\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 * Gets the base URL from a full URL or a URL object.\n *\n * @param fullUrl - The full URL or URL object.\n * @returns The base URL.\n *\n * @public\n *\n * @example\n * {@includeCode ../test/getBaseUrl.test.ts#example}\n */\nexport function getBaseUrl(fullUrl: string | URL): string {\n\tconst url = typeof fullUrl === 'string' ? new URL(fullUrl) : fullUrl\n\treturn url.origin + url.pathname.substring(0, url.pathname.lastIndexOf('/') + 1)\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 response type of the request.\n *\n * @enum\n *\n * @public\n */\nexport const RequestResponseType = {\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\tSTREAM: 'stream' as const,\n} as const\n\n/**\n * @public\n */\nexport type RequestResponseType = ValueOf<typeof RequestResponseType>;\n","/**\n * Rounds a value with the procedure from step 2 of the \"Serializing a Decimal\" specification.\n * The 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 {\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 '&amp;': return '&'\n\t\t\tcase '&lt;': return '<'\n\t\t\tcase '&gt;': return '>'\n\t\t\tcase '&quot;': return '\"'\n\t\t\tcase '&apos;': return '\\''\n\t\t\tcase '&nbsp;': return '\\u{a0}'\n\t\t\tcase '&lrm;': return '\\u{200e}'\n\t\t\tcase '&rlm;': 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 * If `url` is already relative, or its origin differs from `base`, the function returns `url` unchanged.\n *\n * @param url - The destination URL\n * @param base - The base URL\n * @returns The relative path\n *\n * @public\n *\n * @example\n * {@includeCode ../test/urlToRelativePath.test.ts#example}\n */\nexport function urlToRelativePath(url: string, base: string): string {\n\tlet to: URL\n\ttry {\n\t\tto = new URL(url)\n\t}\n\tcatch {\n\t\treturn url\n\t}\n\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// count common parents, stopping before the destination file\n\tlet common = 0\n\n\twhile (common < toPath.length - 1 && common < fromPath.length && toPath[common] === fromPath[common]) {\n\t\tcommon++\n\t}\n\n\t// add back paths\n\tconst ups = fromPath.length - common\n\tlet relativePath = '../'.repeat(ups) + toPath.slice(common).join('/')\n\n\t// RFC 3986 section 4.2: a relative-path reference cannot be empty, start with \"/\", or have \":\" in its first segment\n\tif (ups === 0 && (relativePath === '' || relativePath.startsWith('/') || toPath[common].includes(':'))) {\n\t\trelativePath = './' + relativePath\n\t}\n\n\t// preserve query parameters and hash of the destination url\n\treturn relativePath + to.search + to.hash\n}\n","import { arrayBufferToUuid } from './arrayBufferToUuid.ts'\n\n/**\n * Generates a random v4 UUID\n *\n * @returns A random v4 UUID\n *\n * @public\n *\n * @example\n * {@includeCode ../test/uuid.test.ts#example}\n */\nexport function uuid(): string {\n\ttry {\n\t\treturn crypto.randomUUID()\n\t}\n\tcatch (error) {\n\t\ttry {\n\t\t\tconst bytes = crypto.getRandomValues(new Uint8Array(16))\n\n\t\t\t// Set the version (4) and variant (RFC 4122) bits\n\t\t\tbytes[6] = (bytes[6] & 0x0f) | 0x40\n\t\t\tbytes[8] = (bytes[8] & 0x3f) | 0x80\n\n\t\t\treturn arrayBufferToUuid(bytes.buffer)\n\t\t}\n\t\tcatch (error) {\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}\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,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,EAAE,GAAG;;;;;;;;;;;;;;;;ACAtF,SAAgB,kBAAkB,QAA6B;AAE9D,QADY,iBAAiB,OAAO,CACzB,QAAQ,mCAAmC,iBAAiB;;;;;;;;;;;;;ACPxE,SAAgB,aAAa,KAAyB;AACrD,QAAO,IAAI,WAAW,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;ACKlE,MAAaA,eAAoC;;;;ACdjD,MAAM,aAAa;;;;;;;;;;;;AAanB,SAAgB,aAAa,QAA4B;CACxD,IAAI,OAAO;AAEX,MAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,YAAY;EACnD,MAAMC,QAA2B,OAAO,SAAS,GAAG,IAAI,WAAW;AACnE,UAAQ,OAAO,aAAa,MAAM,MAAM,MAAkB;;AAG3D,QAAO,KAAK,KAAK;;;;;;;;;;;;;;;;;ACPlB,MAAaC,eAAoC;;;;;;;;;;;;ACNjD,SAAgB,qBAAqB,OAAgC;AACpE,KAAI,MAAM,SAAS,MAAM,GAAG;EAC3B,MAAM,SAAS,IAAI,WAAW,MAAM,SAAS,EAAE;AAC/C,SAAO,IAAI,MAAM;AACjB,SAAO,IAAI,YAAY,OAAO,OAAO;;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I;AACH,SAAO,OAAO,YAAY;UAEpB,OAAO;AACb,MAAI;GACH,MAAM,QAAQ,OAAO,gBAAgB,IAAI,WAAW,GAAG,CAAC;AAGxD,SAAM,KAAM,MAAM,KAAK,KAAQ;AAC/B,SAAM,KAAM,MAAM,KAAK,KAAQ;AAE/B,UAAO,kBAAkB,MAAM,OAAO;WAEhCC,SAAO;GACb,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;;;;;;;;;;;;;;;;;;ACjB/C,SAAgB,kBAAkB,QAA2B;AAE5D,QAAO,iBADKC,OAAK,QAAQ,MAAM,GAAG,CACN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svta/cml-utils",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Common utility functions for media processing",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",