@pawells/typescript-common 1.4.1 → 2.1.5
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 +350 -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 +4 -1
- package/{build → dist}/array/array-contains.d.ts.map +1 -1
- package/{build → dist}/array/array-contains.js +6 -3
- package/{build → dist}/array/array-count-by.d.ts +3 -1
- package/dist/array/array-count-by.d.ts.map +1 -0
- package/{build → dist}/array/array-count-by.js +4 -2
- package/dist/array/array-difference.d.ts +43 -0
- 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 +3 -1
- package/{build → dist}/array/array-filter.d.ts.map +1 -1
- package/{build → dist}/array/array-filter.js +5 -3
- 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 +3 -1
- package/dist/array/array-group-by.d.ts.map +1 -0
- package/{build → dist}/array/array-group-by.js +12 -8
- package/dist/array/array-intersection.d.ts +43 -0
- 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 +3 -1
- package/{build → dist}/array/array-partition.d.ts.map +1 -1
- package/{build → dist}/array/array-partition.js +4 -2
- 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 +4 -4
- package/dist/array/array-sample.d.ts.map +1 -0
- package/{build → dist}/array/array-sample.js +4 -14
- 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 +27 -23
- package/dist/array/assert.d.ts.map +1 -0
- package/{build → dist}/array/assert.js +40 -37
- package/{build → dist}/array/index.js +0 -1
- package/{build → dist}/array/types.d.ts +29 -0
- package/dist/array/types.d.ts.map +1 -0
- package/dist/array/types.js +1 -0
- package/{build → dist}/array/unique.d.ts +3 -1
- package/{build → dist}/array/unique.d.ts.map +1 -1
- package/{build → dist}/array/unique.js +5 -3
- package/dist/asserts/errors.d.ts.map +1 -0
- package/{build → dist}/asserts/errors.js +5 -3
- package/{build → dist}/asserts/generic.d.ts +32 -3
- package/dist/asserts/generic.d.ts.map +1 -0
- package/{build → dist}/asserts/generic.js +63 -15
- 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 +18 -2
- package/dist/asserts/utils.d.ts.map +1 -0
- package/{build → dist}/asserts/utils.js +56 -1
- 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 +3 -8
- 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 +9 -2
- package/dist/function/compose.d.ts.map +1 -0
- package/{build → dist}/function/compose.js +0 -1
- package/{build → dist}/function/debounce.d.ts +8 -1
- 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 +43 -0
- package/dist/function/memoize.d.ts.map +1 -0
- package/dist/function/memoize.js +59 -0
- package/{build → dist}/function/once.d.ts +1 -0
- package/{build → dist}/function/once.d.ts.map +1 -1
- package/{build → dist}/function/once.js +2 -1
- package/{build → dist}/function/sleep.js +0 -1
- package/dist/function/throttle.d.ts +25 -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 +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -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.d.ts.map +1 -1
- package/{build → dist}/number/assert.js +38 -43
- 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.map +1 -1
- package/{build → dist}/object/clone.js +11 -5
- package/{build → dist}/object/equals.d.ts +1 -1
- package/{build → dist}/object/equals.d.ts.map +1 -1
- package/{build → dist}/object/equals.js +12 -9
- package/dist/object/filter-cached.d.ts +44 -0
- package/{build → dist}/object/filter-cached.d.ts.map +1 -1
- package/{build → dist}/object/filter-cached.js +41 -2
- package/{build → dist}/object/filter.d.ts +1 -1
- package/{build → dist}/object/filter.d.ts.map +1 -1
- package/{build → dist}/object/filter.js +38 -70
- 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 +5 -1
- package/dist/object/hash.d.ts.map +1 -0
- package/{build → dist}/object/hash.js +20 -6
- 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 +6 -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 -2
- package/{build → dist}/object/property-paths.d.ts.map +1 -1
- package/{build → dist}/object/property-paths.js +13 -9
- 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 +297 -0
- package/{build → dist}/object/sort-keys.d.ts +1 -1
- package/{build → dist}/object/sort-keys.d.ts.map +1 -1
- package/{build → dist}/object/sort-keys.js +18 -11
- package/{build → dist}/object/types.d.ts +61 -20
- package/dist/object/types.d.ts.map +1 -0
- package/dist/object/types.js +1 -0
- package/{build → dist}/string/assert.d.ts +5 -0
- package/dist/string/assert.d.ts.map +1 -0
- package/{build → dist}/string/assert.js +14 -10
- package/dist/string/case-conversion.d.ts +79 -0
- package/dist/string/case-conversion.d.ts.map +1 -0
- package/{build → dist}/string/case-conversion.js +59 -30
- package/dist/string/comparison.d.ts +20 -0
- package/dist/string/comparison.d.ts.map +1 -0
- package/dist/string/comparison.js +27 -0
- package/{build → dist}/string/formatting.d.ts +35 -22
- package/dist/string/formatting.d.ts.map +1 -0
- package/{build → dist}/string/formatting.js +40 -25
- package/{build → dist}/string/index.d.ts +1 -0
- package/{build → dist}/string/index.d.ts.map +1 -1
- package/{build → dist}/string/index.js +1 -1
- package/dist/string/transformation.d.ts +28 -0
- package/dist/string/transformation.d.ts.map +1 -0
- package/dist/string/transformation.js +42 -0
- 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/dist/string/validation.d.ts +30 -0
- package/dist/string/validation.d.ts.map +1 -0
- package/dist/string/validation.js +38 -0
- 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 +67 -15
- package/dist/time/elapsed-time/elapsed-time.d.ts.map +1 -0
- package/{build → dist}/time/elapsed-time/elapsed-time.js +172 -78
- 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/{build → dist}/time/index.d.ts +0 -2
- package/{build → dist}/time/index.d.ts.map +1 -1
- package/{build → dist}/time/index.js +0 -2
- 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 +9 -3
- package/dist/time/stopwatch/stopwatch.d.ts.map +1 -0
- package/{build → dist}/time/stopwatch/stopwatch.js +9 -4
- package/package.json +58 -81
- 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.d.ts.map +0 -1
- package/build/array/array-count-by.js.map +0 -1
- package/build/array/array-difference.d.ts +0 -25
- package/build/array/array-difference.d.ts.map +0 -1
- package/build/array/array-difference.js +0 -34
- 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.d.ts.map +0 -1
- package/build/array/array-group-by.js.map +0 -1
- package/build/array/array-intersection.d.ts +0 -25
- package/build/array/array-intersection.d.ts.map +0 -1
- package/build/array/array-intersection.js +0 -39
- 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.d.ts.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.d.ts.map +0 -1
- package/build/array/assert.js.map +0 -1
- package/build/array/index.js.map +0 -1
- package/build/array/types.d.ts.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 +0 -17
- 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.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.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.d.ts +0 -50
- package/build/string/case-conversion.d.ts.map +0 -1
- package/build/string/case-conversion.js.map +0 -1
- package/build/string/formatting.d.ts.map +0 -1
- package/build/string/formatting.js.map +0 -1
- package/build/string/index.js.map +0 -1
- package/build/string/transformation.d.ts +0 -18
- package/build/string/transformation.d.ts.map +0 -1
- package/build/string/transformation.js +0 -32
- 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.d.ts +0 -18
- package/build/string/validation.d.ts.map +0 -1
- package/build/string/validation.js +0 -26
- 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.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-element.d.ts +0 -0
- /package/{build → dist}/array/array-element.d.ts.map +0 -0
- /package/{build → dist}/array/array-range.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/index.d.ts +0 -0
- /package/{build → dist}/array/index.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/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}/object/clone.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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
1
|
/**
|
|
3
2
|
* Enum utility functions.
|
|
4
3
|
*
|
|
@@ -8,6 +7,7 @@ export * from './types.js';
|
|
|
8
7
|
*
|
|
9
8
|
* @module enum
|
|
10
9
|
*/
|
|
10
|
+
export * from './types.js';
|
|
11
11
|
export * from './enum-keys.js';
|
|
12
12
|
export * from './enum-values.js';
|
|
13
13
|
export * from './enum-entries.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enum/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
1
|
/**
|
|
3
2
|
* Enum utility functions.
|
|
4
3
|
*
|
|
@@ -8,10 +7,10 @@ export * from './types.js';
|
|
|
8
7
|
*
|
|
9
8
|
* @module enum
|
|
10
9
|
*/
|
|
10
|
+
export * from './types.js';
|
|
11
11
|
export * from './enum-keys.js';
|
|
12
12
|
export * from './enum-values.js';
|
|
13
13
|
export * from './enum-entries.js';
|
|
14
14
|
export * from './validate-enum-value.js';
|
|
15
15
|
export * from './enum-key-by-value.js';
|
|
16
16
|
export * from './enum-safe-value.js';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-enum-value.d.ts","sourceRoot":"","sources":["../../src/enum/validate-enum-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAKnG"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { TAnyFunction } from './types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Composes functions **right-to-left** — the rightmost function is applied first.
|
|
3
4
|
*
|
|
4
5
|
* Overloads are provided for up to five functions with distinct types.
|
|
5
6
|
* For same-type pipelines of any length, use the variadic form.
|
|
6
7
|
*
|
|
8
|
+
* @param fns - One or more functions to compose
|
|
9
|
+
* @returns A function that applies the input through the composed pipeline
|
|
10
|
+
*
|
|
7
11
|
* @example
|
|
8
12
|
* ```typescript
|
|
9
13
|
* const process = Compose(trim, toLowerCase, removeSpaces);
|
|
@@ -15,13 +19,16 @@ export declare function Compose<A, B, C>(f1: (b: B) => C, f2: (a: A) => B): (a:
|
|
|
15
19
|
export declare function Compose<A, B, C, D>(f1: (c: C) => D, f2: (b: B) => C, f3: (a: A) => B): (a: A) => D;
|
|
16
20
|
export declare function Compose<A, B, C, D, E>(f1: (d: D) => E, f2: (c: C) => D, f3: (b: B) => C, f4: (a: A) => B): (a: A) => E;
|
|
17
21
|
export declare function Compose<A, B, C, D, E, F>(f1: (e: E) => F, f2: (d: D) => E, f3: (c: C) => D, f4: (b: B) => C, f5: (a: A) => B): (a: A) => F;
|
|
18
|
-
export declare function Compose(...fns:
|
|
22
|
+
export declare function Compose(...fns: TAnyFunction[]): TAnyFunction;
|
|
19
23
|
/**
|
|
20
24
|
* Pipes functions **left-to-right** — the leftmost function is applied first.
|
|
21
25
|
*
|
|
22
26
|
* Overloads are provided for up to five functions with distinct types.
|
|
23
27
|
* For same-type pipelines of any length, use the variadic form.
|
|
24
28
|
*
|
|
29
|
+
* @param fns - One or more functions to pipe
|
|
30
|
+
* @returns A function that applies the input through the piped pipeline
|
|
31
|
+
*
|
|
25
32
|
* @example
|
|
26
33
|
* ```typescript
|
|
27
34
|
* const process = Pipe(trim, toLowerCase, removeSpaces);
|
|
@@ -33,5 +40,5 @@ export declare function Pipe<A, B, C>(f1: (a: A) => B, f2: (b: B) => C): (a: A)
|
|
|
33
40
|
export declare function Pipe<A, B, C, D>(f1: (a: A) => B, f2: (b: B) => C, f3: (c: C) => D): (a: A) => D;
|
|
34
41
|
export declare function Pipe<A, B, C, D, E>(f1: (a: A) => B, f2: (b: B) => C, f3: (c: C) => D, f4: (d: D) => E): (a: A) => E;
|
|
35
42
|
export declare function Pipe<A, B, C, D, E, F>(f1: (a: A) => B, f2: (b: B) => C, f3: (c: C) => D, f4: (d: D) => E, f5: (e: E) => F): (a: A) => F;
|
|
36
|
-
export declare function Pipe(...fns:
|
|
43
|
+
export declare function Pipe(...fns: TAnyFunction[]): TAnyFunction;
|
|
37
44
|
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/function/compose.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TAnyFunction } from './types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Creates a debounced version of `fn` that delays execution until after `ms`
|
|
3
4
|
* milliseconds have elapsed since the last invocation.
|
|
@@ -5,6 +6,12 @@
|
|
|
5
6
|
* The returned function also exposes a `.cancel()` method to discard any
|
|
6
7
|
* pending invocation.
|
|
7
8
|
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Debounce differs from throttle in that it **delays execution** until silence.
|
|
11
|
+
* Each call resets the timer; the function executes only after `ms` milliseconds
|
|
12
|
+
* of inactivity. Throttle, by contrast, limits calls to **at most once per `ms` milliseconds**
|
|
13
|
+
* regardless of how frequently calls are made.
|
|
14
|
+
*
|
|
8
15
|
* @template T - The wrapped function type
|
|
9
16
|
* @param fn - The function to debounce
|
|
10
17
|
* @param ms - Delay in milliseconds
|
|
@@ -19,7 +26,7 @@
|
|
|
19
26
|
* save.cancel();
|
|
20
27
|
* ```
|
|
21
28
|
*/
|
|
22
|
-
export declare function Debounce<T extends
|
|
29
|
+
export declare function Debounce<T extends TAnyFunction>(fn: T, ms: number): ((...args: Parameters<T>) => void) & {
|
|
23
30
|
cancel: () => void;
|
|
24
31
|
};
|
|
25
32
|
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/function/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAC9C,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,MAAM,GACR,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAiB7D"}
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* The returned function also exposes a `.cancel()` method to discard any
|
|
6
6
|
* pending invocation.
|
|
7
7
|
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Debounce differs from throttle in that it **delays execution** until silence.
|
|
10
|
+
* Each call resets the timer; the function executes only after `ms` milliseconds
|
|
11
|
+
* of inactivity. Throttle, by contrast, limits calls to **at most once per `ms` milliseconds**
|
|
12
|
+
* regardless of how frequently calls are made.
|
|
13
|
+
*
|
|
8
14
|
* @template T - The wrapped function type
|
|
9
15
|
* @param fn - The function to debounce
|
|
10
16
|
* @param ms - Delay in milliseconds
|
|
@@ -34,4 +40,3 @@ export function Debounce(fn, ms) {
|
|
|
34
40
|
};
|
|
35
41
|
return debounced;
|
|
36
42
|
}
|
|
37
|
-
//# sourceMappingURL=debounce.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a memoized version of `fn` that caches results by serialising its
|
|
3
|
+
* arguments with `JSON.stringify` (or a custom `keyFn`).
|
|
4
|
+
*
|
|
5
|
+
* Only suitable for **pure functions** with serialisable arguments.
|
|
6
|
+
*
|
|
7
|
+
* Uses an LRU (Least Recently Used) eviction policy: when the cache reaches
|
|
8
|
+
* `maxCacheSize`, the entry that was accessed least recently is evicted.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The function type to memoize
|
|
11
|
+
* @param fn - The function to memoize
|
|
12
|
+
* @param keyFn - Optional custom cache key function. If not provided, arguments are serialized with JSON.stringify
|
|
13
|
+
* @param maxCacheSize - Maximum number of cached results before LRU eviction (default: 1000)
|
|
14
|
+
* @returns A memoized function with the same signature as `fn`
|
|
15
|
+
*
|
|
16
|
+
* @warning Do not memoize functions with sensitive parameters (passwords, tokens, API keys).
|
|
17
|
+
* The cache stores return values keyed by serialized arguments, which could expose sensitive
|
|
18
|
+
* data if the cache is inspected or if the keyFn inadvertently includes sensitive data
|
|
19
|
+
* in the cache key. For functions handling sensitive data, consider:
|
|
20
|
+
* - Not memoizing at all
|
|
21
|
+
* - Using a custom keyFn that excludes sensitive parameters
|
|
22
|
+
* - Implementing manual cache invalidation after processing sensitive data
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const expensiveCalc = Memoize((n: number) => n * n);
|
|
27
|
+
* expensiveCalc(4); // computed
|
|
28
|
+
* expensiveCalc(4); // cached → same value returned immediately
|
|
29
|
+
*
|
|
30
|
+
* // Custom key function:
|
|
31
|
+
* const getUser = Memoize(fetchUser, (id) => `user:${id}`);
|
|
32
|
+
*
|
|
33
|
+
* // With custom cache size:
|
|
34
|
+
* const cached = Memoize(fn, undefined, 500);
|
|
35
|
+
*
|
|
36
|
+
* const add = (a: number, b: number) => a + b;
|
|
37
|
+
* const cachedAdd = Memoize(add);
|
|
38
|
+
* console.log(cachedAdd(1, 2)); // Computes: 3
|
|
39
|
+
* console.log(cachedAdd(1, 2)); // Returns cached result: 3
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function Memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string, maxCacheSize?: number): T;
|
|
43
|
+
//# sourceMappingURL=memoize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../src/function/memoize.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,wBAAgB,OAAO,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,EAAE,EAAE,CAAC,EACL,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,EAC1C,YAAY,SAAO,GACjB,CAAC,CAkBH"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LRUCache } from '../lru-cache.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a memoized version of `fn` that caches results by serialising its
|
|
4
|
+
* arguments with `JSON.stringify` (or a custom `keyFn`).
|
|
5
|
+
*
|
|
6
|
+
* Only suitable for **pure functions** with serialisable arguments.
|
|
7
|
+
*
|
|
8
|
+
* Uses an LRU (Least Recently Used) eviction policy: when the cache reaches
|
|
9
|
+
* `maxCacheSize`, the entry that was accessed least recently is evicted.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The function type to memoize
|
|
12
|
+
* @param fn - The function to memoize
|
|
13
|
+
* @param keyFn - Optional custom cache key function. If not provided, arguments are serialized with JSON.stringify
|
|
14
|
+
* @param maxCacheSize - Maximum number of cached results before LRU eviction (default: 1000)
|
|
15
|
+
* @returns A memoized function with the same signature as `fn`
|
|
16
|
+
*
|
|
17
|
+
* @warning Do not memoize functions with sensitive parameters (passwords, tokens, API keys).
|
|
18
|
+
* The cache stores return values keyed by serialized arguments, which could expose sensitive
|
|
19
|
+
* data if the cache is inspected or if the keyFn inadvertently includes sensitive data
|
|
20
|
+
* in the cache key. For functions handling sensitive data, consider:
|
|
21
|
+
* - Not memoizing at all
|
|
22
|
+
* - Using a custom keyFn that excludes sensitive parameters
|
|
23
|
+
* - Implementing manual cache invalidation after processing sensitive data
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const expensiveCalc = Memoize((n: number) => n * n);
|
|
28
|
+
* expensiveCalc(4); // computed
|
|
29
|
+
* expensiveCalc(4); // cached → same value returned immediately
|
|
30
|
+
*
|
|
31
|
+
* // Custom key function:
|
|
32
|
+
* const getUser = Memoize(fetchUser, (id) => `user:${id}`);
|
|
33
|
+
*
|
|
34
|
+
* // With custom cache size:
|
|
35
|
+
* const cached = Memoize(fn, undefined, 500);
|
|
36
|
+
*
|
|
37
|
+
* const add = (a: number, b: number) => a + b;
|
|
38
|
+
* const cachedAdd = Memoize(add);
|
|
39
|
+
* console.log(cachedAdd(1, 2)); // Computes: 3
|
|
40
|
+
* console.log(cachedAdd(1, 2)); // Returns cached result: 3
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
export function Memoize(fn, keyFn, maxCacheSize = 1000) {
|
|
45
|
+
const cache = new LRUCache(maxCacheSize);
|
|
46
|
+
return function memoized(...args) {
|
|
47
|
+
const key = keyFn ? keyFn(...args) : JSON.stringify(args);
|
|
48
|
+
if (cache.has(key)) {
|
|
49
|
+
// PERFORMANCE NOTE: LRUCache.get() calls Map.delete() + Map.set() on every cache hit.
|
|
50
|
+
// For read-heavy workloads, tracking access timestamps would be faster than
|
|
51
|
+
// the delete/reinsert pattern. This is correct for LRU semantics but can be slow
|
|
52
|
+
// for hot cache entries accessed thousands of times per second.
|
|
53
|
+
return cache.get(key);
|
|
54
|
+
}
|
|
55
|
+
const result = fn(...args);
|
|
56
|
+
cache.set(key, result);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @template T - The wrapped function type
|
|
6
6
|
* @param fn - The function to restrict
|
|
7
7
|
* @returns A wrapped function that executes `fn` at most once
|
|
8
|
+
* @throws When the wrapped function throws an error, the error is cached and re-thrown on all subsequent calls
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"once.d.ts","sourceRoot":"","sources":["../../src/function/once.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"once.d.ts","sourceRoot":"","sources":["../../src/function/once.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAsBhE"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @template T - The wrapped function type
|
|
6
6
|
* @param fn - The function to restrict
|
|
7
7
|
* @returns A wrapped function that executes `fn` at most once
|
|
8
|
+
* @throws When the wrapped function throws an error, the error is cached and re-thrown on all subsequent calls
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* ```typescript
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
* init(); // no-op — returns cached result
|
|
14
15
|
* ```
|
|
15
16
|
*/
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
18
|
export function Once(fn) {
|
|
17
19
|
let called = false;
|
|
18
20
|
let result;
|
|
@@ -36,4 +38,3 @@ export function Once(fn) {
|
|
|
36
38
|
return result;
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
|
-
//# sourceMappingURL=once.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TAnyFunction } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a throttled version of `fn` that invokes at most once per `ms`
|
|
4
|
+
* milliseconds, guaranteeing the final call in a burst is also executed.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Throttle differs from debounce in that it **rate-limits execution** to at most
|
|
8
|
+
* once per `ms` milliseconds. The function executes immediately on the first call,
|
|
9
|
+
* and subsequent calls are batched; the final pending call always executes. Debounce,
|
|
10
|
+
* by contrast, **delays execution** until `ms` milliseconds of silence have elapsed
|
|
11
|
+
* and resets the timer on each call.
|
|
12
|
+
*
|
|
13
|
+
* @template T - The wrapped function type
|
|
14
|
+
* @param fn - The function to throttle
|
|
15
|
+
* @param ms - Minimum interval in milliseconds between invocations
|
|
16
|
+
* @returns A throttled function
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const onScroll = Throttle(() => updatePosition(), 100);
|
|
21
|
+
* window.addEventListener('scroll', onScroll);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function Throttle<T extends TAnyFunction>(fn: T, ms: number): (...args: Parameters<T>) => void;
|
|
25
|
+
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/function/throttle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAC9C,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,MAAM,GACR,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAuBlC"}
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
* Creates a throttled version of `fn` that invokes at most once per `ms`
|
|
3
3
|
* milliseconds, guaranteeing the final call in a burst is also executed.
|
|
4
4
|
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Throttle differs from debounce in that it **rate-limits execution** to at most
|
|
7
|
+
* once per `ms` milliseconds. The function executes immediately on the first call,
|
|
8
|
+
* and subsequent calls are batched; the final pending call always executes. Debounce,
|
|
9
|
+
* by contrast, **delays execution** until `ms` milliseconds of silence have elapsed
|
|
10
|
+
* and resets the timer on each call.
|
|
11
|
+
*
|
|
5
12
|
* @template T - The wrapped function type
|
|
6
13
|
* @param fn - The function to throttle
|
|
7
14
|
* @param ms - Minimum interval in milliseconds between invocations
|
|
@@ -36,4 +43,3 @@ export function Throttle(fn, ms) {
|
|
|
36
43
|
}
|
|
37
44
|
};
|
|
38
45
|
}
|
|
39
|
-
//# sourceMappingURL=throttle.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any function signature.
|
|
3
|
+
*
|
|
4
|
+
* A type alias for functions accepting any arguments and returning any type.
|
|
5
|
+
* Used throughout the function domain for function wrappers and utilities
|
|
6
|
+
* that operate on generic functions without type-specific constraints.
|
|
7
|
+
*/
|
|
8
|
+
export type TAnyFunction = (...args: any[]) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Any async function signature.
|
|
11
|
+
*
|
|
12
|
+
* A type alias for async functions accepting any arguments and returning
|
|
13
|
+
* a Promise of the specified generic type (default `void`).
|
|
14
|
+
*
|
|
15
|
+
* @template T - The resolved value type of the returned Promise (default `void`)
|
|
16
|
+
*/
|
|
17
|
+
export type TAsyncFunction<T = void> = (...args: any[]) => Promise<T>;
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/function/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEnD;;;;;;;GAOG;AAEH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './lru-cache.js';
|
|
2
|
+
export * from './array/index.js';
|
|
3
|
+
export * from './asserts/index.js';
|
|
4
|
+
export * from './boolean/index.js';
|
|
5
|
+
export * from './enum/index.js';
|
|
6
|
+
export * from './function/index.js';
|
|
7
|
+
export * from './number/index.js';
|
|
8
|
+
export * from './object/index.js';
|
|
9
|
+
export * from './string/index.js';
|
|
10
|
+
export * from './time/index.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './lru-cache.js';
|
|
2
|
+
export * from './array/index.js';
|
|
3
|
+
export * from './asserts/index.js';
|
|
4
|
+
export * from './boolean/index.js';
|
|
5
|
+
export * from './enum/index.js';
|
|
6
|
+
export * from './function/index.js';
|
|
7
|
+
export * from './number/index.js';
|
|
8
|
+
export * from './object/index.js';
|
|
9
|
+
export * from './string/index.js';
|
|
10
|
+
export * from './time/index.js';
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* @typeParam K - Key type
|
|
9
9
|
* @typeParam V - Value type
|
|
10
10
|
*
|
|
11
|
+
* @warning Do not cache sensitive objects (API keys, tokens, passwords, PII).
|
|
12
|
+
* Cache entries remain in memory until evicted or cleared. If cache is inspected
|
|
13
|
+
* (via debugger, memory dump, or compromised process), sensitive values will be exposed.
|
|
14
|
+
* For sensitive data, prefer ephemeral processing without caching, or implement
|
|
15
|
+
* automatic expiration and secure clearing (e.g., overwrite before eviction).
|
|
16
|
+
*
|
|
11
17
|
* @example
|
|
12
18
|
* ```typescript
|
|
13
19
|
* const cache = new LRUCache<string, number>(2);
|
|
@@ -46,6 +52,12 @@ export declare class LRUCache<K, V> {
|
|
|
46
52
|
* @param key - The key to look up
|
|
47
53
|
* @returns The cached value, or `undefined` if not found
|
|
48
54
|
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Each cache hit triggers an internal Map delete and re-insert operation to maintain
|
|
57
|
+
* LRU order. This is O(1) amortized, but introduces per-access overhead.
|
|
58
|
+
* For read-heavy workloads, consider a timestamp-based LRU approach to reduce
|
|
59
|
+
* per-access cost, though it adds space overhead for timestamp storage.
|
|
60
|
+
*
|
|
49
61
|
* @example
|
|
50
62
|
* ```typescript
|
|
51
63
|
* const cache = new LRUCache<string, number>(2);
|
|
@@ -101,5 +113,12 @@ export declare class LRUCache<K, V> {
|
|
|
101
113
|
* ```
|
|
102
114
|
*/
|
|
103
115
|
clear(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Removes a specific key from the cache.
|
|
118
|
+
*
|
|
119
|
+
* @param key - The key to delete
|
|
120
|
+
* @returns `true` if the key existed and was deleted, `false` otherwise
|
|
121
|
+
*/
|
|
122
|
+
delete(key: K): boolean;
|
|
104
123
|
}
|
|
105
124
|
//# sourceMappingURL=lru-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.d.ts","sourceRoot":"","sources":["../src/lru-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,QAAQ,CAAC,CAAC,EAAE,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC;;;;;;;;;;OAUG;gBACS,OAAO,EAAE,MAAM;IAO3B;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAajC;;;;;;;;;;;;;OAaG;IACI,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAI3B;;;;;;;;;;;;;;;;;OAiBG;IACI,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAgBlC;;;;;;;;;;OAUG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;CAG9B"}
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* @typeParam K - Key type
|
|
9
9
|
* @typeParam V - Value type
|
|
10
10
|
*
|
|
11
|
+
* @warning Do not cache sensitive objects (API keys, tokens, passwords, PII).
|
|
12
|
+
* Cache entries remain in memory until evicted or cleared. If cache is inspected
|
|
13
|
+
* (via debugger, memory dump, or compromised process), sensitive values will be exposed.
|
|
14
|
+
* For sensitive data, prefer ephemeral processing without caching, or implement
|
|
15
|
+
* automatic expiration and secure clearing (e.g., overwrite before eviction).
|
|
16
|
+
*
|
|
11
17
|
* @example
|
|
12
18
|
* ```typescript
|
|
13
19
|
* const cache = new LRUCache<string, number>(2);
|
|
@@ -53,6 +59,12 @@ export class LRUCache {
|
|
|
53
59
|
* @param key - The key to look up
|
|
54
60
|
* @returns The cached value, or `undefined` if not found
|
|
55
61
|
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Each cache hit triggers an internal Map delete and re-insert operation to maintain
|
|
64
|
+
* LRU order. This is O(1) amortized, but introduces per-access overhead.
|
|
65
|
+
* For read-heavy workloads, consider a timestamp-based LRU approach to reduce
|
|
66
|
+
* per-access cost, though it adds space overhead for timestamp storage.
|
|
67
|
+
*
|
|
56
68
|
* @example
|
|
57
69
|
* ```typescript
|
|
58
70
|
* const cache = new LRUCache<string, number>(2);
|
|
@@ -66,7 +78,9 @@ export class LRUCache {
|
|
|
66
78
|
return undefined;
|
|
67
79
|
}
|
|
68
80
|
const value = this._map.get(key);
|
|
69
|
-
//
|
|
81
|
+
// LRU maintenance: re-insert at map tail on every read hit.
|
|
82
|
+
// This is O(1) but involves Map.delete + Map.set per call.
|
|
83
|
+
// For read-heavy workloads, consider a timestamp-based LRU alternative.
|
|
70
84
|
this._map.delete(key);
|
|
71
85
|
this._map.set(key, value);
|
|
72
86
|
return value;
|
|
@@ -135,5 +149,13 @@ export class LRUCache {
|
|
|
135
149
|
clear() {
|
|
136
150
|
this._map.clear();
|
|
137
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Removes a specific key from the cache.
|
|
154
|
+
*
|
|
155
|
+
* @param key - The key to delete
|
|
156
|
+
* @returns `true` if the key existed and was deleted, `false` otherwise
|
|
157
|
+
*/
|
|
158
|
+
delete(key) {
|
|
159
|
+
return this._map.delete(key);
|
|
160
|
+
}
|
|
138
161
|
}
|
|
139
|
-
//# sourceMappingURL=lru-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/number/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAY,SAAQ,WAAW;gBAC/B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;gBACpC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;AAEnG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,iBAAiB;IACjC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yDAAyD;IACzD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE,iBAAsB,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/number/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAY,SAAQ,WAAW;gBAC/B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;gBACpC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;AAEnG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,iBAAiB;IACjC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yDAAyD;IACzD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE,iBAAsB,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAiDpI"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SetExceptionClass, SetExceptionMessage, ThrowException } from '../asserts/utils.js';
|
|
1
|
+
import { SetExceptionClass, SetExceptionMessage, ThrowException, AssertValueType } from '../asserts/utils.js';
|
|
2
2
|
import { SimpleError } from '../asserts/errors.js';
|
|
3
3
|
/**
|
|
4
4
|
* Error thrown when a value is not a valid number or fails basic numeric validation.
|
|
@@ -102,49 +102,44 @@ export class NumberRangeError extends NumberError {
|
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
104
|
export function AssertNumber(value, args = {}, exception = {}) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
SetExceptionClass(exception, NumberError);
|
|
106
|
+
AssertValueType(value, 'number', exception);
|
|
107
|
+
// Type is narrowed by AssertValueType; cast for TypeScript
|
|
108
|
+
const num = value;
|
|
109
|
+
SetExceptionClass(exception, NumberRangeError, true);
|
|
110
|
+
// Validate finite constraint (if specified, value must be finite)
|
|
111
|
+
if (args.finite === true && !Number.isFinite(num)) {
|
|
112
|
+
SetExceptionMessage(exception, `Expected finite number but received ${num}`);
|
|
109
113
|
ThrowException(exception);
|
|
110
114
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
SetExceptionMessage(exception, `Expected value < ${args.lt} but received ${value}`);
|
|
141
|
-
ThrowException(exception);
|
|
142
|
-
}
|
|
143
|
-
// Validate less than or equal constraint (inclusive - value can equal the bound)
|
|
144
|
-
if (args.lte !== undefined && value > args.lte) {
|
|
145
|
-
SetExceptionMessage(exception, `Expected value <= ${args.lte} but received ${value}`);
|
|
146
|
-
ThrowException(exception);
|
|
147
|
-
}
|
|
115
|
+
// Validate integer constraint (if specified, value must be an integer)
|
|
116
|
+
if (args.integer === true && !Number.isInteger(num)) {
|
|
117
|
+
SetExceptionMessage(exception, `Expected integer but received ${num}`);
|
|
118
|
+
ThrowException(exception);
|
|
119
|
+
}
|
|
120
|
+
// Validate equality constraint (if specified, value must exactly match)
|
|
121
|
+
if (args.eq !== undefined && num !== args.eq) {
|
|
122
|
+
SetExceptionMessage(exception, `Expected value to equal ${args.eq} but received ${num}`);
|
|
123
|
+
ThrowException(exception);
|
|
124
|
+
}
|
|
125
|
+
// Validate greater than constraint (exclusive - value must be strictly greater)
|
|
126
|
+
if (args.gt !== undefined && num <= args.gt) {
|
|
127
|
+
SetExceptionMessage(exception, `Expected value > ${args.gt} but received ${num}`);
|
|
128
|
+
ThrowException(exception);
|
|
129
|
+
}
|
|
130
|
+
// Validate greater than or equal constraint (inclusive - value can equal the bound)
|
|
131
|
+
if (args.gte !== undefined && num < args.gte) {
|
|
132
|
+
SetExceptionMessage(exception, `Expected value >= ${args.gte} but received ${num}`);
|
|
133
|
+
ThrowException(exception);
|
|
134
|
+
}
|
|
135
|
+
// Validate less than constraint (exclusive - value must be strictly less)
|
|
136
|
+
if (args.lt !== undefined && num >= args.lt) {
|
|
137
|
+
SetExceptionMessage(exception, `Expected value < ${args.lt} but received ${num}`);
|
|
138
|
+
ThrowException(exception);
|
|
139
|
+
}
|
|
140
|
+
// Validate less than or equal constraint (inclusive - value can equal the bound)
|
|
141
|
+
if (args.lte !== undefined && num > args.lte) {
|
|
142
|
+
SetExceptionMessage(exception, `Expected value <= ${args.lte} but received ${num}`);
|
|
143
|
+
ThrowException(exception);
|
|
148
144
|
}
|
|
149
145
|
}
|
|
150
|
-
//# sourceMappingURL=assert.js.map
|