@pawells/typescript-common 1.1.0 → 1.1.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.
Files changed (93) hide show
  1. package/build/array/array-chunk.d.ts +10 -4
  2. package/build/array/array-chunk.d.ts.map +1 -1
  3. package/build/array/array-chunk.js +10 -4
  4. package/build/array/array-chunk.js.map +1 -1
  5. package/build/array/array-contains.d.ts +11 -3
  6. package/build/array/array-contains.d.ts.map +1 -1
  7. package/build/array/array-contains.js +11 -3
  8. package/build/array/array-contains.js.map +1 -1
  9. package/build/array/array-group-by.d.ts +14 -5
  10. package/build/array/array-group-by.d.ts.map +1 -1
  11. package/build/array/array-group-by.js +14 -5
  12. package/build/array/array-group-by.js.map +1 -1
  13. package/build/array/array-shuffle.d.ts +12 -3
  14. package/build/array/array-shuffle.d.ts.map +1 -1
  15. package/build/array/array-shuffle.js +12 -3
  16. package/build/array/array-shuffle.js.map +1 -1
  17. package/build/array/unique.d.ts +13 -3
  18. package/build/array/unique.d.ts.map +1 -1
  19. package/build/array/unique.js +13 -3
  20. package/build/array/unique.js.map +1 -1
  21. package/build/asserts/errors.d.ts +91 -7
  22. package/build/asserts/errors.d.ts.map +1 -1
  23. package/build/asserts/errors.js +91 -7
  24. package/build/asserts/errors.js.map +1 -1
  25. package/build/asserts/generic.d.ts +8 -4
  26. package/build/asserts/generic.d.ts.map +1 -1
  27. package/build/asserts/generic.js +8 -4
  28. package/build/asserts/generic.js.map +1 -1
  29. package/build/enum/enum-entries.d.ts +8 -3
  30. package/build/enum/enum-entries.d.ts.map +1 -1
  31. package/build/enum/enum-entries.js +8 -3
  32. package/build/enum/enum-entries.js.map +1 -1
  33. package/build/enum/enum-key-by-value.d.ts +10 -5
  34. package/build/enum/enum-key-by-value.d.ts.map +1 -1
  35. package/build/enum/enum-key-by-value.js +10 -5
  36. package/build/enum/enum-key-by-value.js.map +1 -1
  37. package/build/enum/enum-keys.d.ts +12 -3
  38. package/build/enum/enum-keys.d.ts.map +1 -1
  39. package/build/enum/enum-keys.js +12 -3
  40. package/build/enum/enum-keys.js.map +1 -1
  41. package/build/enum/enum-safe-value.d.ts +11 -6
  42. package/build/enum/enum-safe-value.d.ts.map +1 -1
  43. package/build/enum/enum-safe-value.js +11 -6
  44. package/build/enum/enum-safe-value.js.map +1 -1
  45. package/build/enum/validate-enum-value.d.ts +10 -5
  46. package/build/enum/validate-enum-value.d.ts.map +1 -1
  47. package/build/enum/validate-enum-value.js +10 -5
  48. package/build/enum/validate-enum-value.js.map +1 -1
  49. package/build/index.d.ts +1 -0
  50. package/build/index.d.ts.map +1 -1
  51. package/build/number/assert.d.ts +14 -14
  52. package/build/number/assert.d.ts.map +1 -1
  53. package/build/object/clone.d.ts +17 -6
  54. package/build/object/clone.d.ts.map +1 -1
  55. package/build/object/clone.js +17 -6
  56. package/build/object/clone.js.map +1 -1
  57. package/build/object/filter-cached.d.ts +15 -3
  58. package/build/object/filter-cached.d.ts.map +1 -1
  59. package/build/object/filter-cached.js +15 -3
  60. package/build/object/filter-cached.js.map +1 -1
  61. package/build/object/has-circular-reference.d.ts +12 -3
  62. package/build/object/has-circular-reference.d.ts.map +1 -1
  63. package/build/object/has-circular-reference.js +12 -3
  64. package/build/object/has-circular-reference.js.map +1 -1
  65. package/build/object/key-value-pairs.d.ts +11 -3
  66. package/build/object/key-value-pairs.d.ts.map +1 -1
  67. package/build/object/key-value-pairs.js +11 -3
  68. package/build/object/key-value-pairs.js.map +1 -1
  69. package/build/object/map-cached.d.ts +14 -3
  70. package/build/object/map-cached.d.ts.map +1 -1
  71. package/build/object/map-cached.js +14 -3
  72. package/build/object/map-cached.js.map +1 -1
  73. package/build/object/merge.d.ts +18 -7
  74. package/build/object/merge.d.ts.map +1 -1
  75. package/build/object/merge.js +18 -7
  76. package/build/object/merge.js.map +1 -1
  77. package/build/object/omit.d.ts +13 -4
  78. package/build/object/omit.d.ts.map +1 -1
  79. package/build/object/omit.js +13 -4
  80. package/build/object/omit.js.map +1 -1
  81. package/build/string/formatting.d.ts +10 -3
  82. package/build/string/formatting.d.ts.map +1 -1
  83. package/build/string/formatting.js +10 -3
  84. package/build/string/formatting.js.map +1 -1
  85. package/package.json +1 -1
  86. package/build/asserts/object.d.ts +0 -138
  87. package/build/asserts/object.d.ts.map +0 -1
  88. package/build/asserts/object.js +0 -204
  89. package/build/asserts/object.js.map +0 -1
  90. package/build/asserts/string.d.ts +0 -100
  91. package/build/asserts/string.d.ts.map +0 -1
  92. package/build/asserts/string.js +0 -185
  93. package/build/asserts/string.js.map +0 -1
@@ -1,10 +1,16 @@
1
1
  /**
2
2
  * Chunks an array into smaller arrays of a specified size.
3
- * @param array The array to split.
4
- * @param size Size of each chunk.
5
- * @returns Array of arrays, each of the specified size.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The array to split
6
+ * @param size - Size of each chunk (last chunk may be smaller)
7
+ * @returns Array of arrays, each of the specified size
8
+ *
6
9
  * @example
7
- * const chunks = ArrayChunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
10
+ * ```typescript
11
+ * ArrayChunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
12
+ * ArrayChunk(['a', 'b', 'c'], 2); // [['a', 'b'], ['c']]
13
+ * ```
8
14
  */
9
15
  export declare function ArrayChunk<T>(array: T[], size: number): T[][];
10
16
  //# sourceMappingURL=array-chunk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-chunk.d.ts","sourceRoot":"","sources":["../../src/array/array-chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAY7D"}
1
+ {"version":3,"file":"array-chunk.d.ts","sourceRoot":"","sources":["../../src/array/array-chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAY7D"}
@@ -1,10 +1,16 @@
1
1
  /**
2
2
  * Chunks an array into smaller arrays of a specified size.
3
- * @param array The array to split.
4
- * @param size Size of each chunk.
5
- * @returns Array of arrays, each of the specified size.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The array to split
6
+ * @param size - Size of each chunk (last chunk may be smaller)
7
+ * @returns Array of arrays, each of the specified size
8
+ *
6
9
  * @example
7
- * const chunks = ArrayChunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
10
+ * ```typescript
11
+ * ArrayChunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
12
+ * ArrayChunk(['a', 'b', 'c'], 2); // [['a', 'b'], ['c']]
13
+ * ```
8
14
  */
9
15
  export function ArrayChunk(array, size) {
10
16
  if (!array || size <= 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"array-chunk.js","sourceRoot":"","sources":["../../src/array/array-chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,KAAU,EAAE,IAAY;IACrD,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"array-chunk.js","sourceRoot":"","sources":["../../src/array/array-chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CAAI,KAAU,EAAE,IAAY;IACrD,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -1,9 +1,17 @@
1
1
  import type { TPredicate } from './types';
2
2
  /**
3
3
  * Checks if an array contains at least one element that passes a predicate test.
4
- * @param array The array to check.
5
- * @param predicate TPredicate function to test each element.
6
- * @returns True if at least one element passes the test, false otherwise.
4
+ *
5
+ * @template T - The type of array elements
6
+ * @param array - The array to check
7
+ * @param predicate - A function that tests each element; returns `true` to signal a match
8
+ * @returns `true` if at least one element passes the test, `false` otherwise
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * ArrayContains([1, 2, 3], (n) => n > 2); // true
13
+ * ArrayContains([1, 2, 3], (n) => n > 10); // false
14
+ * ```
7
15
  */
8
16
  export declare function ArrayContains<T>(array: T[], predicate: TPredicate<T>): boolean;
9
17
  //# sourceMappingURL=array-contains.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-contains.d.ts","sourceRoot":"","sources":["../../src/array/array-contains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAM9E"}
1
+ {"version":3,"file":"array-contains.d.ts","sourceRoot":"","sources":["../../src/array/array-contains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAM9E"}
@@ -1,8 +1,16 @@
1
1
  /**
2
2
  * Checks if an array contains at least one element that passes a predicate test.
3
- * @param array The array to check.
4
- * @param predicate TPredicate function to test each element.
5
- * @returns True if at least one element passes the test, false otherwise.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The array to check
6
+ * @param predicate - A function that tests each element; returns `true` to signal a match
7
+ * @returns `true` if at least one element passes the test, `false` otherwise
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * ArrayContains([1, 2, 3], (n) => n > 2); // true
12
+ * ArrayContains([1, 2, 3], (n) => n > 10); // false
13
+ * ```
6
14
  */
7
15
  export function ArrayContains(array, predicate) {
8
16
  if (!array || array.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"array-contains.js","sourceRoot":"","sources":["../../src/array/array-contains.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAI,KAAU,EAAE,SAAwB;IACpE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"array-contains.js","sourceRoot":"","sources":["../../src/array/array-contains.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAI,KAAU,EAAE,SAAwB;IACpE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,13 +1,22 @@
1
1
  import type { TTransform } from './types';
2
2
  /**
3
3
  * Groups array elements by a key generated by a provided function.
4
- * @param array The array to group.
5
- * @param keyFn TTransform function that returns the grouping key for each element.
6
- * @returns An object with keys as group names and values as arrays of grouped elements.
4
+ *
5
+ * @template T - The type of array elements
6
+ * @template K - The key type (string, number, or symbol)
7
+ * @param array - The array to group
8
+ * @param keyFn - Function that returns the grouping key for each element
9
+ * @returns A record where each key maps to an array of matching elements
10
+ *
7
11
  * @example
12
+ * ```typescript
8
13
  * const items = [{ category: 'fruit', name: 'apple' }, { category: 'vegetable', name: 'carrot' }];
9
- * const grouped = ArrayGroupBy(items, item => item.category);
10
- * // grouped.fruit is [{ category: 'fruit', name: 'apple' }]
14
+ * ArrayGroupBy(items, (item) => item.category);
15
+ * // { fruit: [{ category: 'fruit', name: 'apple' }], vegetable: [{ category: 'vegetable', name: 'carrot' }] }
16
+ *
17
+ * ArrayGroupBy(['one', 'two', 'three'], (s) => s.length);
18
+ * // { 3: ['one', 'two'], 5: ['three'] }
19
+ * ```
11
20
  */
12
21
  export declare function ArrayGroupBy<T, K extends string | number | symbol>(array: T[], keyFn: TTransform<T, K>): Record<K, T[]>;
13
22
  //# sourceMappingURL=array-group-by.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-group-by.d.ts","sourceRoot":"","sources":["../../src/array/array-group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAavH"}
1
+ {"version":3,"file":"array-group-by.d.ts","sourceRoot":"","sources":["../../src/array/array-group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAavH"}
@@ -1,12 +1,21 @@
1
1
  /**
2
2
  * Groups array elements by a key generated by a provided function.
3
- * @param array The array to group.
4
- * @param keyFn TTransform function that returns the grouping key for each element.
5
- * @returns An object with keys as group names and values as arrays of grouped elements.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @template K - The key type (string, number, or symbol)
6
+ * @param array - The array to group
7
+ * @param keyFn - Function that returns the grouping key for each element
8
+ * @returns A record where each key maps to an array of matching elements
9
+ *
6
10
  * @example
11
+ * ```typescript
7
12
  * const items = [{ category: 'fruit', name: 'apple' }, { category: 'vegetable', name: 'carrot' }];
8
- * const grouped = ArrayGroupBy(items, item => item.category);
9
- * // grouped.fruit is [{ category: 'fruit', name: 'apple' }]
13
+ * ArrayGroupBy(items, (item) => item.category);
14
+ * // { fruit: [{ category: 'fruit', name: 'apple' }], vegetable: [{ category: 'vegetable', name: 'carrot' }] }
15
+ *
16
+ * ArrayGroupBy(['one', 'two', 'three'], (s) => s.length);
17
+ * // { 3: ['one', 'two'], 5: ['three'] }
18
+ * ```
10
19
  */
11
20
  export function ArrayGroupBy(array, keyFn) {
12
21
  if (!array) {
@@ -1 +1 @@
1
- {"version":3,"file":"array-group-by.js","sourceRoot":"","sources":["../../src/array/array-group-by.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAwC,KAAU,EAAE,KAAuB;IACtG,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAoB,CAAC;IAC7B,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACjC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACf,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAAoB,CAAC,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"array-group-by.js","sourceRoot":"","sources":["../../src/array/array-group-by.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAAwC,KAAU,EAAE,KAAuB;IACtG,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAoB,CAAC;IAC7B,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACjC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACf,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAAoB,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,8 +1,17 @@
1
1
  /**
2
2
  * Returns a shuffled copy of the array using the Fisher-Yates algorithm.
3
- * @param array The array to shuffle.
4
- * @returns A new shuffled array.
5
- * @note Uses Math.random() not cryptographically secure. Do not use for security-sensitive operations.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The array to shuffle
6
+ * @returns A new shuffled array (original is not mutated)
7
+ *
8
+ * @remarks Uses `Math.random()` — not cryptographically secure. Do not use for
9
+ * security-sensitive operations.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * ArrayShuffle([1, 2, 3, 4, 5]); // e.g. [3, 1, 5, 2, 4]
14
+ * ```
6
15
  */
7
16
  export declare function ArrayShuffle<T>(array: T[]): T[];
8
17
  //# sourceMappingURL=array-shuffle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-shuffle.d.ts","sourceRoot":"","sources":["../../src/array/array-shuffle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAa/C"}
1
+ {"version":3,"file":"array-shuffle.d.ts","sourceRoot":"","sources":["../../src/array/array-shuffle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAa/C"}
@@ -1,8 +1,17 @@
1
1
  /**
2
2
  * Returns a shuffled copy of the array using the Fisher-Yates algorithm.
3
- * @param array The array to shuffle.
4
- * @returns A new shuffled array.
5
- * @note Uses Math.random() not cryptographically secure. Do not use for security-sensitive operations.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The array to shuffle
6
+ * @returns A new shuffled array (original is not mutated)
7
+ *
8
+ * @remarks Uses `Math.random()` — not cryptographically secure. Do not use for
9
+ * security-sensitive operations.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * ArrayShuffle([1, 2, 3, 4, 5]); // e.g. [3, 1, 5, 2, 4]
14
+ * ```
6
15
  */
7
16
  export function ArrayShuffle(array) {
8
17
  if (!array)
@@ -1 +1 @@
1
- {"version":3,"file":"array-shuffle.js","sourceRoot":"","sources":["../../src/array/array-shuffle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAI,KAAU;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAE1B,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAM,CAAC;QAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,IAAS,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"array-shuffle.js","sourceRoot":"","sources":["../../src/array/array-shuffle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAI,KAAU;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAE1B,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAM,CAAC;QAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,IAAS,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -1,8 +1,18 @@
1
1
  /**
2
2
  * Returns a new array with duplicate values removed.
3
- * @param array The input array.
4
- * @returns A new array with unique values.
5
- * @note Uses reference equality for objects. Two distinct objects with identical property values are NOT deduplicated.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The input array
6
+ * @returns A new array containing only unique values (preserves first occurrence order)
7
+ *
8
+ * @remarks Uses reference equality for objects. Two distinct objects with
9
+ * identical property values are **not** considered equal and will both be kept.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * Unique([1, 2, 2, 3, 1]); // [1, 2, 3]
14
+ * Unique(['a', 'b', 'a']); // ['a', 'b']
15
+ * ```
6
16
  */
7
17
  export declare function Unique<T>(array: T[]): T[];
8
18
  //# sourceMappingURL=unique.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../src/array/unique.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAMzC"}
1
+ {"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../src/array/unique.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAMzC"}
@@ -1,8 +1,18 @@
1
1
  /**
2
2
  * Returns a new array with duplicate values removed.
3
- * @param array The input array.
4
- * @returns A new array with unique values.
5
- * @note Uses reference equality for objects. Two distinct objects with identical property values are NOT deduplicated.
3
+ *
4
+ * @template T - The type of array elements
5
+ * @param array - The input array
6
+ * @returns A new array containing only unique values (preserves first occurrence order)
7
+ *
8
+ * @remarks Uses reference equality for objects. Two distinct objects with
9
+ * identical property values are **not** considered equal and will both be kept.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * Unique([1, 2, 2, 3, 1]); // [1, 2, 3]
14
+ * Unique(['a', 'b', 'a']); // ['a', 'b']
15
+ * ```
6
16
  */
7
17
  export function Unique(array) {
8
18
  if (!array) {
@@ -1 +1 @@
1
- {"version":3,"file":"unique.js","sourceRoot":"","sources":["../../src/array/unique.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAI,KAAU;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"file":"unique.js","sourceRoot":"","sources":["../../src/array/unique.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,MAAM,CAAI,KAAU;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,45 +1,129 @@
1
1
  /**
2
- * Base error class for all custom errors
2
+ * Base error class for all custom errors in the assertion library.
3
+ *
4
+ * Extends the built-in `Error` with a machine-readable `Code` string and an
5
+ * optional `Context` bag for structured diagnostic metadata. All other error
6
+ * classes in this module extend `BaseError`.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * class MyError extends BaseError {
11
+ * constructor(message: string) {
12
+ * super(message, 'MY_ERROR');
13
+ * }
14
+ * }
15
+ * throw new MyError('Something went wrong');
16
+ * ```
3
17
  */
4
18
  export declare class BaseError extends Error {
5
19
  readonly Code: string;
6
20
  readonly Context: Record<string, unknown> | undefined;
21
+ /**
22
+ * @param message - Human-readable description of the error
23
+ * @param code - Machine-readable error code (e.g. `'VALIDATION_ERROR'`)
24
+ * @param context - Optional structured metadata for diagnostics
25
+ */
7
26
  constructor(message: string, code: string, context?: Record<string, unknown>);
8
27
  }
9
28
  /**
10
- * Error thrown when validation fails
29
+ * Error thrown when input data fails a validation rule.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * throw new ValidationError('Email address is not valid', { field: 'email' });
34
+ * ```
11
35
  */
12
36
  export declare class ValidationError extends BaseError {
37
+ /**
38
+ * @param message - Description of the validation failure
39
+ * @param context - Optional structured metadata for diagnostics
40
+ */
13
41
  constructor(message: string, context?: Record<string, unknown>);
14
42
  }
15
43
  /**
16
- * Error thrown when a type assertion fails
44
+ * Error thrown when a runtime type assertion fails.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * throw new AssertionError('Expected string but received number');
49
+ * ```
17
50
  */
18
51
  export declare class AssertionError extends BaseError {
52
+ /**
53
+ * @param message - Description of the failed assertion
54
+ * @param context - Optional structured metadata for diagnostics
55
+ */
19
56
  constructor(message: string, context?: Record<string, unknown>);
20
57
  }
21
58
  /**
22
- * Error thrown when an argument is invalid
59
+ * Error thrown when a function argument is invalid.
60
+ * The error message is auto-formatted as
61
+ * `"Invalid argument '<argumentName>': <reason>"`.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * throw new InvalidArgumentError('userId', 'must be a positive integer');
66
+ * // message: "Invalid argument 'userId': must be a positive integer"
67
+ * ```
23
68
  */
24
69
  export declare class InvalidArgumentError extends BaseError {
70
+ /**
71
+ * @param argumentName - Name of the invalid argument
72
+ * @param reason - Explanation of why the argument is invalid
73
+ * @param context - Optional structured metadata for diagnostics
74
+ */
25
75
  constructor(argumentName: string, reason: string, context?: Record<string, unknown>);
26
76
  }
27
77
  /**
28
- * Error thrown when an operation is not supported
78
+ * Error thrown when a requested operation is not supported in the current context.
79
+ * The error message is auto-formatted as `"Operation not supported: <operation>"`.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * throw new NotSupportedError('bulk delete in read-only mode');
84
+ * // message: "Operation not supported: bulk delete in read-only mode"
85
+ * ```
29
86
  */
30
87
  export declare class NotSupportedError extends BaseError {
88
+ /**
89
+ * @param operation - Description of the unsupported operation
90
+ * @param context - Optional structured metadata for diagnostics
91
+ */
31
92
  constructor(operation: string, context?: Record<string, unknown>);
32
93
  }
33
94
  /**
34
- * Error thrown when a required value is not found
95
+ * Error thrown when a required resource or value cannot be found.
96
+ * The error message is auto-formatted as `"Not found: <item>"`.
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * throw new NotFoundError('user with id 42');
101
+ * // message: "Not found: user with id 42"
102
+ * ```
35
103
  */
36
104
  export declare class NotFoundError extends BaseError {
105
+ /**
106
+ * @param item - Description of the resource that was not found
107
+ * @param context - Optional structured metadata for diagnostics
108
+ */
37
109
  constructor(item: string, context?: Record<string, unknown>);
38
110
  }
39
111
  /**
40
- * Error thrown when buffer overflow occurs
112
+ * Error thrown when a buffer or collection exceeds its maximum capacity.
113
+ * The error message is auto-formatted as
114
+ * `"Buffer overflow: maximum size <maxSize> exceeded"`.
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * throw new BufferOverflowError(1000);
119
+ * // message: "Buffer overflow: maximum size 1000 exceeded"
120
+ * ```
41
121
  */
42
122
  export declare class BufferOverflowError extends BaseError {
123
+ /**
124
+ * @param maxSize - The maximum capacity that was exceeded
125
+ * @param context - Optional structured metadata for diagnostics
126
+ */
43
127
  constructor(maxSize: number, context?: Record<string, unknown>);
44
128
  }
45
129
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/asserts/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IACnC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B,SAAgB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;gBAEjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE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,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAS5E;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,SAAS;IAC7C;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG9D;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAC5C;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG9D;AAED;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IAClD;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGnF;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;IAC/C;;;OAGG;gBACS,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGhE;AAED;;;;;;;;;GASG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC3C;;;OAGG;gBACS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG3D;AAED;;;;;;;;;;GAUG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IACjD;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG9D"}
@@ -1,9 +1,28 @@
1
1
  /**
2
- * Base error class for all custom errors
2
+ * Base error class for all custom errors in the assertion library.
3
+ *
4
+ * Extends the built-in `Error` with a machine-readable `Code` string and an
5
+ * optional `Context` bag for structured diagnostic metadata. All other error
6
+ * classes in this module extend `BaseError`.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * class MyError extends BaseError {
11
+ * constructor(message: string) {
12
+ * super(message, 'MY_ERROR');
13
+ * }
14
+ * }
15
+ * throw new MyError('Something went wrong');
16
+ * ```
3
17
  */
4
18
  export class BaseError extends Error {
5
19
  Code;
6
20
  Context;
21
+ /**
22
+ * @param message - Human-readable description of the error
23
+ * @param code - Machine-readable error code (e.g. `'VALIDATION_ERROR'`)
24
+ * @param context - Optional structured metadata for diagnostics
25
+ */
7
26
  constructor(message, code, context) {
8
27
  super(message);
9
28
  this.name = this.constructor.name;
@@ -15,49 +34,114 @@ export class BaseError extends Error {
15
34
  }
16
35
  }
17
36
  /**
18
- * Error thrown when validation fails
37
+ * Error thrown when input data fails a validation rule.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * throw new ValidationError('Email address is not valid', { field: 'email' });
42
+ * ```
19
43
  */
20
44
  export class ValidationError extends BaseError {
45
+ /**
46
+ * @param message - Description of the validation failure
47
+ * @param context - Optional structured metadata for diagnostics
48
+ */
21
49
  constructor(message, context) {
22
50
  super(message, 'VALIDATION_ERROR', context);
23
51
  }
24
52
  }
25
53
  /**
26
- * Error thrown when a type assertion fails
54
+ * Error thrown when a runtime type assertion fails.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * throw new AssertionError('Expected string but received number');
59
+ * ```
27
60
  */
28
61
  export class AssertionError extends BaseError {
62
+ /**
63
+ * @param message - Description of the failed assertion
64
+ * @param context - Optional structured metadata for diagnostics
65
+ */
29
66
  constructor(message, context) {
30
67
  super(message, 'ASSERTION_ERROR', context);
31
68
  }
32
69
  }
33
70
  /**
34
- * Error thrown when an argument is invalid
71
+ * Error thrown when a function argument is invalid.
72
+ * The error message is auto-formatted as
73
+ * `"Invalid argument '<argumentName>': <reason>"`.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * throw new InvalidArgumentError('userId', 'must be a positive integer');
78
+ * // message: "Invalid argument 'userId': must be a positive integer"
79
+ * ```
35
80
  */
36
81
  export class InvalidArgumentError extends BaseError {
82
+ /**
83
+ * @param argumentName - Name of the invalid argument
84
+ * @param reason - Explanation of why the argument is invalid
85
+ * @param context - Optional structured metadata for diagnostics
86
+ */
37
87
  constructor(argumentName, reason, context) {
38
88
  super(`Invalid argument '${argumentName}': ${reason}`, 'INVALID_ARGUMENT', context);
39
89
  }
40
90
  }
41
91
  /**
42
- * Error thrown when an operation is not supported
92
+ * Error thrown when a requested operation is not supported in the current context.
93
+ * The error message is auto-formatted as `"Operation not supported: <operation>"`.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * throw new NotSupportedError('bulk delete in read-only mode');
98
+ * // message: "Operation not supported: bulk delete in read-only mode"
99
+ * ```
43
100
  */
44
101
  export class NotSupportedError extends BaseError {
102
+ /**
103
+ * @param operation - Description of the unsupported operation
104
+ * @param context - Optional structured metadata for diagnostics
105
+ */
45
106
  constructor(operation, context) {
46
107
  super(`Operation not supported: ${operation}`, 'NOT_SUPPORTED', context);
47
108
  }
48
109
  }
49
110
  /**
50
- * Error thrown when a required value is not found
111
+ * Error thrown when a required resource or value cannot be found.
112
+ * The error message is auto-formatted as `"Not found: <item>"`.
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * throw new NotFoundError('user with id 42');
117
+ * // message: "Not found: user with id 42"
118
+ * ```
51
119
  */
52
120
  export class NotFoundError extends BaseError {
121
+ /**
122
+ * @param item - Description of the resource that was not found
123
+ * @param context - Optional structured metadata for diagnostics
124
+ */
53
125
  constructor(item, context) {
54
126
  super(`Not found: ${item}`, 'NOT_FOUND', context);
55
127
  }
56
128
  }
57
129
  /**
58
- * Error thrown when buffer overflow occurs
130
+ * Error thrown when a buffer or collection exceeds its maximum capacity.
131
+ * The error message is auto-formatted as
132
+ * `"Buffer overflow: maximum size <maxSize> exceeded"`.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * throw new BufferOverflowError(1000);
137
+ * // message: "Buffer overflow: maximum size 1000 exceeded"
138
+ * ```
59
139
  */
60
140
  export class BufferOverflowError extends BaseError {
141
+ /**
142
+ * @param maxSize - The maximum capacity that was exceeded
143
+ * @param context - Optional structured metadata for diagnostics
144
+ */
61
145
  constructor(maxSize, context) {
62
146
  super(`Buffer overflow: maximum size ${maxSize} exceeded`, 'BUFFER_OVERFLOW', context);
63
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/asserts/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IACnB,IAAI,CAAS;IAEb,OAAO,CAAsC;IAE7D,YAAY,OAAe,EAAE,IAAY,EAAE,OAAiC;QAC3E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;YACnD,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC;IACF,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC7C,YAAY,OAAe,EAAE,OAAiC;QAC7D,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC5C,YAAY,OAAe,EAAE,OAAiC;QAC7D,KAAK,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAClD,YAAY,YAAoB,EAAE,MAAc,EAAE,OAAiC;QAClF,KAAK,CAAC,qBAAqB,YAAY,MAAM,MAA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IAC7C;;;OAGG;IACH,YAAY,OAAe,EAAE,OAAiC;QAC7D,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC5C;;;OAGG;IACH,YAAY,OAAe,EAAE,OAAiC;QAC7D,KAAK,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACD;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAClD;;;;OAIG;IACH,YAAY,YAAoB,EAAE,MAAc,EAAE,OAAiC;QAClF,KAAK,CAAC,qBAAqB,YAAY,MAAM,MAAM,EAAE,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;CACD;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC/C;;;OAGG;IACH,YAAY,SAAiB,EAAE,OAAiC;QAC/D,KAAK,CAAC,4BAA4B,SAAS,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;CACD;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC3C;;;OAGG;IACH,YAAY,IAAY,EAAE,OAAiC;QAC1D,KAAK,CAAC,cAAc,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACD;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IACjD;;;OAGG;IACH,YAAY,OAAe,EAAE,OAAiC;QAC7D,KAAK,CAAC,iCAAiC,OAAO,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;CACD"}
@@ -5,19 +5,23 @@ import type { IAssertException, TGuard, TValidationPredicate } from './types.js'
5
5
  */
6
6
  export type TConstructorFunction<T = any> = new (...args: any[]) => T;
7
7
  /**
8
- * Error thrown when a value is unexpectedly null or undefined.
8
+ * Error thrown when a nullish assertion fails — the value is not null or undefined
9
+ * but was expected to be. Used by {@link AssertNull} when the provided value is a
10
+ * live (non-null) reference.
9
11
  *
10
12
  * @example
11
- * throw new NotNullError('Value must not be null or undefined');
13
+ * throw new NullError('Expected value to be null or undefined');
12
14
  */
13
15
  export declare class NullError extends Error {
14
16
  constructor(message?: string);
15
17
  }
16
18
  /**
17
- * Error thrown when a value is unexpectedly null or undefined.
19
+ * Error thrown when a non-null assertion fails — the value is null or undefined
20
+ * but was expected to be non-nullish. Used by {@link AssertNotNull} when the
21
+ * provided value is absent.
18
22
  *
19
23
  * @example
20
- * throw new NotNullError('Value must not be null or undefined');
24
+ * throw new NotNullError('Expected a non-null value but received null');
21
25
  */
22
26
  export declare class NotNullError extends Error {
23
27
  constructor(message?: string);
@@ -1 +1 @@
1
- {"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/asserts/generic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMjF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACvB,OAAO,CAAC,EAAE,MAAM;CAK5B;AAED;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAC1B,OAAO,CAAC,EAAE,MAAM;CAK5B;AAED;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC5B,OAAO,CAAC,EAAE,MAAM;CAK5B;AAED;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC5B,OAAO,CAAC,EAAE,MAAM;CAK5B;AAED;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC7B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