@telperion/js-utils 3.8.0 → 3.8.2

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 (54) hide show
  1. package/.build-manifest.json +1 -1
  2. package/array/difference.d.cts +1 -1
  3. package/array/difference.d.ts +1 -1
  4. package/array/intersection.d.cts +1 -1
  5. package/array/intersection.d.ts +1 -1
  6. package/array/proto/difference.d.cts +1 -1
  7. package/array/proto/difference.d.ts +1 -1
  8. package/array/replace.d.cts +2 -2
  9. package/array/replace.d.ts +2 -2
  10. package/array/static/arrayize.cjs.map +1 -1
  11. package/array/static/arrayize.d.cts +16 -0
  12. package/array/static/arrayize.d.ts +16 -0
  13. package/array/static/arrayize.js.map +1 -1
  14. package/fesm/js-utils.mjs +42 -3
  15. package/fesm/js-utils.mjs.map +1 -1
  16. package/function/call.cjs +20 -0
  17. package/function/call.cjs.map +1 -1
  18. package/function/call.d.cts +20 -0
  19. package/function/call.d.ts +20 -0
  20. package/function/call.js +20 -0
  21. package/function/call.js.map +1 -1
  22. package/function/debounce.cjs +1 -1
  23. package/function/debounce.d.cts +1 -1
  24. package/function/debounce.d.ts +1 -1
  25. package/function/debounce.js +1 -1
  26. package/function/static/call.cjs.map +1 -1
  27. package/function/static/call.d.cts +16 -0
  28. package/function/static/call.d.ts +16 -0
  29. package/function/static/call.js.map +1 -1
  30. package/is-falsy.cjs +1 -1
  31. package/is-falsy.d.cts +1 -1
  32. package/is-falsy.d.ts +1 -1
  33. package/is-falsy.js +1 -1
  34. package/is-truthy.cjs +1 -1
  35. package/is-truthy.d.cts +1 -1
  36. package/is-truthy.d.ts +1 -1
  37. package/is-truthy.js +1 -1
  38. package/object/deep-freeze.cjs +19 -0
  39. package/object/deep-freeze.cjs.map +1 -1
  40. package/object/deep-freeze.d.cts +19 -0
  41. package/object/deep-freeze.d.ts +19 -0
  42. package/object/deep-freeze.js +19 -0
  43. package/object/deep-freeze.js.map +1 -1
  44. package/object/static/clone.d.cts +1 -1
  45. package/object/static/clone.d.ts +1 -1
  46. package/object/static/deep-freeze.cjs.map +1 -1
  47. package/object/static/deep-freeze.d.cts +16 -0
  48. package/object/static/deep-freeze.d.ts +16 -0
  49. package/object/static/deep-freeze.js.map +1 -1
  50. package/package.json +109 -106
  51. package/promise/proto/revert.d.cts +1 -1
  52. package/promise/proto/revert.d.ts +1 -1
  53. package/promise/proto/try-catch.d.cts +1 -1
  54. package/promise/proto/try-catch.d.ts +1 -1
package/is-truthy.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ```
15
15
  * Static usage example:
16
16
  * ```typescript
17
- * import "@telperion/js-utils/dist/as-static/is-truthy";
17
+ * import "@telperion/js-utils/boolean/static/is-truthy";
18
18
  *
19
19
  * Boolean.isTruthy(undefined); // false
20
20
  * Boolean.isTruthy(true); // true
package/is-truthy.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * ```
15
15
  * Static usage example:
16
16
  * ```typescript
17
- * import "@telperion/js-utils/dist/as-static/is-truthy";
17
+ * import "@telperion/js-utils/boolean/static/is-truthy";
18
18
  *
19
19
  * Boolean.isTruthy(undefined); // false
20
20
  * Boolean.isTruthy(true); // true
@@ -1,6 +1,25 @@
1
1
  'use strict';
2
2
 
3
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ /**
5
+ * #### Deep Freeze
6
+ *
7
+ * Recursively freezes an object and every object or function it references,
8
+ * so nested values can't be changed either.
9
+ *
10
+ * * * *
11
+ * Example usage:
12
+ * ```typescript
13
+ * import { deepFreeze } from "@telperion/js-utils/object/deep-freeze";
14
+ *
15
+ * const config = deepFreeze({ api: { url: "https://example.com" } });
16
+ *
17
+ * config.api.url = "changed"; // ignored (throws in strict mode)
18
+ * ```
19
+ * * * *
20
+ * @param object Object to freeze
21
+ * @returns The same object, frozen
22
+ */
4
23
  function deepFreeze(object) {
5
24
  // Retrieve the property names defined on object
6
25
  const propNames = Reflect.ownKeys(object);
@@ -1 +1 @@
1
- {"version":3,"file":"deep-freeze.cjs","sources":["../../../../libs/js-utils/src/object/deep-freeze.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAEM,SAAU,UAAU,CAAuD,MAAoB,EAAA;;IAEnG,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;;AAGzC,IAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;AAC5B,QAAA,MAAM,KAAK,GAAI,MAAc,CAAC,IAAI,CAAC;AAEnC,QAAA,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,UAAU,EAAE;YACvE,UAAU,CAAC,KAAK,CAAC;QACnB;IACF;AAEA,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B;;;;"}
1
+ {"version":3,"file":"deep-freeze.cjs","sources":["../../../../libs/js-utils/src/object/deep-freeze.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,UAAU,CAAuD,MAAoB,EAAA;;IAEnG,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;;AAGzC,IAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;AAC5B,QAAA,MAAM,KAAK,GAAI,MAAc,CAAC,IAAI,CAAC;AAEnC,QAAA,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,UAAU,EAAE;YACvE,UAAU,CAAC,KAAK,CAAC;QACnB;IACF;AAEA,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B;;;;"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * #### Deep Freeze
3
+ *
4
+ * Recursively freezes an object and every object or function it references,
5
+ * so nested values can't be changed either.
6
+ *
7
+ * * * *
8
+ * Example usage:
9
+ * ```typescript
10
+ * import { deepFreeze } from "@telperion/js-utils/object/deep-freeze";
11
+ *
12
+ * const config = deepFreeze({ api: { url: "https://example.com" } });
13
+ *
14
+ * config.api.url = "changed"; // ignored (throws in strict mode)
15
+ * ```
16
+ * * * *
17
+ * @param object Object to freeze
18
+ * @returns The same object, frozen
19
+ */
1
20
  declare function deepFreeze<T extends string | number | symbol = string, U = any>(object: Record<T, U>): Readonly<Record<T, U>>;
2
21
 
3
22
  export { deepFreeze };
@@ -1,3 +1,22 @@
1
+ /**
2
+ * #### Deep Freeze
3
+ *
4
+ * Recursively freezes an object and every object or function it references,
5
+ * so nested values can't be changed either.
6
+ *
7
+ * * * *
8
+ * Example usage:
9
+ * ```typescript
10
+ * import { deepFreeze } from "@telperion/js-utils/object/deep-freeze";
11
+ *
12
+ * const config = deepFreeze({ api: { url: "https://example.com" } });
13
+ *
14
+ * config.api.url = "changed"; // ignored (throws in strict mode)
15
+ * ```
16
+ * * * *
17
+ * @param object Object to freeze
18
+ * @returns The same object, frozen
19
+ */
1
20
  declare function deepFreeze<T extends string | number | symbol = string, U = any>(object: Record<T, U>): Readonly<Record<T, U>>;
2
21
 
3
22
  export { deepFreeze };
@@ -1,4 +1,23 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /**
3
+ * #### Deep Freeze
4
+ *
5
+ * Recursively freezes an object and every object or function it references,
6
+ * so nested values can't be changed either.
7
+ *
8
+ * * * *
9
+ * Example usage:
10
+ * ```typescript
11
+ * import { deepFreeze } from "@telperion/js-utils/object/deep-freeze";
12
+ *
13
+ * const config = deepFreeze({ api: { url: "https://example.com" } });
14
+ *
15
+ * config.api.url = "changed"; // ignored (throws in strict mode)
16
+ * ```
17
+ * * * *
18
+ * @param object Object to freeze
19
+ * @returns The same object, frozen
20
+ */
2
21
  function deepFreeze(object) {
3
22
  // Retrieve the property names defined on object
4
23
  const propNames = Reflect.ownKeys(object);
@@ -1 +1 @@
1
- {"version":3,"file":"deep-freeze.js","sources":["../../../../libs/js-utils/src/object/deep-freeze.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEM,SAAU,UAAU,CAAuD,MAAoB,EAAA;;IAEnG,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;;AAGzC,IAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;AAC5B,QAAA,MAAM,KAAK,GAAI,MAAc,CAAC,IAAI,CAAC;AAEnC,QAAA,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,UAAU,EAAE;YACvE,UAAU,CAAC,KAAK,CAAC;QACnB;IACF;AAEA,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B;;;;"}
1
+ {"version":3,"file":"deep-freeze.js","sources":["../../../../libs/js-utils/src/object/deep-freeze.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,UAAU,CAAuD,MAAoB,EAAA;;IAEnG,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;;AAGzC,IAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;AAC5B,QAAA,MAAM,KAAK,GAAI,MAAc,CAAC,IAAI,CAAC;AAEnC,QAAA,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,UAAU,EAAE;YACvE,UAAU,CAAC,KAAK,CAAC;QACnB;IACF;AAEA,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B;;;;"}
@@ -29,7 +29,7 @@ declare global {
29
29
  *
30
30
  * Static usage example:
31
31
  * ```typescript
32
- * import "@telperion/js-utils/dist/as-static/clone";
32
+ * import "@telperion/js-utils/object/static/clone";
33
33
  *
34
34
  * const object = {a: 1, b: 2};
35
35
  * const clonedObject = Object.clone(object); // {a: 1, b: 2}
@@ -29,7 +29,7 @@ declare global {
29
29
  *
30
30
  * Static usage example:
31
31
  * ```typescript
32
- * import "@telperion/js-utils/dist/as-static/clone";
32
+ * import "@telperion/js-utils/object/static/clone";
33
33
  *
34
34
  * const object = {a: 1, b: 2};
35
35
  * const clonedObject = Object.clone(object); // {a: 1, b: 2}
@@ -1 +1 @@
1
- {"version":3,"file":"deep-freeze.cjs","sources":["../../../../../libs/js-utils/src/object/static/deep-freeze.ts"],"sourcesContent":[null],"names":["deepFreeze"],"mappings":";;;;AAQA,MAAM,CAAC,UAAU,GAAGA,4BAAU;;"}
1
+ {"version":3,"file":"deep-freeze.cjs","sources":["../../../../../libs/js-utils/src/object/static/deep-freeze.ts"],"sourcesContent":[null],"names":["deepFreeze"],"mappings":";;;;AAwBA,MAAM,CAAC,UAAU,GAAGA,4BAAU;;"}
@@ -2,6 +2,22 @@ import { deepFreeze } from '../deep-freeze.cjs';
2
2
 
3
3
  declare global {
4
4
  export interface ObjectConstructor {
5
+ /**
6
+ * #### Deep Freeze
7
+ *
8
+ * Recursively freezes an object and every object or function it references.
9
+ *
10
+ * * * *
11
+ * Example as Object static method:
12
+ * ```typescript
13
+ * import "@telperion/js-utils/object/static/deep-freeze";
14
+ *
15
+ * const config = Object.deepFreeze({ api: { url: "https://example.com" } });
16
+ * ```
17
+ * * * *
18
+ * @param object Object to freeze
19
+ * @returns The same object, frozen
20
+ */
5
21
  deepFreeze: typeof deepFreeze;
6
22
  }
7
23
  }
@@ -2,6 +2,22 @@ import { deepFreeze } from '../deep-freeze.js';
2
2
 
3
3
  declare global {
4
4
  export interface ObjectConstructor {
5
+ /**
6
+ * #### Deep Freeze
7
+ *
8
+ * Recursively freezes an object and every object or function it references.
9
+ *
10
+ * * * *
11
+ * Example as Object static method:
12
+ * ```typescript
13
+ * import "@telperion/js-utils/object/static/deep-freeze";
14
+ *
15
+ * const config = Object.deepFreeze({ api: { url: "https://example.com" } });
16
+ * ```
17
+ * * * *
18
+ * @param object Object to freeze
19
+ * @returns The same object, frozen
20
+ */
5
21
  deepFreeze: typeof deepFreeze;
6
22
  }
7
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deep-freeze.js","sources":["../../../../../libs/js-utils/src/object/static/deep-freeze.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAQA,MAAM,CAAC,UAAU,GAAG,UAAU"}
1
+ {"version":3,"file":"deep-freeze.js","sources":["../../../../../libs/js-utils/src/object/static/deep-freeze.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAwBA,MAAM,CAAC,UAAU,GAAG,UAAU"}