@pawells/typescript-common 2.0.0 → 2.1.6
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 +370 -223
- package/{build → dist}/array/array-chunk.d.ts +1 -1
- package/{build → dist}/array/array-chunk.js +2 -3
- package/{build → dist}/array/array-compact.d.ts +1 -1
- package/{build → dist}/array/array-compact.js +1 -2
- package/{build → dist}/array/array-contains.d.ts +1 -1
- package/{build → dist}/array/array-contains.js +2 -3
- package/{build → dist}/array/array-count-by.d.ts +1 -1
- package/{build → dist}/array/array-count-by.js +2 -3
- package/{build → dist}/array/array-difference.d.ts +12 -5
- package/dist/array/array-difference.d.ts.map +1 -0
- package/dist/array/array-difference.js +70 -0
- package/dist/array/array-element.js +1 -0
- package/{build → dist}/array/array-filter.d.ts +1 -1
- package/{build → dist}/array/array-filter.js +1 -2
- package/{build → dist}/array/array-flatten.d.ts +2 -2
- package/{build → dist}/array/array-flatten.d.ts.map +1 -1
- package/{build → dist}/array/array-flatten.js +1 -2
- package/{build → dist}/array/array-group-by.d.ts +1 -1
- package/{build → dist}/array/array-group-by.d.ts.map +1 -1
- package/{build → dist}/array/array-group-by.js +10 -9
- package/{build → dist}/array/array-intersection.d.ts +12 -5
- package/dist/array/array-intersection.d.ts.map +1 -0
- package/dist/array/array-intersection.js +79 -0
- package/{build → dist}/array/array-partition.d.ts +1 -1
- package/{build → dist}/array/array-partition.js +2 -3
- package/{build → dist}/array/array-range.d.ts +1 -1
- package/{build → dist}/array/array-range.js +1 -2
- package/{build → dist}/array/array-sample.d.ts +2 -2
- package/{build → dist}/array/array-sample.js +3 -5
- package/{build → dist}/array/array-shuffle.d.ts +1 -1
- package/{build → dist}/array/array-shuffle.js +1 -2
- package/{build → dist}/array/array-sort-by.d.ts +1 -1
- package/{build → dist}/array/array-sort-by.js +1 -2
- package/{build → dist}/array/array-zip.d.ts +1 -1
- package/{build → dist}/array/array-zip.js +1 -2
- package/{build → dist}/array/assert.d.ts +5 -5
- package/{build → dist}/array/assert.d.ts.map +1 -1
- package/{build → dist}/array/assert.js +13 -14
- package/{build → dist}/array/index.d.ts +1 -0
- package/{build → dist}/array/index.d.ts.map +1 -1
- package/{build → dist}/array/index.js +1 -1
- package/dist/array/iterators.d.ts +40 -0
- package/dist/array/iterators.d.ts.map +1 -0
- package/dist/array/iterators.js +54 -0
- package/{build → dist}/array/types.d.ts +20 -2
- package/{build → dist}/array/types.d.ts.map +1 -1
- package/dist/array/types.js +1 -0
- package/{build → dist}/array/unique.d.ts +1 -1
- package/{build → dist}/array/unique.js +1 -2
- package/dist/asserts/errors.d.ts.map +1 -0
- package/{build → dist}/asserts/errors.js +5 -3
- package/{build → dist}/asserts/generic.d.ts +23 -3
- package/dist/asserts/generic.d.ts.map +1 -0
- package/{build → dist}/asserts/generic.js +39 -7
- package/dist/asserts/index.d.ts +47 -0
- package/dist/asserts/index.d.ts.map +1 -0
- package/dist/asserts/index.js +46 -0
- package/{build → dist}/asserts/internal-utils.d.ts.map +1 -1
- package/{build → dist}/asserts/internal-utils.js +0 -1
- package/{build → dist}/asserts/types.d.ts +56 -17
- package/dist/asserts/types.d.ts.map +1 -0
- package/dist/asserts/types.js +1 -0
- package/{build → dist}/asserts/utils.d.ts +5 -21
- package/dist/asserts/utils.d.ts.map +1 -0
- package/{build → dist}/asserts/utils.js +14 -39
- package/{build → dist}/boolean/assert.d.ts +1 -2
- package/{build → dist}/boolean/assert.d.ts.map +1 -1
- package/{build → dist}/boolean/assert.js +1 -3
- package/dist/boolean/index.d.ts +13 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +12 -0
- package/{build → dist}/enum/enum-entries.d.ts +1 -1
- package/dist/enum/enum-entries.d.ts.map +1 -0
- package/{build → dist}/enum/enum-entries.js +0 -1
- package/{build → dist}/enum/enum-key-by-value.d.ts +1 -1
- package/dist/enum/enum-key-by-value.d.ts.map +1 -0
- package/{build → dist}/enum/enum-key-by-value.js +0 -1
- package/{build → dist}/enum/enum-keys.js +0 -1
- package/{build → dist}/enum/enum-safe-value.d.ts +1 -1
- package/dist/enum/enum-safe-value.d.ts.map +1 -0
- package/{build → dist}/enum/enum-safe-value.js +0 -1
- package/{build → dist}/enum/enum-values.js +0 -1
- package/{build → dist}/enum/index.d.ts +1 -1
- package/dist/enum/index.d.ts.map +1 -0
- package/{build → dist}/enum/index.js +1 -2
- package/dist/enum/types.js +1 -0
- package/{build → dist}/enum/validate-enum-value.d.ts +1 -1
- package/dist/enum/validate-enum-value.d.ts.map +1 -0
- package/{build → dist}/enum/validate-enum-value.js +0 -1
- package/{build → dist}/function/compose.d.ts +6 -0
- package/dist/function/compose.d.ts.map +1 -0
- package/{build → dist}/function/compose.js +0 -1
- package/{build → dist}/function/debounce.d.ts +6 -0
- package/dist/function/debounce.d.ts.map +1 -0
- package/{build → dist}/function/debounce.js +6 -1
- package/{build → dist}/function/index.js +0 -1
- package/dist/function/memoize.d.ts +56 -0
- package/dist/function/memoize.d.ts.map +1 -0
- package/dist/function/memoize.js +72 -0
- package/{build → dist}/function/once.d.ts.map +1 -1
- package/{build → dist}/function/once.js +1 -1
- package/{build → dist}/function/sleep.js +0 -1
- package/{build → dist}/function/throttle.d.ts +7 -0
- package/dist/function/throttle.d.ts.map +1 -0
- package/{build → dist}/function/throttle.js +7 -1
- package/dist/function/types.d.ts +18 -0
- package/dist/function/types.d.ts.map +1 -0
- package/dist/function/types.js +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/json.sanitization.d.ts +14 -0
- package/dist/json.sanitization.d.ts.map +1 -0
- package/dist/json.sanitization.js +37 -0
- package/{build → dist}/lru-cache.d.ts +19 -0
- package/dist/lru-cache.d.ts.map +1 -0
- package/{build → dist}/lru-cache.js +24 -2
- package/{build → dist}/number/assert.js +0 -1
- package/dist/number/index.d.ts +13 -0
- package/dist/number/index.d.ts.map +1 -0
- package/dist/number/index.js +12 -0
- package/{build → dist}/object/assert-object.d.ts +5 -1
- package/{build → dist}/object/assert-object.d.ts.map +1 -1
- package/{build → dist}/object/assert-object.js +4 -1
- package/{build → dist}/object/assert.d.ts +1 -1
- package/dist/object/assert.d.ts.map +1 -0
- package/{build → dist}/object/assert.js +7 -29
- package/{build → dist}/object/clone.d.ts +6 -0
- package/dist/object/clone.d.ts.map +1 -0
- package/{build → dist}/object/clone.js +14 -5
- package/{build → dist}/object/equals.d.ts.map +1 -1
- package/{build → dist}/object/equals.js +3 -7
- package/dist/object/filter-cached.d.ts +26 -0
- package/{build → dist}/object/filter-cached.d.ts.map +1 -1
- package/{build → dist}/object/filter-cached.js +27 -6
- package/{build → dist}/object/filter.d.ts.map +1 -1
- package/{build → dist}/object/filter.js +22 -6
- package/{build → dist}/object/has-circular-reference.d.ts.map +1 -1
- package/{build → dist}/object/has-circular-reference.js +4 -2
- package/{build → dist}/object/hash.d.ts +4 -0
- package/dist/object/hash.d.ts.map +1 -0
- package/{build → dist}/object/hash.js +20 -7
- package/{build → dist}/object/index.d.ts +2 -2
- package/{build → dist}/object/index.d.ts.map +1 -1
- package/{build → dist}/object/index.js +1 -2
- package/{build → dist}/object/json-circular-replacer.d.ts.map +1 -1
- package/{build → dist}/object/json-circular-replacer.js +0 -1
- package/{build → dist}/object/key-value-pairs.js +0 -1
- package/dist/object/map-cached.d.ts +31 -0
- package/dist/object/map-cached.d.ts.map +1 -0
- package/{build → dist}/object/map-cached.js +34 -6
- package/{build → dist}/object/map.js +0 -1
- package/{build → dist}/object/merge.d.ts.map +1 -1
- package/{build → dist}/object/merge.js +7 -7
- package/{build → dist}/object/object-diff.d.ts +2 -2
- package/{build → dist}/object/object-diff.d.ts.map +1 -1
- package/{build → dist}/object/object-diff.js +11 -5
- package/{build → dist}/object/object-flatten.d.ts +1 -1
- package/{build → dist}/object/object-flatten.d.ts.map +1 -1
- package/{build → dist}/object/object-flatten.js +10 -4
- package/{build → dist}/object/object-invert.js +0 -1
- package/{build → dist}/object/omit.js +0 -1
- package/{build → dist}/object/pick.js +0 -1
- package/{build → dist}/object/property-paths.d.ts +2 -0
- package/{build → dist}/object/property-paths.d.ts.map +1 -1
- package/{build → dist}/object/property-paths.js +8 -7
- package/dist/object/security-utils.d.ts +193 -0
- package/dist/object/security-utils.d.ts.map +1 -0
- package/dist/object/security-utils.js +304 -0
- package/{build → dist}/object/sort-keys.d.ts +15 -1
- package/dist/object/sort-keys.d.ts.map +1 -0
- package/dist/object/sort-keys.js +73 -0
- package/{build → dist}/object/types.d.ts +0 -61
- package/dist/object/types.d.ts.map +1 -0
- package/dist/object/types.js +1 -0
- package/{build → dist}/string/assert.d.ts +24 -0
- package/dist/string/assert.d.ts.map +1 -0
- package/{build → dist}/string/assert.js +30 -1
- package/{build → dist}/string/case-conversion.js +0 -1
- package/{build → dist}/string/comparison.d.ts.map +1 -1
- package/{build → dist}/string/comparison.js +3 -1
- package/{build → dist}/string/formatting.d.ts.map +1 -1
- package/{build → dist}/string/formatting.js +5 -3
- package/{build → dist}/string/index.js +0 -1
- package/{build → dist}/string/transformation.js +0 -1
- package/dist/string/types.d.ts +118 -0
- package/dist/string/types.d.ts.map +1 -0
- package/dist/string/types.js +1 -0
- package/{build → dist}/string/validation.js +0 -1
- package/dist/time/elapsed-time/constants.d.ts +36 -0
- package/{build → dist}/time/elapsed-time/constants.d.ts.map +1 -1
- package/{build → dist}/time/elapsed-time/constants.js +32 -3
- package/{build → dist}/time/elapsed-time/elapsed-time.d.ts +74 -22
- package/dist/time/elapsed-time/elapsed-time.d.ts.map +1 -0
- package/{build → dist}/time/elapsed-time/elapsed-time.js +183 -89
- package/dist/time/elapsed-time/types.d.ts +336 -0
- package/dist/time/elapsed-time/types.d.ts.map +1 -0
- package/dist/time/elapsed-time/types.js +1 -0
- package/{build → dist}/time/elapsed-time/utils.d.ts +1 -1
- package/dist/time/elapsed-time/utils.d.ts.map +1 -0
- package/{build → dist}/time/elapsed-time/utils.js +0 -1
- package/dist/time/index.d.ts +14 -0
- package/dist/time/index.d.ts.map +1 -0
- package/{build → dist}/time/index.js +0 -5
- package/{build → dist}/time/stopwatch/entry.d.ts +1 -1
- package/dist/time/stopwatch/entry.d.ts.map +1 -0
- package/{build → dist}/time/stopwatch/entry.js +0 -1
- package/{build → dist}/time/stopwatch/stopwatch.d.ts +27 -3
- package/dist/time/stopwatch/stopwatch.d.ts.map +1 -0
- package/{build → dist}/time/stopwatch/stopwatch.js +32 -4
- package/dist/zod-util.d.ts +145 -0
- package/dist/zod-util.d.ts.map +1 -0
- package/dist/zod-util.js +126 -0
- package/package.json +51 -67
- package/LICENSE +0 -21
- package/build/array/array-chunk.js.map +0 -1
- package/build/array/array-compact.js.map +0 -1
- package/build/array/array-contains.js.map +0 -1
- package/build/array/array-count-by.js.map +0 -1
- package/build/array/array-difference.d.ts.map +0 -1
- package/build/array/array-difference.js +0 -51
- package/build/array/array-difference.js.map +0 -1
- package/build/array/array-element.js +0 -2
- package/build/array/array-element.js.map +0 -1
- package/build/array/array-filter.js.map +0 -1
- package/build/array/array-flatten.js.map +0 -1
- package/build/array/array-group-by.js.map +0 -1
- package/build/array/array-intersection.d.ts.map +0 -1
- package/build/array/array-intersection.js +0 -57
- package/build/array/array-intersection.js.map +0 -1
- package/build/array/array-partition.js.map +0 -1
- package/build/array/array-range.js.map +0 -1
- package/build/array/array-sample.js.map +0 -1
- package/build/array/array-shuffle.js.map +0 -1
- package/build/array/array-sort-by.js.map +0 -1
- package/build/array/array-zip.js.map +0 -1
- package/build/array/assert.js.map +0 -1
- package/build/array/index.js.map +0 -1
- package/build/array/types.js +0 -2
- package/build/array/types.js.map +0 -1
- package/build/array/unique.js.map +0 -1
- package/build/asserts/errors.d.ts.map +0 -1
- package/build/asserts/errors.js.map +0 -1
- package/build/asserts/generic.d.ts.map +0 -1
- package/build/asserts/generic.js.map +0 -1
- package/build/asserts/index.d.ts +0 -41
- package/build/asserts/index.d.ts.map +0 -1
- package/build/asserts/index.js +0 -41
- package/build/asserts/index.js.map +0 -1
- package/build/asserts/internal-utils.js.map +0 -1
- package/build/asserts/types.d.ts.map +0 -1
- package/build/asserts/types.js +0 -2
- package/build/asserts/types.js.map +0 -1
- package/build/asserts/utils.d.ts.map +0 -1
- package/build/asserts/utils.js.map +0 -1
- package/build/boolean/assert.js.map +0 -1
- package/build/boolean/index.d.ts +0 -9
- package/build/boolean/index.d.ts.map +0 -1
- package/build/boolean/index.js +0 -9
- package/build/boolean/index.js.map +0 -1
- package/build/enum/enum-entries.d.ts.map +0 -1
- package/build/enum/enum-entries.js.map +0 -1
- package/build/enum/enum-key-by-value.d.ts.map +0 -1
- package/build/enum/enum-key-by-value.js.map +0 -1
- package/build/enum/enum-keys.js.map +0 -1
- package/build/enum/enum-safe-value.d.ts.map +0 -1
- package/build/enum/enum-safe-value.js.map +0 -1
- package/build/enum/enum-values.js.map +0 -1
- package/build/enum/index.d.ts.map +0 -1
- package/build/enum/index.js.map +0 -1
- package/build/enum/types.js +0 -2
- package/build/enum/types.js.map +0 -1
- package/build/enum/validate-enum-value.d.ts.map +0 -1
- package/build/enum/validate-enum-value.js.map +0 -1
- package/build/function/compose.d.ts.map +0 -1
- package/build/function/compose.js.map +0 -1
- package/build/function/debounce.d.ts.map +0 -1
- package/build/function/debounce.js.map +0 -1
- package/build/function/index.js.map +0 -1
- package/build/function/memoize.d.ts +0 -30
- package/build/function/memoize.d.ts.map +0 -1
- package/build/function/memoize.js +0 -44
- package/build/function/memoize.js.map +0 -1
- package/build/function/once.js.map +0 -1
- package/build/function/sleep.js.map +0 -1
- package/build/function/throttle.d.ts.map +0 -1
- package/build/function/throttle.js.map +0 -1
- package/build/function/types.d.ts +0 -5
- package/build/function/types.d.ts.map +0 -1
- package/build/function/types.js +0 -2
- package/build/function/types.js.map +0 -1
- package/build/index.d.ts +0 -38
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -64
- package/build/index.js.map +0 -1
- package/build/lru-cache.d.ts.map +0 -1
- package/build/lru-cache.js.map +0 -1
- package/build/number/assert.js.map +0 -1
- package/build/number/index.d.ts +0 -9
- package/build/number/index.d.ts.map +0 -1
- package/build/number/index.js +0 -9
- package/build/number/index.js.map +0 -1
- package/build/object/assert-object.js.map +0 -1
- package/build/object/assert.d.ts.map +0 -1
- package/build/object/assert.js.map +0 -1
- package/build/object/clone.d.ts.map +0 -1
- package/build/object/clone.js.map +0 -1
- package/build/object/equals.js.map +0 -1
- package/build/object/filter-cached.d.ts +0 -21
- package/build/object/filter-cached.js.map +0 -1
- package/build/object/filter.js.map +0 -1
- package/build/object/has-circular-reference.js.map +0 -1
- package/build/object/hash.d.ts.map +0 -1
- package/build/object/hash.js.map +0 -1
- package/build/object/index.js.map +0 -1
- package/build/object/json-circular-replacer.js.map +0 -1
- package/build/object/key-value-pairs.js.map +0 -1
- package/build/object/map-cached.d.ts +0 -20
- package/build/object/map-cached.d.ts.map +0 -1
- package/build/object/map-cached.js.map +0 -1
- package/build/object/map.js.map +0 -1
- package/build/object/merge.js.map +0 -1
- package/build/object/object-diff.js.map +0 -1
- package/build/object/object-flatten.js.map +0 -1
- package/build/object/object-invert.js.map +0 -1
- package/build/object/omit.js.map +0 -1
- package/build/object/pick.js.map +0 -1
- package/build/object/property-paths.js.map +0 -1
- package/build/object/security-utils.d.ts +0 -59
- package/build/object/security-utils.d.ts.map +0 -1
- package/build/object/security-utils.js +0 -161
- package/build/object/security-utils.js.map +0 -1
- package/build/object/sort-keys.d.ts.map +0 -1
- package/build/object/sort-keys.js +0 -52
- package/build/object/sort-keys.js.map +0 -1
- package/build/object/types.d.ts.map +0 -1
- package/build/object/types.js +0 -6
- package/build/object/types.js.map +0 -1
- package/build/string/assert.d.ts.map +0 -1
- package/build/string/assert.js.map +0 -1
- package/build/string/case-conversion.js.map +0 -1
- package/build/string/comparison.js.map +0 -1
- package/build/string/formatting.js.map +0 -1
- package/build/string/index.js.map +0 -1
- package/build/string/transformation.js.map +0 -1
- package/build/string/types.d.ts +0 -44
- package/build/string/types.d.ts.map +0 -1
- package/build/string/types.js +0 -2
- package/build/string/types.js.map +0 -1
- package/build/string/validation.js.map +0 -1
- package/build/time/elapsed-time/constants.d.ts +0 -10
- package/build/time/elapsed-time/constants.js.map +0 -1
- package/build/time/elapsed-time/elapsed-time.d.ts.map +0 -1
- package/build/time/elapsed-time/elapsed-time.js.map +0 -1
- package/build/time/elapsed-time/types.d.ts +0 -150
- package/build/time/elapsed-time/types.d.ts.map +0 -1
- package/build/time/elapsed-time/types.js +0 -2
- package/build/time/elapsed-time/types.js.map +0 -1
- package/build/time/elapsed-time/utils.d.ts.map +0 -1
- package/build/time/elapsed-time/utils.js.map +0 -1
- package/build/time/index.d.ts +0 -18
- package/build/time/index.d.ts.map +0 -1
- package/build/time/index.js.map +0 -1
- package/build/time/stopwatch/entry-types.d.ts +0 -13
- package/build/time/stopwatch/entry-types.d.ts.map +0 -1
- package/build/time/stopwatch/entry-types.js +0 -2
- package/build/time/stopwatch/entry-types.js.map +0 -1
- package/build/time/stopwatch/entry.d.ts.map +0 -1
- package/build/time/stopwatch/entry.js.map +0 -1
- package/build/time/stopwatch/stopwatch.d.ts.map +0 -1
- package/build/time/stopwatch/stopwatch.js.map +0 -1
- /package/{build → dist}/array/array-chunk.d.ts.map +0 -0
- /package/{build → dist}/array/array-compact.d.ts.map +0 -0
- /package/{build → dist}/array/array-contains.d.ts.map +0 -0
- /package/{build → dist}/array/array-count-by.d.ts.map +0 -0
- /package/{build → dist}/array/array-element.d.ts +0 -0
- /package/{build → dist}/array/array-element.d.ts.map +0 -0
- /package/{build → dist}/array/array-filter.d.ts.map +0 -0
- /package/{build → dist}/array/array-partition.d.ts.map +0 -0
- /package/{build → dist}/array/array-range.d.ts.map +0 -0
- /package/{build → dist}/array/array-sample.d.ts.map +0 -0
- /package/{build → dist}/array/array-shuffle.d.ts.map +0 -0
- /package/{build → dist}/array/array-sort-by.d.ts.map +0 -0
- /package/{build → dist}/array/array-zip.d.ts.map +0 -0
- /package/{build → dist}/array/unique.d.ts.map +0 -0
- /package/{build → dist}/asserts/errors.d.ts +0 -0
- /package/{build → dist}/asserts/internal-utils.d.ts +0 -0
- /package/{build → dist}/enum/enum-keys.d.ts +0 -0
- /package/{build → dist}/enum/enum-keys.d.ts.map +0 -0
- /package/{build → dist}/enum/enum-values.d.ts +0 -0
- /package/{build → dist}/enum/enum-values.d.ts.map +0 -0
- /package/{build → dist}/enum/types.d.ts +0 -0
- /package/{build → dist}/enum/types.d.ts.map +0 -0
- /package/{build → dist}/function/index.d.ts +0 -0
- /package/{build → dist}/function/index.d.ts.map +0 -0
- /package/{build → dist}/function/once.d.ts +0 -0
- /package/{build → dist}/function/sleep.d.ts +0 -0
- /package/{build → dist}/function/sleep.d.ts.map +0 -0
- /package/{build → dist}/number/assert.d.ts +0 -0
- /package/{build → dist}/number/assert.d.ts.map +0 -0
- /package/{build → dist}/object/equals.d.ts +0 -0
- /package/{build → dist}/object/filter.d.ts +0 -0
- /package/{build → dist}/object/has-circular-reference.d.ts +0 -0
- /package/{build → dist}/object/json-circular-replacer.d.ts +0 -0
- /package/{build → dist}/object/key-value-pairs.d.ts +0 -0
- /package/{build → dist}/object/key-value-pairs.d.ts.map +0 -0
- /package/{build → dist}/object/map.d.ts +0 -0
- /package/{build → dist}/object/map.d.ts.map +0 -0
- /package/{build → dist}/object/merge.d.ts +0 -0
- /package/{build → dist}/object/object-invert.d.ts +0 -0
- /package/{build → dist}/object/object-invert.d.ts.map +0 -0
- /package/{build → dist}/object/omit.d.ts +0 -0
- /package/{build → dist}/object/omit.d.ts.map +0 -0
- /package/{build → dist}/object/pick.d.ts +0 -0
- /package/{build → dist}/object/pick.d.ts.map +0 -0
- /package/{build → dist}/string/case-conversion.d.ts +0 -0
- /package/{build → dist}/string/case-conversion.d.ts.map +0 -0
- /package/{build → dist}/string/comparison.d.ts +0 -0
- /package/{build → dist}/string/formatting.d.ts +0 -0
- /package/{build → dist}/string/index.d.ts +0 -0
- /package/{build → dist}/string/index.d.ts.map +0 -0
- /package/{build → dist}/string/transformation.d.ts +0 -0
- /package/{build → dist}/string/transformation.d.ts.map +0 -0
- /package/{build → dist}/string/validation.d.ts +0 -0
- /package/{build → dist}/string/validation.d.ts.map +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* The result length is capped at the shortest input array.
|
|
4
4
|
*
|
|
5
5
|
* @param arrays - Two or more arrays to zip
|
|
6
|
-
* @returns Array of tuples — one tuple per index position
|
|
6
|
+
* @returns Array of tuples — one tuple per index position. Returns `[]` if `arrays` is empty or if any input array is `null` or `undefined`.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
@@ -22,4 +22,3 @@ export function ArrayZip(...arrays) {
|
|
|
22
22
|
const minLen = Math.min(...arrays.map((a) => a.length));
|
|
23
23
|
return Array.from({ length: minLen }, (_, i) => arrays.map((a) => a[i]));
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=array-zip.js.map
|
|
@@ -59,7 +59,7 @@ export interface IAssertArray2DArgs {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Asserts that a value is an array, optionally validating its size.
|
|
62
|
-
* @template T The type of array elements.
|
|
62
|
+
* @template T - The type of array elements.
|
|
63
63
|
* @param value - The value to validate.
|
|
64
64
|
* @param args - Optional size constraints.
|
|
65
65
|
* @param exception - Optional custom exception to throw.
|
|
@@ -68,7 +68,7 @@ export interface IAssertArray2DArgs {
|
|
|
68
68
|
export declare function AssertArray<T = unknown>(value: unknown, args?: IAssertArrayArgs, exception?: IAssertException): asserts value is T[];
|
|
69
69
|
/**
|
|
70
70
|
* Asserts that a value is a 2D array, optionally validating its dimensions.
|
|
71
|
-
* @template T The type of array elements.
|
|
71
|
+
* @template T - The type of array elements.
|
|
72
72
|
* @param value - The value to validate.
|
|
73
73
|
* @param args - Optional dimension constraints.
|
|
74
74
|
* @param exception - Optional custom exception to throw.
|
|
@@ -77,7 +77,7 @@ export declare function AssertArray<T = unknown>(value: unknown, args?: IAssertA
|
|
|
77
77
|
export declare function AssertArray2D<T = unknown>(value: unknown, args?: IAssertArray2DArgs, exception?: IAssertException): asserts value is T[][];
|
|
78
78
|
/**
|
|
79
79
|
* Asserts that an array is not empty.
|
|
80
|
-
* @template T The type of array elements.
|
|
80
|
+
* @template T - The type of array elements.
|
|
81
81
|
* @param value - The array to validate.
|
|
82
82
|
* @param exception - Optional custom exception to throw.
|
|
83
83
|
* @throws {ArrayError} If the array is empty.
|
|
@@ -89,7 +89,7 @@ export declare function AssertArrayNotEmpty<T>(value: T[] | unknown, exception?:
|
|
|
89
89
|
* Uses `array.every()` to check if all elements satisfy the predicate condition.
|
|
90
90
|
* Throws an error if any element fails the test.
|
|
91
91
|
*
|
|
92
|
-
* @template T The type of array elements.
|
|
92
|
+
* @template T - The type of array elements.
|
|
93
93
|
* @param array - The array to validate.
|
|
94
94
|
* @param predicate - A function to test each element.
|
|
95
95
|
* @param exception - Optional custom exception to throw.
|
|
@@ -102,7 +102,7 @@ export declare function AssertArrayAll<T>(array: T[], predicate: (el: T, idx: nu
|
|
|
102
102
|
* Uses `array.some()` to check if any element satisfies the predicate condition.
|
|
103
103
|
* Throws an error if no elements pass the test.
|
|
104
104
|
*
|
|
105
|
-
* @template T The type of array elements.
|
|
105
|
+
* @template T - The type of array elements.
|
|
106
106
|
* @param array - The array to validate.
|
|
107
107
|
* @param predicate - A function to test each element.
|
|
108
108
|
* @param exception - Optional custom exception to throw.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/array/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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KAAK,IAAI,CAAC,EAAE,EAAE,CAqElJ;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,EAAE,CAYnH;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAO1I;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAO1I"}
|
|
@@ -13,7 +13,7 @@ export class ArrayError extends SimpleError {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Asserts that a value is an array, optionally validating its size.
|
|
16
|
-
* @template T The type of array elements.
|
|
16
|
+
* @template T - The type of array elements.
|
|
17
17
|
* @param value - The value to validate.
|
|
18
18
|
* @param args - Optional size constraints.
|
|
19
19
|
* @param exception - Optional custom exception to throw.
|
|
@@ -44,7 +44,7 @@ export function AssertArray(value, args, exception = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Asserts that a value is a 2D array, optionally validating its dimensions.
|
|
47
|
-
* @template T The type of array elements.
|
|
47
|
+
* @template T - The type of array elements.
|
|
48
48
|
* @param value - The value to validate.
|
|
49
49
|
* @param args - Optional dimension constraints.
|
|
50
50
|
* @param exception - Optional custom exception to throw.
|
|
@@ -57,14 +57,14 @@ export function AssertArray2D(value, args = {}, exception = {}) {
|
|
|
57
57
|
AssertValueType(value, 'array', exception);
|
|
58
58
|
// Type cast is safe after array validation
|
|
59
59
|
const array = value;
|
|
60
|
-
// Validate that all elements are arrays (making it 2D)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
// Validate that all elements are arrays (making it 2D) with single-pass collection of invalid positions
|
|
61
|
+
const invalidPositions = [];
|
|
62
|
+
for (let i = 0; i < array.length; i++) {
|
|
63
|
+
if (!Array.isArray(array[i])) {
|
|
64
|
+
invalidPositions.push(i);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (invalidPositions.length > 0) {
|
|
68
68
|
SetExceptionMessage(exception, `Expected 2D array but found non-array elements at positions: ${invalidPositions.join(', ')}`);
|
|
69
69
|
ThrowException(exception);
|
|
70
70
|
}
|
|
@@ -111,7 +111,7 @@ export function AssertArray2D(value, args = {}, exception = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* Asserts that an array is not empty.
|
|
114
|
-
* @template T The type of array elements.
|
|
114
|
+
* @template T - The type of array elements.
|
|
115
115
|
* @param value - The array to validate.
|
|
116
116
|
* @param exception - Optional custom exception to throw.
|
|
117
117
|
* @throws {ArrayError} If the array is empty.
|
|
@@ -141,7 +141,7 @@ function assertIsArray(array, exception) {
|
|
|
141
141
|
* Uses `array.every()` to check if all elements satisfy the predicate condition.
|
|
142
142
|
* Throws an error if any element fails the test.
|
|
143
143
|
*
|
|
144
|
-
* @template T The type of array elements.
|
|
144
|
+
* @template T - The type of array elements.
|
|
145
145
|
* @param array - The array to validate.
|
|
146
146
|
* @param predicate - A function to test each element.
|
|
147
147
|
* @param exception - Optional custom exception to throw.
|
|
@@ -161,7 +161,7 @@ export function AssertArrayAll(array, predicate, exception = {}) {
|
|
|
161
161
|
* Uses `array.some()` to check if any element satisfies the predicate condition.
|
|
162
162
|
* Throws an error if no elements pass the test.
|
|
163
163
|
*
|
|
164
|
-
* @template T The type of array elements.
|
|
164
|
+
* @template T - The type of array elements.
|
|
165
165
|
* @param array - The array to validate.
|
|
166
166
|
* @param predicate - A function to test each element.
|
|
167
167
|
* @param exception - Optional custom exception to throw.
|
|
@@ -175,4 +175,3 @@ export function AssertArrayAny(array, predicate, exception = {}) {
|
|
|
175
175
|
ThrowException(exception);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
//# sourceMappingURL=assert.js.map
|
|
@@ -25,4 +25,5 @@ export * from './array-sample.js';
|
|
|
25
25
|
export type * from './array-element.js';
|
|
26
26
|
export type { TPredicate, TTransform, TComparator, TEqualityComparator } from './types.js';
|
|
27
27
|
export * from './assert.js';
|
|
28
|
+
export * from './iterators.js';
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,mBAAmB,oBAAoB,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3F,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,mBAAmB,oBAAoB,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3F,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async generator function that filters array elements based on a predicate and optional filter criteria.
|
|
3
|
+
*
|
|
4
|
+
* Yields only elements that pass both the optional validator function and the filter criteria object.
|
|
5
|
+
* This is useful for streaming large datasets through memory-efficient async iteration.
|
|
6
|
+
*
|
|
7
|
+
* @template TObject The type of elements in the iterator
|
|
8
|
+
* @template TArgs The type of filter criteria object (extends Record<string, unknown>)
|
|
9
|
+
*
|
|
10
|
+
* @param iterator The async iterable to filter
|
|
11
|
+
* @param args Optional filter criteria object; if provided, only elements matching all criteria are yielded
|
|
12
|
+
* @param validator Optional predicate function returning true for elements to keep; called before filter criteria
|
|
13
|
+
*
|
|
14
|
+
* @returns {AsyncGenerator<TObject, void, unknown>} Async generator that yields filtered elements
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Elements are evaluated one at a time without batching. The validator is applied first; if it rejects
|
|
18
|
+
* an element, the filter criteria are not evaluated. If no args are provided, all elements (passing the
|
|
19
|
+
* validator if present) are passed through unchanged.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* async function* items() {
|
|
23
|
+
* yield { id: 1, status: 'active' };
|
|
24
|
+
* yield { id: 2, status: 'inactive' };
|
|
25
|
+
* yield { id: 3, status: 'active' };
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* for await (const item of FilteredIterator(items(), { status: 'active' })) {
|
|
29
|
+
* console.log(item); // Only logs items with status: 'active'
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* for await (const item of FilteredIterator(items(), undefined, (obj) => obj.id > 1)) {
|
|
34
|
+
* console.log(item); // Only logs items with id > 1
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* @throws {TypeError} if iterator is null or undefined
|
|
38
|
+
*/
|
|
39
|
+
export declare function FilteredIterator<TObject, TArgs extends Record<string, unknown>>(iterator: AsyncIterable<TObject>, args?: TArgs, validator?: (obj: TObject) => boolean): AsyncGenerator<TObject, void, unknown>;
|
|
40
|
+
//# sourceMappingURL=iterators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterators.d.ts","sourceRoot":"","sources":["../../src/array/iterators.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAuB,gBAAgB,CAAC,OAAO,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAcrN"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ObjectFilter } from '../object/filter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Async generator function that filters array elements based on a predicate and optional filter criteria.
|
|
4
|
+
*
|
|
5
|
+
* Yields only elements that pass both the optional validator function and the filter criteria object.
|
|
6
|
+
* This is useful for streaming large datasets through memory-efficient async iteration.
|
|
7
|
+
*
|
|
8
|
+
* @template TObject The type of elements in the iterator
|
|
9
|
+
* @template TArgs The type of filter criteria object (extends Record<string, unknown>)
|
|
10
|
+
*
|
|
11
|
+
* @param iterator The async iterable to filter
|
|
12
|
+
* @param args Optional filter criteria object; if provided, only elements matching all criteria are yielded
|
|
13
|
+
* @param validator Optional predicate function returning true for elements to keep; called before filter criteria
|
|
14
|
+
*
|
|
15
|
+
* @returns {AsyncGenerator<TObject, void, unknown>} Async generator that yields filtered elements
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Elements are evaluated one at a time without batching. The validator is applied first; if it rejects
|
|
19
|
+
* an element, the filter criteria are not evaluated. If no args are provided, all elements (passing the
|
|
20
|
+
* validator if present) are passed through unchanged.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* async function* items() {
|
|
24
|
+
* yield { id: 1, status: 'active' };
|
|
25
|
+
* yield { id: 2, status: 'inactive' };
|
|
26
|
+
* yield { id: 3, status: 'active' };
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* for await (const item of FilteredIterator(items(), { status: 'active' })) {
|
|
30
|
+
* console.log(item); // Only logs items with status: 'active'
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* for await (const item of FilteredIterator(items(), undefined, (obj) => obj.id > 1)) {
|
|
35
|
+
* console.log(item); // Only logs items with id > 1
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* @throws {TypeError} if iterator is null or undefined
|
|
39
|
+
*/
|
|
40
|
+
export async function* FilteredIterator(iterator, args, validator) {
|
|
41
|
+
for await (const obj of iterator) {
|
|
42
|
+
// Validate entity before filtering/yielding
|
|
43
|
+
if (validator && !validator(obj))
|
|
44
|
+
continue;
|
|
45
|
+
// If no filter args provided, pass through all events
|
|
46
|
+
if (!args || typeof args !== 'object' || Object.keys(args).length === 0) {
|
|
47
|
+
yield obj;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// Apply filter criteria
|
|
51
|
+
if (ObjectFilter(obj, args))
|
|
52
|
+
yield obj;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -35,9 +35,27 @@ export type TEqualityComparator<T> = (a: T, b: T) => boolean;
|
|
|
35
35
|
*
|
|
36
36
|
* @template T - The type of array elements
|
|
37
37
|
*/
|
|
38
|
+
/**
|
|
39
|
+
* Comparison options for array operations.
|
|
40
|
+
*
|
|
41
|
+
* Provides a discriminated union where callers must choose exactly one strategy:
|
|
42
|
+
* - `comparator`: Custom equality function for specialized comparison logic
|
|
43
|
+
* - `useDeepEqual`: Deep structural equality checking
|
|
44
|
+
* - `keyFn`: Function to extract a primitive key for O(n+m) Set-based lookup
|
|
45
|
+
*
|
|
46
|
+
* Mutually exclusive at compile time via `never` literals.
|
|
47
|
+
*/
|
|
38
48
|
export type TArrayComparisonOptions<T> = {
|
|
39
|
-
comparator
|
|
49
|
+
comparator: TEqualityComparator<T>;
|
|
50
|
+
useDeepEqual?: never;
|
|
51
|
+
keyFn?: never;
|
|
52
|
+
} | {
|
|
53
|
+
useDeepEqual: true;
|
|
54
|
+
comparator?: never;
|
|
55
|
+
keyFn?: never;
|
|
40
56
|
} | {
|
|
41
|
-
|
|
57
|
+
keyFn: (item: T) => unknown;
|
|
58
|
+
comparator?: never;
|
|
59
|
+
useDeepEqual?: never;
|
|
42
60
|
};
|
|
43
61
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/array/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM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AAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC3E;IAAE,YAAY,EAAE,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACzD;IAAE,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @template T - The type of array elements
|
|
7
7
|
* @param array - The input array
|
|
8
|
-
* @returns A new array containing only unique values (preserves first occurrence order)
|
|
8
|
+
* @returns A new array containing only unique values (preserves first occurrence order). Returns `[]` if `array` is `null`, `undefined`, or empty.
|
|
9
9
|
*
|
|
10
10
|
* @remarks Uses reference equality for objects. Two distinct objects with
|
|
11
11
|
* identical property values are **not** considered equal and will both be kept.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @template T - The type of array elements
|
|
7
7
|
* @param array - The input array
|
|
8
|
-
* @returns A new array containing only unique values (preserves first occurrence order)
|
|
8
|
+
* @returns A new array containing only unique values (preserves first occurrence order). Returns `[]` if `array` is `null`, `undefined`, or empty.
|
|
9
9
|
*
|
|
10
10
|
* @remarks Uses reference equality for objects. Two distinct objects with
|
|
11
11
|
* identical property values are **not** considered equal and will both be kept.
|
|
@@ -23,4 +23,3 @@ export function Unique(array) {
|
|
|
23
23
|
}
|
|
24
24
|
return [...new Set(array)];
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=unique.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/asserts/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,SAAQ,KAAK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G;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG9D"}
|
|
@@ -55,9 +55,12 @@ export class BaseError extends Error {
|
|
|
55
55
|
this.name = this.constructor.name;
|
|
56
56
|
this.Code = code;
|
|
57
57
|
this.Context = context;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
59
|
+
const ErrorWithCapture = Error;
|
|
60
|
+
if (typeof ErrorWithCapture.captureStackTrace === 'function') {
|
|
61
|
+
ErrorWithCapture.captureStackTrace(this, this.constructor);
|
|
60
62
|
}
|
|
63
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
@@ -173,4 +176,3 @@ export class BufferOverflowError extends BaseError {
|
|
|
173
176
|
super(`Buffer overflow: maximum size ${maxSize} exceeded`, 'BUFFER_OVERFLOW', context);
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import type { IAssertException, TGuard, TValidationPredicate } from './types.js';
|
|
2
2
|
import { SimpleError } from './errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* Serializes a value to a human-readable string, safe for any value type.
|
|
5
|
+
*
|
|
6
|
+
* Prevents sensitive data exposure in error messages by:
|
|
7
|
+
* - Masking object contents (shows type name only, not property values)
|
|
8
|
+
* - Truncating long strings with a clear indication
|
|
9
|
+
* - Handling non-serializable values gracefully
|
|
10
|
+
*
|
|
11
|
+
* @param value - The value to serialize for display
|
|
12
|
+
* @param maxLength - Maximum characters to display for primitives (default: 100, capped at 10,000)
|
|
13
|
+
* @returns A safe string representation (at most maxLength chars plus "[truncated]" suffix)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* safeDisplay({ apiKey: 'secret123', username: 'john' }); // '[Object]'
|
|
17
|
+
* safeDisplay('x'.repeat(100)); // 'xxx....[truncated]'
|
|
18
|
+
* safeDisplay(circularRef); // '[non-serializable]'
|
|
19
|
+
*
|
|
20
|
+
* @internal Used internally by assertion functions to safely display values in error messages
|
|
21
|
+
*/
|
|
22
|
+
export declare function safeDisplay(value: unknown, maxLength?: number): string;
|
|
3
23
|
/**
|
|
4
24
|
* Gets the display type of a value including null and undefined.
|
|
5
25
|
* Used for error messages in null/undefined assertions and type checking.
|
|
@@ -13,7 +33,7 @@ export declare function GetValueType(value: unknown): string;
|
|
|
13
33
|
* Type alias for constructor functions.
|
|
14
34
|
* Represents any class constructor that can be instantiated.
|
|
15
35
|
*/
|
|
16
|
-
export type TConstructorFunction<T =
|
|
36
|
+
export type TConstructorFunction<T = unknown> = new (...args: any[]) => T;
|
|
17
37
|
/**
|
|
18
38
|
* Error thrown when a nullish assertion fails — the value is not null or undefined
|
|
19
39
|
* but was expected to be. Used by {@link AssertNull} when the provided value is a
|
|
@@ -403,7 +423,7 @@ export declare function AssertInstanceOf<T>(value: unknown, constructor: TConstr
|
|
|
403
423
|
* AssertFunction(123); // ✗ Throws FunctionError
|
|
404
424
|
* AssertFunction(null); // ✗ Throws FunctionError
|
|
405
425
|
*/
|
|
406
|
-
export declare function AssertFunction(value: unknown, exception?: IAssertException): asserts value is (...args:
|
|
426
|
+
export declare function AssertFunction(value: unknown, exception?: IAssertException): asserts value is (...args: unknown[]) => unknown;
|
|
407
427
|
/**
|
|
408
428
|
* Asserts that a value is a symbol.
|
|
409
429
|
*
|
|
@@ -440,5 +460,5 @@ export declare function AssertSymbol(value: unknown, exception?: IAssertExceptio
|
|
|
440
460
|
* AssertExtends(Derived, Base); // ✓ Valid
|
|
441
461
|
* AssertExtends(Base, Derived); // ✗ Throws ExtendsError
|
|
442
462
|
*/
|
|
443
|
-
export declare function AssertExtends(derived: abstract new (...args: any[]) =>
|
|
463
|
+
export declare function AssertExtends(derived: abstract new (...args: any[]) => unknown, base: abstract new (...args: any[]) => unknown, exception?: IAssertException): void;
|
|
444
464
|
//# sourceMappingURL=generic.d.ts.map
|
|
@@ -0,0 +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;AAEjF,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,SAA0B,GAAG,MAAM,CAiBvF;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOnD;AAED;;;GAGG;AAEH,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,OAAO,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,WAAW;gBAC7B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,WAAW;gBAChC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,WAAW;gBAClC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,WAAW;gBAClC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,WAAW;gBACnC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,WAAW;gBACjC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,WAAW;gBAC/B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;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,CAAC,CAAC,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAO1H;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAU9I;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAOjI;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAOtG;AAED;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,aAAa,CAAC,OAAO,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,IAAI,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAqBvK"}
|
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
import { ObjectEquals } from './internal-utils.js';
|
|
2
2
|
import { SetExceptionClass, SetExceptionMessage, ThrowException } from './utils.js';
|
|
3
3
|
import { AssertionError, SimpleError } from './errors.js';
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Maximum length for safe value display in assertion error messages.
|
|
6
|
+
* Prevents verbose output and potential information disclosure.
|
|
7
|
+
*/
|
|
8
|
+
const MAX_SAFE_DISPLAY_LENGTH = 100;
|
|
9
|
+
/**
|
|
10
|
+
* Serializes a value to a human-readable string, safe for any value type.
|
|
11
|
+
*
|
|
12
|
+
* Prevents sensitive data exposure in error messages by:
|
|
13
|
+
* - Masking object contents (shows type name only, not property values)
|
|
14
|
+
* - Truncating long strings with a clear indication
|
|
15
|
+
* - Handling non-serializable values gracefully
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to serialize for display
|
|
18
|
+
* @param maxLength - Maximum characters to display for primitives (default: 100, capped at 10,000)
|
|
19
|
+
* @returns A safe string representation (at most maxLength chars plus "[truncated]" suffix)
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* safeDisplay({ apiKey: 'secret123', username: 'john' }); // '[Object]'
|
|
23
|
+
* safeDisplay('x'.repeat(100)); // 'xxx....[truncated]'
|
|
24
|
+
* safeDisplay(circularRef); // '[non-serializable]'
|
|
25
|
+
*
|
|
26
|
+
* @internal Used internally by assertion functions to safely display values in error messages
|
|
27
|
+
*/
|
|
28
|
+
export function safeDisplay(value, maxLength = MAX_SAFE_DISPLAY_LENGTH) {
|
|
29
|
+
// Cap maxLength to prevent memory exhaustion from extremely large values
|
|
30
|
+
const effectiveMaxLength = Math.min(maxLength, 10_000);
|
|
31
|
+
// For objects, use type name instead of full serialization to avoid leaking structure
|
|
32
|
+
if (typeof value === 'object' && value !== null) {
|
|
33
|
+
return `[${Object.getPrototypeOf(value)?.constructor?.name ?? 'Object'}]`;
|
|
34
|
+
}
|
|
35
|
+
// For primitives, truncate with clear indication
|
|
8
36
|
try {
|
|
9
|
-
|
|
37
|
+
const serialized = JSON.stringify(value) ?? String(value);
|
|
38
|
+
return serialized.length > effectiveMaxLength
|
|
39
|
+
? serialized.slice(0, effectiveMaxLength) + '...[truncated]'
|
|
40
|
+
: serialized;
|
|
10
41
|
}
|
|
11
42
|
catch {
|
|
12
|
-
return
|
|
43
|
+
return '[non-serializable]';
|
|
13
44
|
}
|
|
14
45
|
}
|
|
15
46
|
/**
|
|
@@ -177,6 +208,7 @@ export class ExtendsError extends SimpleError {
|
|
|
177
208
|
* }); // ✗ Throws with custom message
|
|
178
209
|
* ```
|
|
179
210
|
*/
|
|
211
|
+
// @internal — Do not import from this module directly. Use asserts/index.ts instead.
|
|
180
212
|
export function AssertEquals(value, expected, exception = {}) {
|
|
181
213
|
SetExceptionClass(exception, AssertionError);
|
|
182
214
|
if (!ObjectEquals(value, expected)) {
|
|
@@ -535,6 +567,7 @@ export function AssertSymbol(value, exception = {}) {
|
|
|
535
567
|
* AssertExtends(Derived, Base); // ✓ Valid
|
|
536
568
|
* AssertExtends(Base, Derived); // ✗ Throws ExtendsError
|
|
537
569
|
*/
|
|
570
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
538
571
|
export function AssertExtends(derived, base, exception = {}) {
|
|
539
572
|
SetExceptionClass(exception, ExtendsError);
|
|
540
573
|
if (typeof derived !== 'function' || typeof base !== 'function') {
|
|
@@ -556,4 +589,3 @@ export function AssertExtends(derived, base, exception = {}) {
|
|
|
556
589
|
ThrowException(exception);
|
|
557
590
|
}
|
|
558
591
|
}
|
|
559
|
-
//# sourceMappingURL=generic.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module asserts
|
|
3
|
+
* @description Aggregation barrel for all assertion functions.
|
|
4
|
+
* Exports both generic assertion primitives (like AssertNull, AssertNotNull, AssertEquals, etc.)
|
|
5
|
+
* and domain-specific validators (AssertArray, AssertBoolean, AssertNumber, AssertObject, AssertString).
|
|
6
|
+
*
|
|
7
|
+
* Domain-specific assertions are re-exported here as a convenience so callers can import
|
|
8
|
+
* all assertion functions from a single entry point. They originate from their respective
|
|
9
|
+
* domain modules (array/, boolean/, number/, object/, string/).
|
|
10
|
+
*
|
|
11
|
+
* Note: Internal utility functions (SetExceptionClass, SetExceptionMessage, ThrowException,
|
|
12
|
+
* AssertValueType, safeDisplay, GetValueType) are NOT exported from this barrel as they are
|
|
13
|
+
* part of the internal assertion implementation contract and should not be relied upon by external code.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Export all array assertion functions and types
|
|
17
|
+
*/
|
|
18
|
+
export * from '../array/assert.js';
|
|
19
|
+
/**
|
|
20
|
+
* Export all boolean assertion functions and types
|
|
21
|
+
*/
|
|
22
|
+
export * from '../boolean/assert.js';
|
|
23
|
+
/**
|
|
24
|
+
* Export generic assertion functions (but not internal utilities)
|
|
25
|
+
*/
|
|
26
|
+
export { AssertEquals, AssertNotEquals, AssertNull, AssertNotNull, AssertPredicate, AssertIsType, AssertInstanceOf, AssertFunction, AssertSymbol, AssertExtends, NullError, NotNullError, PredicateError, TypeGuardError, InstanceOfError, FunctionError, SymbolError, ExtendsError, type TConstructorFunction, } from './generic.js';
|
|
27
|
+
/**
|
|
28
|
+
* Export all number assertion functions and types
|
|
29
|
+
*/
|
|
30
|
+
export * from '../number/assert.js';
|
|
31
|
+
/**
|
|
32
|
+
* Export all object assertion functions and types
|
|
33
|
+
*/
|
|
34
|
+
export * from '../object/assert.js';
|
|
35
|
+
/**
|
|
36
|
+
* Export all string assertion functions and types
|
|
37
|
+
*/
|
|
38
|
+
export * from '../string/assert.js';
|
|
39
|
+
/**
|
|
40
|
+
* Export type definitions and interfaces
|
|
41
|
+
*/
|
|
42
|
+
export * from './types.js';
|
|
43
|
+
/**
|
|
44
|
+
* Export error classes for standardized error handling
|
|
45
|
+
*/
|
|
46
|
+
export * from './errors.js';
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/asserts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,cAAc,sBAAsB,CAAC;AAErC;;GAEG;AACH,OAAO,EACN,YAAY,EACZ,eAAe,EACf,UAAU,EACV,aAAa,EACb,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,EACZ,KAAK,oBAAoB,GACzB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,cAAc,YAAY,CAAC;AAE3B;;GAEG;AACH,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module asserts
|
|
3
|
+
* @description Aggregation barrel for all assertion functions.
|
|
4
|
+
* Exports both generic assertion primitives (like AssertNull, AssertNotNull, AssertEquals, etc.)
|
|
5
|
+
* and domain-specific validators (AssertArray, AssertBoolean, AssertNumber, AssertObject, AssertString).
|
|
6
|
+
*
|
|
7
|
+
* Domain-specific assertions are re-exported here as a convenience so callers can import
|
|
8
|
+
* all assertion functions from a single entry point. They originate from their respective
|
|
9
|
+
* domain modules (array/, boolean/, number/, object/, string/).
|
|
10
|
+
*
|
|
11
|
+
* Note: Internal utility functions (SetExceptionClass, SetExceptionMessage, ThrowException,
|
|
12
|
+
* AssertValueType, safeDisplay, GetValueType) are NOT exported from this barrel as they are
|
|
13
|
+
* part of the internal assertion implementation contract and should not be relied upon by external code.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Export all array assertion functions and types
|
|
17
|
+
*/
|
|
18
|
+
export * from '../array/assert.js';
|
|
19
|
+
/**
|
|
20
|
+
* Export all boolean assertion functions and types
|
|
21
|
+
*/
|
|
22
|
+
export * from '../boolean/assert.js';
|
|
23
|
+
/**
|
|
24
|
+
* Export generic assertion functions (but not internal utilities)
|
|
25
|
+
*/
|
|
26
|
+
export { AssertEquals, AssertNotEquals, AssertNull, AssertNotNull, AssertPredicate, AssertIsType, AssertInstanceOf, AssertFunction, AssertSymbol, AssertExtends, NullError, NotNullError, PredicateError, TypeGuardError, InstanceOfError, FunctionError, SymbolError, ExtendsError, } from './generic.js';
|
|
27
|
+
/**
|
|
28
|
+
* Export all number assertion functions and types
|
|
29
|
+
*/
|
|
30
|
+
export * from '../number/assert.js';
|
|
31
|
+
/**
|
|
32
|
+
* Export all object assertion functions and types
|
|
33
|
+
*/
|
|
34
|
+
export * from '../object/assert.js';
|
|
35
|
+
/**
|
|
36
|
+
* Export all string assertion functions and types
|
|
37
|
+
*/
|
|
38
|
+
export * from '../string/assert.js';
|
|
39
|
+
/**
|
|
40
|
+
* Export type definitions and interfaces
|
|
41
|
+
*/
|
|
42
|
+
export * from './types.js';
|
|
43
|
+
/**
|
|
44
|
+
* Export error classes for standardized error handling
|
|
45
|
+
*/
|
|
46
|
+
export * from './errors.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-utils.d.ts","sourceRoot":"","sources":["../../src/asserts/internal-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;
|
|
1
|
+
{"version":3,"file":"internal-utils.d.ts","sourceRoot":"","sources":["../../src/asserts/internal-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AAEH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAGxF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|