@cognite/underscore 1.0.1 → 1.48411.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.
Files changed (95) hide show
  1. package/README.md +2 -0
  2. package/dist/arrays.d.ts +31 -31
  3. package/dist/arrays.js +53 -18
  4. package/dist/arrays.js.map +1 -0
  5. package/dist/assert.d.ts +6 -6
  6. package/dist/assert.js +12 -5
  7. package/dist/assert.js.map +1 -0
  8. package/dist/brand.d.ts +41 -38
  9. package/dist/brand.js +39 -0
  10. package/dist/brand.js.map +1 -0
  11. package/dist/chunk-and-process-in-parallel.d.ts +112 -106
  12. package/dist/chunk-and-process-in-parallel.js +138 -29
  13. package/dist/chunk-and-process-in-parallel.js.map +1 -0
  14. package/dist/chunk-array.d.ts +25 -25
  15. package/dist/chunk-array.js +34 -6
  16. package/dist/chunk-array.js.map +1 -0
  17. package/dist/class.d.ts +8 -8
  18. package/dist/class.js +11 -5
  19. package/dist/class.js.map +1 -0
  20. package/dist/exhaustive-guard.d.ts +15 -15
  21. package/dist/exhaustive-guard.js +19 -5
  22. package/dist/exhaustive-guard.js.map +1 -0
  23. package/dist/exponential-backoff-with-jitter.d.ts +13 -13
  24. package/dist/exponential-backoff-with-jitter.js +23 -7
  25. package/dist/exponential-backoff-with-jitter.js.map +1 -0
  26. package/dist/generate-unique-name.d.ts +17 -17
  27. package/dist/generate-unique-name.js +46 -10
  28. package/dist/generate-unique-name.js.map +1 -0
  29. package/dist/get-numbers-between.d.ts +15 -15
  30. package/dist/get-numbers-between.js +21 -5
  31. package/dist/get-numbers-between.js.map +1 -0
  32. package/dist/humanize-value.d.ts +3 -3
  33. package/dist/humanize-value.js +33 -15
  34. package/dist/humanize-value.js.map +1 -0
  35. package/dist/index.d.ts +23 -23
  36. package/dist/index.js +23 -23
  37. package/dist/index.js.map +1 -0
  38. package/dist/is-function.d.ts +5 -5
  39. package/dist/is-function.js +9 -5
  40. package/dist/is-function.js.map +1 -0
  41. package/dist/is-primitive.d.ts +7 -7
  42. package/dist/is-primitive.js +16 -6
  43. package/dist/is-primitive.js.map +1 -0
  44. package/dist/is-valid-url.d.ts +11 -14
  45. package/dist/is-valid-url.js +39 -16
  46. package/dist/is-valid-url.js.map +1 -0
  47. package/dist/iterators.d.ts +7 -7
  48. package/dist/iterators.js +16 -6
  49. package/dist/iterators.js.map +1 -0
  50. package/dist/math.d.ts +10 -10
  51. package/dist/math.js +16 -7
  52. package/dist/math.js.map +1 -0
  53. package/dist/random.d.ts +24 -24
  54. package/dist/random.js +52 -18
  55. package/dist/random.js.map +1 -0
  56. package/dist/react/use-debounce.d.ts +21 -21
  57. package/dist/react/use-debounce.js +39 -14
  58. package/dist/react/use-debounce.js.map +1 -0
  59. package/dist/react/use-derived-promise.d.ts +28 -29
  60. package/dist/react/use-derived-promise.js +70 -33
  61. package/dist/react/use-derived-promise.js.map +1 -0
  62. package/dist/react/use-stable-sync-external-store.d.ts +25 -25
  63. package/dist/react/use-stable-sync-external-store.js +52 -11
  64. package/dist/react/use-stable-sync-external-store.js.map +1 -0
  65. package/dist/react.d.ts +3 -3
  66. package/dist/react.js +5 -4
  67. package/dist/react.js.map +1 -0
  68. package/dist/repeat.d.ts +5 -5
  69. package/dist/repeat.js +11 -5
  70. package/dist/repeat.js.map +1 -0
  71. package/dist/retry-async.d.ts +87 -87
  72. package/dist/retry-async.js +88 -17
  73. package/dist/retry-async.js.map +1 -0
  74. package/dist/sleep.d.ts +5 -5
  75. package/dist/sleep.js +9 -5
  76. package/dist/sleep.js.map +1 -0
  77. package/dist/string.d.ts +35 -35
  78. package/dist/string.js +48 -9
  79. package/dist/string.js.map +1 -0
  80. package/dist/structMap/index.d.ts +3 -3
  81. package/dist/structMap/index.js +4 -0
  82. package/dist/structMap/index.js.map +1 -0
  83. package/dist/structMap/stableStringify.d.ts +21 -21
  84. package/dist/structMap/stableStringify.js +69 -22
  85. package/dist/structMap/stableStringify.js.map +1 -0
  86. package/dist/structMap/structMap.d.ts +111 -108
  87. package/dist/structMap/structMap.js +131 -28
  88. package/dist/structMap/structMap.js.map +1 -0
  89. package/dist/structMap/testUtils.d.ts +8 -8
  90. package/dist/structMap/testUtils.js +26 -0
  91. package/dist/structMap/testUtils.js.map +1 -0
  92. package/dist/structMap/types.d.ts +4 -4
  93. package/dist/structMap/types.js +5 -0
  94. package/dist/structMap/types.js.map +1 -0
  95. package/package.json +7 -4
@@ -1,6 +1,22 @@
1
- //#region libs/shared/underscore/src/get-numbers-between.ts
2
- function* e(e, t, n = 1) {
3
- for (let r = e; r < t; r += n) yield r;
1
+ /**
2
+ * Generates a sequence of numbers between the specified range.
3
+ *
4
+ * @param minInclusive - The starting number of the sequence (inclusive).
5
+ * @param maxExclusive - The ending number of the sequence (exclusive).
6
+ * @param step - The step value to increment by (default is 1).
7
+ * @returns A generator that yields numbers between the specified range.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const numbers = getNumbersBetween(1, 5);
12
+ * for (const num of numbers) {
13
+ * console.log(num); // 1, 2, 3, 4
14
+ * }
15
+ * ```
16
+ */ export function* getNumbersBetween(minInclusive, maxExclusive, step = 1) {
17
+ for(let i = minInclusive; i < maxExclusive; i += step){
18
+ yield i;
19
+ }
4
20
  }
5
- //#endregion
6
- export { e as getNumbersBetween };
21
+
22
+ //# sourceMappingURL=get-numbers-between.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/get-numbers-between.ts"],"sourcesContent":["/**\n * Generates a sequence of numbers between the specified range.\n *\n * @param minInclusive - The starting number of the sequence (inclusive).\n * @param maxExclusive - The ending number of the sequence (exclusive).\n * @param step - The step value to increment by (default is 1).\n * @returns A generator that yields numbers between the specified range.\n *\n * @example\n * ```ts\n * const numbers = getNumbersBetween(1, 5);\n * for (const num of numbers) {\n * console.log(num); // 1, 2, 3, 4\n * }\n * ```\n */\nexport function* getNumbersBetween(\n minInclusive: number,\n maxExclusive: number,\n step: number = 1\n): Generator<number> {\n for (let i = minInclusive; i < maxExclusive; i += step) {\n yield i;\n }\n}\n"],"names":["getNumbersBetween","minInclusive","maxExclusive","step","i"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,UAAUA,kBACfC,YAAoB,EACpBC,YAAoB,EACpBC,OAAe,CAAC;IAEhB,IAAK,IAAIC,IAAIH,cAAcG,IAAIF,cAAcE,KAAKD,KAAM;QACtD,MAAMC;IACR;AACF"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Turns nested objects and arrays into a flat, human-readable string for UI display.
3
- * Null, undefined, NaN, and empty collections render as `'-'`.
4
- */
2
+ * Turns nested objects and arrays into a flat, human-readable string for UI display.
3
+ * Null, undefined, NaN, and empty collections render as `'-'`.
4
+ */
5
5
  export declare function humanizeValue(value: unknown): string;
@@ -1,16 +1,34 @@
1
- import { isArray as e, isNaN as t, isObject as n } from "lodash-es";
2
- //#region libs/shared/underscore/src/humanize-value.ts
3
- function r(i) {
4
- if (i == null || t(i) || e(i) && i.length === 0 || n(i) && Object.keys(i).length === 0) return "-";
5
- let a = "", o = (t) => {
6
- e(t) ? t.forEach((e) => {
7
- o(e);
8
- }) : n(t) ? Object.entries(t).forEach(([e, t]) => {
9
- let n = r(t);
10
- a += `${e}: ${n} `;
11
- }) : a += `${String(t)} `;
12
- };
13
- return o(i), a.trim();
1
+ import { isArray, isNaN, isObject } from "lodash-es";
2
+ /**
3
+ * Turns nested objects and arrays into a flat, human-readable string for UI display.
4
+ * Null, undefined, NaN, and empty collections render as `'-'`.
5
+ */ export function humanizeValue(value) {
6
+ if (value === undefined || value === null || isNaN(value)) {
7
+ return '-';
8
+ }
9
+ if (isArray(value) && value.length === 0) {
10
+ return '-';
11
+ }
12
+ if (isObject(value) && Object.keys(value).length === 0) {
13
+ return '-';
14
+ }
15
+ let result = '';
16
+ const parseValue = (val)=>{
17
+ if (isArray(val)) {
18
+ val.forEach((innerValue)=>{
19
+ parseValue(innerValue);
20
+ });
21
+ } else if (isObject(val)) {
22
+ Object.entries(val).forEach(([key, innerValue])=>{
23
+ const humanizedInnerValue = humanizeValue(innerValue);
24
+ result += `${key}: ${humanizedInnerValue} `;
25
+ });
26
+ } else {
27
+ result += `${String(val)} `;
28
+ }
29
+ };
30
+ parseValue(value);
31
+ return result.trim();
14
32
  }
15
- //#endregion
16
- export { r as humanizeValue };
33
+
34
+ //# sourceMappingURL=humanize-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/humanize-value.ts"],"sourcesContent":["import { isArray, isNaN, isObject } from 'lodash-es';\n\n/**\n * Turns nested objects and arrays into a flat, human-readable string for UI display.\n * Null, undefined, NaN, and empty collections render as `'-'`.\n */\nexport function humanizeValue(value: unknown): string {\n if (value === undefined || value === null || isNaN(value)) {\n return '-';\n }\n if (isArray(value) && value.length === 0) {\n return '-';\n }\n if (isObject(value) && Object.keys(value).length === 0) {\n return '-';\n }\n\n let result = '';\n\n const parseValue = (val: unknown): void => {\n if (isArray(val)) {\n val.forEach((innerValue) => {\n parseValue(innerValue);\n });\n } else if (isObject(val)) {\n Object.entries(val).forEach(([key, innerValue]) => {\n const humanizedInnerValue = humanizeValue(innerValue);\n result += `${key}: ${humanizedInnerValue} `;\n });\n } else {\n result += `${String(val)} `;\n }\n };\n\n parseValue(value);\n\n return result.trim();\n}\n"],"names":["isArray","isNaN","isObject","humanizeValue","value","undefined","length","Object","keys","result","parseValue","val","forEach","innerValue","entries","key","humanizedInnerValue","String","trim"],"mappings":"AAAA,SAASA,OAAO,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,YAAY;AAErD;;;CAGC,GACD,OAAO,SAASC,cAAcC,KAAc;IAC1C,IAAIA,UAAUC,aAAaD,UAAU,QAAQH,MAAMG,QAAQ;QACzD,OAAO;IACT;IACA,IAAIJ,QAAQI,UAAUA,MAAME,MAAM,KAAK,GAAG;QACxC,OAAO;IACT;IACA,IAAIJ,SAASE,UAAUG,OAAOC,IAAI,CAACJ,OAAOE,MAAM,KAAK,GAAG;QACtD,OAAO;IACT;IAEA,IAAIG,SAAS;IAEb,MAAMC,aAAa,CAACC;QAClB,IAAIX,QAAQW,MAAM;YAChBA,IAAIC,OAAO,CAAC,CAACC;gBACXH,WAAWG;YACb;QACF,OAAO,IAAIX,SAASS,MAAM;YACxBJ,OAAOO,OAAO,CAACH,KAAKC,OAAO,CAAC,CAAC,CAACG,KAAKF,WAAW;gBAC5C,MAAMG,sBAAsBb,cAAcU;gBAC1CJ,UAAU,GAAGM,IAAI,EAAE,EAAEC,oBAAoB,CAAC,CAAC;YAC7C;QACF,OAAO;YACLP,UAAU,GAAGQ,OAAON,KAAK,CAAC,CAAC;QAC7B;IACF;IAEAD,WAAWN;IAEX,OAAOK,OAAOS,IAAI;AACpB"}
package/dist/index.d.ts CHANGED
@@ -1,23 +1,23 @@
1
- export { insertAt, remove, removeAt, swap, shuffle } from './arrays';
2
- export { assert } from './assert';
3
- export type { Brand } from './brand';
4
- export { chunkAndProcessInParallel } from './chunk-and-process-in-parallel';
5
- export { chunkArray } from './chunk-array';
6
- export { isInstanceOf, type Class } from './class';
7
- export { exhaustiveGuard } from './exhaustive-guard';
8
- export { exponentialBackoffWithJitter } from './exponential-backoff-with-jitter';
9
- export { generateUniqueName } from './generate-unique-name';
10
- export { getNumbersBetween } from './get-numbers-between';
11
- export { humanizeValue } from './humanize-value';
12
- export { isFunction } from './is-function';
13
- export { isPrimitive } from './is-primitive';
14
- export { isValidUrl } from './is-valid-url';
15
- export { every } from './iterators';
16
- export { isEven, isOdd } from './math';
17
- export { randomString, randomInteger, randomFloat, randomElement, } from './random';
18
- export { repeat } from './repeat';
19
- export { retryAsync } from './retry-async';
20
- export { sleep } from './sleep';
21
- export { capitalizeFirstLetter, kebabToPascalCase, toKebabCase, } from './string';
22
- export type { KeySerializer } from './structMap';
23
- export { stableStringify, StructMap } from './structMap';
1
+ export { insertAt, remove, removeAt, swap, shuffle } from "./arrays";
2
+ export { assert } from "./assert";
3
+ export type { Brand } from "./brand";
4
+ export { chunkAndProcessInParallel } from "./chunk-and-process-in-parallel";
5
+ export { chunkArray } from "./chunk-array";
6
+ export { isInstanceOf, type Class } from "./class";
7
+ export { exhaustiveGuard } from "./exhaustive-guard";
8
+ export { exponentialBackoffWithJitter } from "./exponential-backoff-with-jitter";
9
+ export { generateUniqueName } from "./generate-unique-name";
10
+ export { getNumbersBetween } from "./get-numbers-between";
11
+ export { humanizeValue } from "./humanize-value";
12
+ export { isFunction } from "./is-function";
13
+ export { isPrimitive } from "./is-primitive";
14
+ export { isValidUrl } from "./is-valid-url";
15
+ export { every } from "./iterators";
16
+ export { isEven, isOdd } from "./math";
17
+ export { randomString, randomInteger, randomFloat, randomElement } from "./random";
18
+ export { repeat } from "./repeat";
19
+ export { retryAsync } from "./retry-async";
20
+ export { sleep } from "./sleep";
21
+ export { capitalizeFirstLetter, kebabToPascalCase, toKebabCase } from "./string";
22
+ export type { KeySerializer } from "./structMap";
23
+ export { stableStringify, StructMap } from "./structMap";
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { repeat as e } from "./repeat.js";
2
- import { randomElement as t, randomFloat as n, randomInteger as r, randomString as i } from "./random.js";
3
- import { insertAt as a, remove as o, removeAt as s, shuffle as c, swap as l } from "./arrays.js";
4
- import { assert as u } from "./assert.js";
5
- import { chunkArray as d } from "./chunk-array.js";
6
- import { chunkAndProcessInParallel as f } from "./chunk-and-process-in-parallel.js";
7
- import { isInstanceOf as p } from "./class.js";
8
- import { exhaustiveGuard as m } from "./exhaustive-guard.js";
9
- import { exponentialBackoffWithJitter as h } from "./exponential-backoff-with-jitter.js";
10
- import { generateUniqueName as g } from "./generate-unique-name.js";
11
- import { getNumbersBetween as _ } from "./get-numbers-between.js";
12
- import { humanizeValue as v } from "./humanize-value.js";
13
- import { isFunction as y } from "./is-function.js";
14
- import { isPrimitive as b } from "./is-primitive.js";
15
- import { isValidUrl as x } from "./is-valid-url.js";
16
- import { every as S } from "./iterators.js";
17
- import { isEven as C, isOdd as w } from "./math.js";
18
- import { sleep as T } from "./sleep.js";
19
- import { retryAsync as E } from "./retry-async.js";
20
- import { capitalizeFirstLetter as D, kebabToPascalCase as O, toKebabCase as k } from "./string.js";
21
- import { stableStringify as A } from "./structMap/stableStringify.js";
22
- import { StructMap as j } from "./structMap/structMap.js";
23
- export { j as StructMap, u as assert, D as capitalizeFirstLetter, f as chunkAndProcessInParallel, d as chunkArray, S as every, m as exhaustiveGuard, h as exponentialBackoffWithJitter, g as generateUniqueName, _ as getNumbersBetween, v as humanizeValue, a as insertAt, C as isEven, y as isFunction, p as isInstanceOf, w as isOdd, b as isPrimitive, x as isValidUrl, O as kebabToPascalCase, t as randomElement, n as randomFloat, r as randomInteger, i as randomString, o as remove, s as removeAt, e as repeat, E as retryAsync, c as shuffle, T as sleep, A as stableStringify, l as swap, k as toKebabCase };
1
+ export { insertAt, remove, removeAt, swap, shuffle } from "./arrays.js";
2
+ export { assert } from "./assert.js";
3
+ export { chunkAndProcessInParallel } from "./chunk-and-process-in-parallel.js";
4
+ export { chunkArray } from "./chunk-array.js";
5
+ export { isInstanceOf } from "./class.js";
6
+ export { exhaustiveGuard } from "./exhaustive-guard.js";
7
+ export { exponentialBackoffWithJitter } from "./exponential-backoff-with-jitter.js";
8
+ export { generateUniqueName } from "./generate-unique-name.js";
9
+ export { getNumbersBetween } from "./get-numbers-between.js";
10
+ export { humanizeValue } from "./humanize-value.js";
11
+ export { isFunction } from "./is-function.js";
12
+ export { isPrimitive } from "./is-primitive.js";
13
+ export { isValidUrl } from "./is-valid-url.js";
14
+ export { every } from "./iterators.js";
15
+ export { isEven, isOdd } from "./math.js";
16
+ export { randomString, randomInteger, randomFloat, randomElement } from "./random.js";
17
+ export { repeat } from "./repeat.js";
18
+ export { retryAsync } from "./retry-async.js";
19
+ export { sleep } from "./sleep.js";
20
+ export { capitalizeFirstLetter, kebabToPascalCase, toKebabCase } from "./string.js";
21
+ export { stableStringify, StructMap } from "./structMap/index.js";
22
+
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { insertAt, remove, removeAt, swap, shuffle } from './arrays';\nexport { assert } from './assert';\nexport type { Brand } from './brand';\nexport { chunkAndProcessInParallel } from './chunk-and-process-in-parallel';\nexport { chunkArray } from './chunk-array';\nexport { isInstanceOf, type Class } from './class';\nexport { exhaustiveGuard } from './exhaustive-guard';\nexport { exponentialBackoffWithJitter } from './exponential-backoff-with-jitter';\nexport { generateUniqueName } from './generate-unique-name';\nexport { getNumbersBetween } from './get-numbers-between';\nexport { humanizeValue } from './humanize-value';\nexport { isFunction } from './is-function';\nexport { isPrimitive } from './is-primitive';\nexport { isValidUrl } from './is-valid-url';\nexport { every } from './iterators';\nexport { isEven, isOdd } from './math';\nexport {\n randomString,\n randomInteger,\n randomFloat,\n randomElement,\n} from './random';\nexport { repeat } from './repeat';\nexport { retryAsync } from './retry-async';\nexport { sleep } from './sleep';\nexport {\n capitalizeFirstLetter,\n kebabToPascalCase,\n toKebabCase,\n} from './string';\nexport type { KeySerializer } from './structMap';\nexport { stableStringify, StructMap } from './structMap';\n"],"names":["insertAt","remove","removeAt","swap","shuffle","assert","chunkAndProcessInParallel","chunkArray","isInstanceOf","exhaustiveGuard","exponentialBackoffWithJitter","generateUniqueName","getNumbersBetween","humanizeValue","isFunction","isPrimitive","isValidUrl","every","isEven","isOdd","randomString","randomInteger","randomFloat","randomElement","repeat","retryAsync","sleep","capitalizeFirstLetter","kebabToPascalCase","toKebabCase","stableStringify","StructMap"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,QAAQ,cAAW;AACrE,SAASC,MAAM,QAAQ,cAAW;AAElC,SAASC,yBAAyB,QAAQ,qCAAkC;AAC5E,SAASC,UAAU,QAAQ,mBAAgB;AAC3C,SAASC,YAAY,QAAoB,aAAU;AACnD,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,4BAA4B,QAAQ,uCAAoC;AACjF,SAASC,kBAAkB,QAAQ,4BAAyB;AAC5D,SAASC,iBAAiB,QAAQ,2BAAwB;AAC1D,SAASC,aAAa,QAAQ,sBAAmB;AACjD,SAASC,UAAU,QAAQ,mBAAgB;AAC3C,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,UAAU,QAAQ,oBAAiB;AAC5C,SAASC,KAAK,QAAQ,iBAAc;AACpC,SAASC,MAAM,EAAEC,KAAK,QAAQ,YAAS;AACvC,SACEC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,aAAa,QACR,cAAW;AAClB,SAASC,MAAM,QAAQ,cAAW;AAClC,SAASC,UAAU,QAAQ,mBAAgB;AAC3C,SAASC,KAAK,QAAQ,aAAU;AAChC,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,WAAW,QACN,cAAW;AAElB,SAASC,eAAe,EAAEC,SAAS,QAAQ,uBAAc"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Checks if the given value is a function.
3
- *
4
- * @param maybeFunction - The value to check.
5
- * @returns True if the value is a function, otherwise false.
6
- */
2
+ * Checks if the given value is a function.
3
+ *
4
+ * @param maybeFunction - The value to check.
5
+ * @returns True if the value is a function, otherwise false.
6
+ */
7
7
  export declare function isFunction(maybeFunction: unknown): maybeFunction is Function;
@@ -1,6 +1,10 @@
1
- //#region libs/shared/underscore/src/is-function.ts
2
- function e(e) {
3
- return typeof e == "function";
1
+ /**
2
+ * Checks if the given value is a function.
3
+ *
4
+ * @param maybeFunction - The value to check.
5
+ * @returns True if the value is a function, otherwise false.
6
+ */ export function isFunction(maybeFunction) {
7
+ return typeof maybeFunction === 'function';
4
8
  }
5
- //#endregion
6
- export { e as isFunction };
9
+
10
+ //# sourceMappingURL=is-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-function.ts"],"sourcesContent":["/**\n * Checks if the given value is a function.\n *\n * @param maybeFunction - The value to check.\n * @returns True if the value is a function, otherwise false.\n */\nexport function isFunction(maybeFunction: unknown): maybeFunction is Function {\n return typeof maybeFunction === 'function';\n}\n"],"names":["isFunction","maybeFunction"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,WAAWC,aAAsB;IAC/C,OAAO,OAAOA,kBAAkB;AAClC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Checks if the given value is a primitive.
3
- * Primitives include: string, number, boolean, null, undefined, symbol, and bigint.
4
- * {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive}
5
- *
6
- * @param value - The value to check.
7
- * @returns Returns true if the value is a primitive, false otherwise.
8
- */
2
+ * Checks if the given value is a primitive.
3
+ * Primitives include: string, number, boolean, null, undefined, symbol, and bigint.
4
+ * {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive}
5
+ *
6
+ * @param value - The value to check.
7
+ * @returns Returns true if the value is a primitive, false otherwise.
8
+ */
9
9
  export declare function isPrimitive(value: unknown): boolean;
@@ -1,7 +1,17 @@
1
- //#region libs/shared/underscore/src/is-primitive.ts
2
- function e(e) {
3
- let t = typeof e;
4
- return e === null || t === "string" || t === "number" || t === "boolean" || t === "undefined" || t === "symbol" || t === "bigint";
1
+ /**
2
+ * Checks if the given value is a primitive.
3
+ * Primitives include: string, number, boolean, null, undefined, symbol, and bigint.
4
+ * {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive}
5
+ *
6
+ * @param value - The value to check.
7
+ * @returns Returns true if the value is a primitive, false otherwise.
8
+ */ export function isPrimitive(value) {
9
+ const type = typeof value;
10
+ // "typeof null" returns 'object', so we need to check explicitly for null
11
+ if (value === null) {
12
+ return true;
13
+ }
14
+ return type === 'string' || type === 'number' || type === 'boolean' || type === 'undefined' || type === 'symbol' || type === 'bigint';
5
15
  }
6
- //#endregion
7
- export { e as isPrimitive };
16
+
17
+ //# sourceMappingURL=is-primitive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-primitive.ts"],"sourcesContent":["/**\n * Checks if the given value is a primitive.\n * Primitives include: string, number, boolean, null, undefined, symbol, and bigint.\n * {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive}\n *\n * @param value - The value to check.\n * @returns Returns true if the value is a primitive, false otherwise.\n */\nexport function isPrimitive(value: unknown): boolean {\n const type = typeof value;\n\n // \"typeof null\" returns 'object', so we need to check explicitly for null\n if (value === null) {\n return true;\n }\n\n return (\n type === 'string' ||\n type === 'number' ||\n type === 'boolean' ||\n type === 'undefined' ||\n type === 'symbol' ||\n type === 'bigint'\n );\n}\n"],"names":["isPrimitive","value","type"],"mappings":"AAAA;;;;;;;CAOC,GACD,OAAO,SAASA,YAAYC,KAAc;IACxC,MAAMC,OAAO,OAAOD;IAEpB,0EAA0E;IAC1E,IAAIA,UAAU,MAAM;QAClB,OAAO;IACT;IAEA,OACEC,SAAS,YACTA,SAAS,YACTA,SAAS,aACTA,SAAS,eACTA,SAAS,YACTA,SAAS;AAEb"}
@@ -1,16 +1,13 @@
1
1
  /**
2
- * Inspired by: https://github.com/segmentio/is-url
3
- */
4
- /**
5
- * Checks if a value is a valid URL.
6
- *
7
- * A valid URL must:
8
- * - Be a string.
9
- * - Start with "http://" or "https://".
10
- * - Contain a valid domain name.
11
- * - Not contain spaces in the host part.
12
- *
13
- * @param {unknown} value - The value to be checked.
14
- * @returns {value is string} - Returns `true` if the value is a valid URL, otherwise `false`.
15
- */
2
+ * Checks if a value is a valid URL.
3
+ *
4
+ * A valid URL must:
5
+ * - Be a string.
6
+ * - Start with "http://" or "https://".
7
+ * - Contain a valid domain name.
8
+ * - Not contain spaces in the host part.
9
+ *
10
+ * @param {unknown} value - The value to be checked.
11
+ * @returns {value is string} - Returns `true` if the value is a valid URL, otherwise `false`.
12
+ */
16
13
  export declare function isValidUrl(value: unknown): value is string;
@@ -1,17 +1,40 @@
1
- //#region libs/shared/underscore/src/is-valid-url.ts
2
- var e = /^(https?):\/\/(\S+)$/, t = /^[^\s\\.]+\.\S{2,}$/;
3
- function n(n) {
4
- if (typeof n != "string") return !1;
5
- let r = n.match(e);
6
- if (!r) return !1;
7
- let i = r[2];
8
- if (!i || !t.test(i)) return !1;
9
- try {
10
- let e = new URL(n);
11
- return e.protocol === "http:" || e.protocol === "https:";
12
- } catch {
13
- return !1;
14
- }
1
+ /**
2
+ * Inspired by: https://github.com/segmentio/is-url
3
+ */ const protocolAndDomainRE = /^(https?):\/\/(\S+)$/;
4
+ const domainRE = /^[^\s\\.]+\.\S{2,}$/;
5
+ /**
6
+ * Checks if a value is a valid URL.
7
+ *
8
+ * A valid URL must:
9
+ * - Be a string.
10
+ * - Start with "http://" or "https://".
11
+ * - Contain a valid domain name.
12
+ * - Not contain spaces in the host part.
13
+ *
14
+ * @param {unknown} value - The value to be checked.
15
+ * @returns {value is string} - Returns `true` if the value is a valid URL, otherwise `false`.
16
+ */ export function isValidUrl(value) {
17
+ if (typeof value !== 'string') {
18
+ return false;
19
+ }
20
+ const match = value.match(protocolAndDomainRE);
21
+ if (!match) {
22
+ return false;
23
+ }
24
+ const everythingAfterProtocol = match[2];
25
+ if (!everythingAfterProtocol) {
26
+ return false;
27
+ }
28
+ if (!domainRE.test(everythingAfterProtocol)) {
29
+ return false;
30
+ }
31
+ // Added for extra safety to prevent XSS attack vectors
32
+ try {
33
+ const url = new URL(value);
34
+ return url.protocol === 'http:' || url.protocol === 'https:';
35
+ } catch (_) {
36
+ return false;
37
+ }
15
38
  }
16
- //#endregion
17
- export { n as isValidUrl };
39
+
40
+ //# sourceMappingURL=is-valid-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-valid-url.ts"],"sourcesContent":["/**\n * Inspired by: https://github.com/segmentio/is-url\n */\n\nconst protocolAndDomainRE = /^(https?):\\/\\/(\\S+)$/;\nconst domainRE = /^[^\\s\\\\.]+\\.\\S{2,}$/;\n\n/**\n * Checks if a value is a valid URL.\n *\n * A valid URL must:\n * - Be a string.\n * - Start with \"http://\" or \"https://\".\n * - Contain a valid domain name.\n * - Not contain spaces in the host part.\n *\n * @param {unknown} value - The value to be checked.\n * @returns {value is string} - Returns `true` if the value is a valid URL, otherwise `false`.\n */\nexport function isValidUrl(value: unknown): value is string {\n if (typeof value !== 'string') {\n return false;\n }\n\n const match = value.match(protocolAndDomainRE);\n if (!match) {\n return false;\n }\n\n const everythingAfterProtocol = match[2];\n if (!everythingAfterProtocol) {\n return false;\n }\n\n if (!domainRE.test(everythingAfterProtocol)) {\n return false;\n }\n\n // Added for extra safety to prevent XSS attack vectors\n try {\n const url = new URL(value);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch (_) {\n return false;\n }\n}\n"],"names":["protocolAndDomainRE","domainRE","isValidUrl","value","match","everythingAfterProtocol","test","url","URL","protocol","_"],"mappings":"AAAA;;CAEC,GAED,MAAMA,sBAAsB;AAC5B,MAAMC,WAAW;AAEjB;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,WAAWC,KAAc;IACvC,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAO;IACT;IAEA,MAAMC,QAAQD,MAAMC,KAAK,CAACJ;IAC1B,IAAI,CAACI,OAAO;QACV,OAAO;IACT;IAEA,MAAMC,0BAA0BD,KAAK,CAAC,EAAE;IACxC,IAAI,CAACC,yBAAyB;QAC5B,OAAO;IACT;IAEA,IAAI,CAACJ,SAASK,IAAI,CAACD,0BAA0B;QAC3C,OAAO;IACT;IAEA,uDAAuD;IACvD,IAAI;QACF,MAAME,MAAM,IAAIC,IAAIL;QACpB,OAAOI,IAAIE,QAAQ,KAAK,WAAWF,IAAIE,QAAQ,KAAK;IACtD,EAAE,OAAOC,GAAG;QACV,OAAO;IACT;AACF"}
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Tests whether all elements in the iterable pass the test implemented by the provided predicate function.
3
- *
4
- * @template T - The type of elements in the iterable.
5
- * @param {Iterable<T>} iterable - The iterable to be tested.
6
- * @param {(value: T) => boolean} predicate - A function that tests each element of the iterable.
7
- * @returns {boolean} - Returns `true` if all elements pass the test, otherwise `false`.
8
- */
2
+ * Tests whether all elements in the iterable pass the test implemented by the provided predicate function.
3
+ *
4
+ * @template T - The type of elements in the iterable.
5
+ * @param {Iterable<T>} iterable - The iterable to be tested.
6
+ * @param {(value: T) => boolean} predicate - A function that tests each element of the iterable.
7
+ * @returns {boolean} - Returns `true` if all elements pass the test, otherwise `false`.
8
+ */
9
9
  export declare function every<T>(iterable: Iterable<T>, predicate: (value: T) => boolean): boolean;
package/dist/iterators.js CHANGED
@@ -1,7 +1,17 @@
1
- //#region libs/shared/underscore/src/iterators.ts
2
- function e(e, t) {
3
- for (let n of e) if (!t(n)) return !1;
4
- return !0;
1
+ /**
2
+ * Tests whether all elements in the iterable pass the test implemented by the provided predicate function.
3
+ *
4
+ * @template T - The type of elements in the iterable.
5
+ * @param {Iterable<T>} iterable - The iterable to be tested.
6
+ * @param {(value: T) => boolean} predicate - A function that tests each element of the iterable.
7
+ * @returns {boolean} - Returns `true` if all elements pass the test, otherwise `false`.
8
+ */ export function every(iterable, predicate) {
9
+ for (const item of iterable){
10
+ if (!predicate(item)) {
11
+ return false;
12
+ }
13
+ }
14
+ return true;
5
15
  }
6
- //#endregion
7
- export { e as every };
16
+
17
+ //# sourceMappingURL=iterators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterators.ts"],"sourcesContent":["/**\n * Tests whether all elements in the iterable pass the test implemented by the provided predicate function.\n *\n * @template T - The type of elements in the iterable.\n * @param {Iterable<T>} iterable - The iterable to be tested.\n * @param {(value: T) => boolean} predicate - A function that tests each element of the iterable.\n * @returns {boolean} - Returns `true` if all elements pass the test, otherwise `false`.\n */\nexport function every<T>(\n iterable: Iterable<T>,\n predicate: (value: T) => boolean\n): boolean {\n for (const item of iterable) {\n if (!predicate(item)) {\n return false;\n }\n }\n return true;\n}\n"],"names":["every","iterable","predicate","item"],"mappings":"AAAA;;;;;;;CAOC,GACD,OAAO,SAASA,MACdC,QAAqB,EACrBC,SAAgC;IAEhC,KAAK,MAAMC,QAAQF,SAAU;QAC3B,IAAI,CAACC,UAAUC,OAAO;YACpB,OAAO;QACT;IACF;IACA,OAAO;AACT"}
package/dist/math.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
- * Determines if a number is even.
3
- *
4
- * @param value - The number to check.
5
- * @returns `true` if the number is even, otherwise `false`.
6
- */
2
+ * Determines if a number is even.
3
+ *
4
+ * @param value - The number to check.
5
+ * @returns `true` if the number is even, otherwise `false`.
6
+ */
7
7
  export declare function isEven(value: number): boolean;
8
8
  /**
9
- * Determines if a number is odd.
10
- *
11
- * @param value - The number to check.
12
- * @returns `true` if the number is odd, otherwise `false`.
13
- */
9
+ * Determines if a number is odd.
10
+ *
11
+ * @param value - The number to check.
12
+ * @returns `true` if the number is odd, otherwise `false`.
13
+ */
14
14
  export declare function isOdd(value: number): boolean;
package/dist/math.js CHANGED
@@ -1,9 +1,18 @@
1
- //#region libs/shared/underscore/src/math.ts
2
- function e(e) {
3
- return e % 2 == 0;
1
+ /**
2
+ * Determines if a number is even.
3
+ *
4
+ * @param value - The number to check.
5
+ * @returns `true` if the number is even, otherwise `false`.
6
+ */ export function isEven(value) {
7
+ return value % 2 === 0;
4
8
  }
5
- function t(t) {
6
- return !e(t);
9
+ /**
10
+ * Determines if a number is odd.
11
+ *
12
+ * @param value - The number to check.
13
+ * @returns `true` if the number is odd, otherwise `false`.
14
+ */ export function isOdd(value) {
15
+ return !isEven(value);
7
16
  }
8
- //#endregion
9
- export { e as isEven, t as isOdd };
17
+
18
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/math.ts"],"sourcesContent":["/**\n * Determines if a number is even.\n *\n * @param value - The number to check.\n * @returns `true` if the number is even, otherwise `false`.\n */\nexport function isEven(value: number): boolean {\n return value % 2 === 0;\n}\n\n/**\n * Determines if a number is odd.\n *\n * @param value - The number to check.\n * @returns `true` if the number is odd, otherwise `false`.\n */\nexport function isOdd(value: number): boolean {\n return !isEven(value);\n}\n"],"names":["isEven","value","isOdd"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,OAAOC,KAAa;IAClC,OAAOA,QAAQ,MAAM;AACvB;AAEA;;;;;CAKC,GACD,OAAO,SAASC,MAAMD,KAAa;IACjC,OAAO,CAACD,OAAOC;AACjB"}
package/dist/random.d.ts CHANGED
@@ -1,32 +1,32 @@
1
1
  /**
2
- * Generates a random string of the specified length using alphanumeric characters.
3
- *
4
- * @param {number} length - The length of the random string to generate. Must be greater than 0.
5
- * @returns {string} A random string of the specified length.
6
- * @throws {Error} If the length is less than 1.
7
- */
2
+ * Generates a random string of the specified length using alphanumeric characters.
3
+ *
4
+ * @param {number} length - The length of the random string to generate. Must be greater than 0.
5
+ * @returns {string} A random string of the specified length.
6
+ * @throws {Error} If the length is less than 1.
7
+ */
8
8
  export declare function randomString(length: number): string;
9
9
  /**
10
- * Returns a random element from the given array.
11
- *
12
- * @template T - The type of elements in the array.
13
- * @param {T[]} array - The array from which to select a random element.
14
- * @returns {T} A random element from the array.
15
- */
10
+ * Returns a random element from the given array.
11
+ *
12
+ * @template T - The type of elements in the array.
13
+ * @param {T[]} array - The array from which to select a random element.
14
+ * @returns {T} A random element from the array.
15
+ */
16
16
  export declare function randomElement<T>(array: readonly T[]): T;
17
17
  /**
18
- * Returns a random integer between minInclusive and maxExclusive.
19
- *
20
- * @param minInclusive
21
- * @param maxExclusive
22
- * @returns
23
- */
18
+ * Returns a random integer between minInclusive and maxExclusive.
19
+ *
20
+ * @param minInclusive
21
+ * @param maxExclusive
22
+ * @returns
23
+ */
24
24
  export declare function randomInteger(minInclusive: number, maxExclusive: number): number;
25
25
  /**
26
- * Generates a random float within the given range [min, max).
27
- *
28
- * @param {number} minInclusive - The minimum value (inclusive).
29
- * @param {number} maxExclusive - The maximum value (exclusive).
30
- * @returns {number} A random float within the range [min, max).
31
- */
26
+ * Generates a random float within the given range [min, max).
27
+ *
28
+ * @param {number} minInclusive - The minimum value (inclusive).
29
+ * @param {number} maxExclusive - The maximum value (exclusive).
30
+ * @returns {number} A random float within the range [min, max).
31
+ */
32
32
  export declare function randomFloat(minInclusive: number, maxExclusive: number): number;