@stryke/helpers 0.9.26 → 0.9.28
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/CHANGELOG.md +16 -0
- package/dist/arg-identity.cjs +1 -1
- package/dist/arg-identity.d.cts +14 -2
- package/dist/arg-identity.d.cts.map +1 -0
- package/dist/arg-identity.d.mts +14 -2
- package/dist/arg-identity.d.mts.map +1 -0
- package/dist/arg-identity.mjs +2 -1
- package/dist/arg-identity.mjs.map +1 -0
- package/dist/convert/src/to-string-key.cjs +1 -0
- package/dist/convert/src/to-string-key.mjs +2 -0
- package/dist/convert/src/to-string-key.mjs.map +1 -0
- package/dist/debounce.cjs +1 -1
- package/dist/debounce.d.cts +47 -2
- package/dist/debounce.d.cts.map +1 -0
- package/dist/debounce.d.mts +47 -2
- package/dist/debounce.d.mts.map +1 -0
- package/dist/debounce.mjs +2 -1
- package/dist/debounce.mjs.map +1 -0
- package/dist/deep-clone.cjs +1 -1
- package/dist/deep-clone.d.cts +65 -2
- package/dist/deep-clone.d.cts.map +1 -0
- package/dist/deep-clone.d.mts +65 -2
- package/dist/deep-clone.d.mts.map +1 -0
- package/dist/deep-clone.mjs +2 -1
- package/dist/deep-clone.mjs.map +1 -0
- package/dist/deep-merge.cjs +1 -1
- package/dist/deep-merge.d.cts +26 -2
- package/dist/deep-merge.d.cts.map +1 -0
- package/dist/deep-merge.d.mts +26 -2
- package/dist/deep-merge.d.mts.map +1 -0
- package/dist/deep-merge.mjs +2 -1
- package/dist/deep-merge.mjs.map +1 -0
- package/dist/delay.cjs +1 -1
- package/dist/delay.d.cts +77 -2
- package/dist/delay.d.cts.map +1 -0
- package/dist/delay.d.mts +77 -2
- package/dist/delay.d.mts.map +1 -0
- package/dist/delay.mjs +2 -1
- package/dist/delay.mjs.map +1 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.mjs +2 -1
- package/dist/errors.mjs.map +1 -0
- package/dist/filter-empty.cjs +1 -1
- package/dist/filter-empty.d.cts +5 -2
- package/dist/filter-empty.d.cts.map +1 -0
- package/dist/filter-empty.d.mts +5 -2
- package/dist/filter-empty.d.mts.map +1 -0
- package/dist/filter-empty.mjs +2 -1
- package/dist/filter-empty.mjs.map +1 -0
- package/dist/flatten-object.cjs +1 -1
- package/dist/flatten-object.d.cts +35 -2
- package/dist/flatten-object.d.cts.map +1 -0
- package/dist/flatten-object.d.mts +35 -2
- package/dist/flatten-object.d.mts.map +1 -0
- package/dist/flatten-object.mjs +2 -1
- package/dist/flatten-object.mjs.map +1 -0
- package/dist/get-field.cjs +1 -1
- package/dist/get-field.d.cts +254 -2
- package/dist/get-field.d.cts.map +1 -0
- package/dist/get-field.d.mts +254 -2
- package/dist/get-field.d.mts.map +1 -0
- package/dist/get-field.mjs +2 -1
- package/dist/get-field.mjs.map +1 -0
- package/dist/get-ordered-by.cjs +1 -1
- package/dist/get-ordered-by.d.cts +39 -2
- package/dist/get-ordered-by.d.cts.map +1 -0
- package/dist/get-ordered-by.d.mts +39 -2
- package/dist/get-ordered-by.d.mts.map +1 -0
- package/dist/get-ordered-by.mjs +2 -1
- package/dist/get-ordered-by.mjs.map +1 -0
- package/dist/get-unique.cjs +1 -1
- package/dist/get-unique.d.cts +26 -2
- package/dist/get-unique.d.cts.map +1 -0
- package/dist/get-unique.d.mts +26 -2
- package/dist/get-unique.d.mts.map +1 -0
- package/dist/get-unique.mjs +2 -1
- package/dist/get-unique.mjs.map +1 -0
- package/dist/identity.cjs +1 -1
- package/dist/identity.d.cts +18 -2
- package/dist/identity.d.cts.map +1 -0
- package/dist/identity.d.mts +18 -2
- package/dist/identity.d.mts.map +1 -0
- package/dist/identity.mjs +2 -1
- package/dist/identity.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +31 -31
- package/dist/index.d.mts +31 -31
- package/dist/index.mjs +1 -1
- package/dist/is-equal.cjs +1 -1
- package/dist/is-equal.d.cts +22 -2
- package/dist/is-equal.d.cts.map +1 -0
- package/dist/is-equal.d.mts +22 -2
- package/dist/is-equal.d.mts.map +1 -0
- package/dist/is-equal.mjs +2 -1
- package/dist/is-equal.mjs.map +1 -0
- package/dist/lru-cache.cjs +1 -1
- package/dist/lru-cache.d.cts +103 -2
- package/dist/lru-cache.d.cts.map +1 -0
- package/dist/lru-cache.d.mts +103 -2
- package/dist/lru-cache.d.mts.map +1 -0
- package/dist/lru-cache.mjs +2 -1
- package/dist/lru-cache.mjs.map +1 -0
- package/dist/match-sorter.cjs +1 -1
- package/dist/match-sorter.d.cts +78 -2
- package/dist/match-sorter.d.cts.map +1 -0
- package/dist/match-sorter.d.mts +78 -2
- package/dist/match-sorter.d.mts.map +1 -0
- package/dist/match-sorter.mjs +2 -1
- package/dist/match-sorter.mjs.map +1 -0
- package/dist/memoize.cjs +1 -1
- package/dist/memoize.d.cts +11 -2
- package/dist/memoize.d.cts.map +1 -0
- package/dist/memoize.d.mts +11 -2
- package/dist/memoize.d.mts.map +1 -0
- package/dist/memoize.mjs +2 -1
- package/dist/memoize.mjs.map +1 -0
- package/dist/mutex.cjs +1 -1
- package/dist/mutex.d.cts +72 -2
- package/dist/mutex.d.cts.map +1 -0
- package/dist/mutex.d.mts +72 -2
- package/dist/mutex.d.mts.map +1 -0
- package/dist/mutex.mjs +2 -1
- package/dist/mutex.mjs.map +1 -0
- package/dist/noop.cjs +1 -1
- package/dist/noop.d.cts +22 -2
- package/dist/noop.d.cts.map +1 -0
- package/dist/noop.d.mts +22 -2
- package/dist/noop.d.mts.map +1 -0
- package/dist/noop.mjs +2 -1
- package/dist/noop.mjs.map +1 -0
- package/dist/omit.cjs +1 -1
- package/dist/omit.d.cts +22 -2
- package/dist/omit.d.cts.map +1 -0
- package/dist/omit.d.mts +22 -2
- package/dist/omit.d.mts.map +1 -0
- package/dist/omit.mjs +2 -1
- package/dist/omit.mjs.map +1 -0
- package/dist/once.cjs +1 -1
- package/dist/once.d.cts +13 -2
- package/dist/once.d.cts.map +1 -0
- package/dist/once.d.mts +13 -2
- package/dist/once.d.mts.map +1 -0
- package/dist/once.mjs +2 -1
- package/dist/once.mjs.map +1 -0
- package/dist/pick.cjs +1 -1
- package/dist/pick.d.cts +22 -2
- package/dist/pick.d.cts.map +1 -0
- package/dist/pick.d.mts +22 -2
- package/dist/pick.d.mts.map +1 -0
- package/dist/pick.mjs +2 -1
- package/dist/pick.mjs.map +1 -0
- package/dist/remove-accents.cjs +1 -1
- package/dist/remove-accents.d.cts +12 -2
- package/dist/remove-accents.d.cts.map +1 -0
- package/dist/remove-accents.d.mts +12 -2
- package/dist/remove-accents.d.mts.map +1 -0
- package/dist/remove-accents.mjs +2 -1
- package/dist/remove-accents.mjs.map +1 -0
- package/dist/remove-empty-items.cjs +1 -1
- package/dist/remove-empty-items.d.cts +11 -2
- package/dist/remove-empty-items.d.cts.map +1 -0
- package/dist/remove-empty-items.d.mts +11 -2
- package/dist/remove-empty-items.d.mts.map +1 -0
- package/dist/remove-empty-items.mjs +2 -1
- package/dist/remove-empty-items.mjs.map +1 -0
- package/dist/semaphore.cjs +1 -1
- package/dist/semaphore.d.cts +86 -2
- package/dist/semaphore.d.cts.map +1 -0
- package/dist/semaphore.d.mts +86 -2
- package/dist/semaphore.d.mts.map +1 -0
- package/dist/semaphore.mjs +2 -1
- package/dist/semaphore.mjs.map +1 -0
- package/dist/set-field.cjs +1 -1
- package/dist/set-field.d.cts +16 -2
- package/dist/set-field.d.cts.map +1 -0
- package/dist/set-field.d.mts +16 -2
- package/dist/set-field.d.mts.map +1 -0
- package/dist/set-field.mjs +2 -1
- package/dist/set-field.mjs.map +1 -0
- package/dist/throttle.cjs +1 -1
- package/dist/throttle.d.cts +32 -2
- package/dist/throttle.d.cts.map +1 -0
- package/dist/throttle.d.mts +32 -2
- package/dist/throttle.d.mts.map +1 -0
- package/dist/throttle.mjs +2 -1
- package/dist/throttle.mjs.map +1 -0
- package/dist/timeout.cjs +1 -1
- package/dist/timeout.d.cts +12 -2
- package/dist/timeout.d.cts.map +1 -0
- package/dist/timeout.d.mts +12 -2
- package/dist/timeout.d.mts.map +1 -0
- package/dist/timeout.mjs +2 -1
- package/dist/timeout.mjs.map +1 -0
- package/dist/to-deep-key.cjs +1 -1
- package/dist/to-deep-key.d.cts +42 -2
- package/dist/to-deep-key.d.cts.map +1 -0
- package/dist/to-deep-key.d.mts +42 -2
- package/dist/to-deep-key.d.mts.map +1 -0
- package/dist/to-deep-key.mjs +2 -1
- package/dist/to-deep-key.mjs.map +1 -0
- package/dist/to-path.cjs +1 -1
- package/dist/to-path.d.cts +24 -2
- package/dist/to-path.d.cts.map +1 -0
- package/dist/to-path.d.mts +24 -2
- package/dist/to-path.d.mts.map +1 -0
- package/dist/to-path.mjs +2 -1
- package/dist/to-path.mjs.map +1 -0
- package/dist/type-checks/src/get-object-tag.cjs +1 -0
- package/dist/type-checks/src/get-object-tag.mjs +2 -0
- package/dist/type-checks/src/get-object-tag.mjs.map +1 -0
- package/dist/type-checks/src/is-deep-key.cjs +1 -0
- package/dist/type-checks/src/is-deep-key.mjs +2 -0
- package/dist/type-checks/src/is-deep-key.mjs.map +1 -0
- package/dist/type-checks/src/is-empty.cjs +1 -0
- package/dist/type-checks/src/is-empty.mjs +2 -0
- package/dist/type-checks/src/is-empty.mjs.map +1 -0
- package/dist/type-checks/src/is-function.cjs +1 -0
- package/dist/type-checks/src/is-function.mjs +2 -0
- package/dist/type-checks/src/is-function.mjs.map +1 -0
- package/dist/type-checks/src/is-mergeable-object.cjs +1 -0
- package/dist/type-checks/src/is-mergeable-object.mjs +2 -0
- package/dist/type-checks/src/is-mergeable-object.mjs.map +1 -0
- package/dist/type-checks/src/is-non-null-object.cjs +1 -0
- package/dist/type-checks/src/is-non-null-object.mjs +2 -0
- package/dist/type-checks/src/is-non-null-object.mjs.map +1 -0
- package/dist/type-checks/src/is-null.cjs +1 -0
- package/dist/type-checks/src/is-null.mjs +2 -0
- package/dist/type-checks/src/is-null.mjs.map +1 -0
- package/dist/type-checks/src/is-number.cjs +1 -0
- package/dist/type-checks/src/is-number.mjs +2 -0
- package/dist/type-checks/src/is-number.mjs.map +1 -0
- package/dist/type-checks/src/is-object-index.cjs +1 -0
- package/dist/type-checks/src/is-object-index.mjs +2 -0
- package/dist/type-checks/src/is-object-index.mjs.map +1 -0
- package/dist/type-checks/src/is-object.cjs +1 -0
- package/dist/type-checks/src/is-object.mjs +2 -0
- package/dist/type-checks/src/is-object.mjs.map +1 -0
- package/dist/type-checks/src/is-plain-object.cjs +1 -0
- package/dist/type-checks/src/is-plain-object.mjs +2 -0
- package/dist/type-checks/src/is-plain-object.mjs.map +1 -0
- package/dist/type-checks/src/is-primitive.cjs +1 -0
- package/dist/type-checks/src/is-primitive.mjs +2 -0
- package/dist/type-checks/src/is-primitive.mjs.map +1 -0
- package/dist/type-checks/src/is-react-element.cjs +1 -0
- package/dist/type-checks/src/is-react-element.mjs +2 -0
- package/dist/type-checks/src/is-react-element.mjs.map +1 -0
- package/dist/type-checks/src/is-set-string.cjs +1 -0
- package/dist/type-checks/src/is-set-string.mjs +2 -0
- package/dist/type-checks/src/is-set-string.mjs.map +1 -0
- package/dist/type-checks/src/is-set.cjs +1 -0
- package/dist/type-checks/src/is-set.mjs +2 -0
- package/dist/type-checks/src/is-set.mjs.map +1 -0
- package/dist/{is-string-CvmuuuDj.mjs → type-checks/src/is-string.cjs} +1 -2
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/is-typed-array.cjs +1 -0
- package/dist/type-checks/src/is-typed-array.mjs +2 -0
- package/dist/type-checks/src/is-typed-array.mjs.map +1 -0
- package/dist/type-checks/src/is-undefined.cjs +1 -0
- package/dist/type-checks/src/is-undefined.mjs +2 -0
- package/dist/type-checks/src/is-undefined.mjs.map +1 -0
- package/dist/type-checks/src/property-exists.cjs +1 -0
- package/dist/type-checks/src/property-exists.mjs +2 -0
- package/dist/type-checks/src/property-exists.mjs.map +1 -0
- package/dist/types/src/base.d.cts +6 -0
- package/dist/types/src/base.d.cts.map +1 -0
- package/dist/types/src/base.d.mts +6 -0
- package/dist/types/src/base.d.mts.map +1 -0
- package/dist/types/src/json.d.cts +28 -0
- package/dist/types/src/json.d.cts.map +1 -0
- package/dist/types/src/json.d.mts +28 -0
- package/dist/types/src/json.d.mts.map +1 -0
- package/dist/{object-CHmrmQna.d.mts → types/src/object.d.cts} +6 -40
- package/dist/types/src/object.d.cts.map +1 -0
- package/dist/{object-D8HGAGMr.d.cts → types/src/object.d.mts} +6 -40
- package/dist/types/src/object.d.mts.map +1 -0
- package/dist/types/src/string.d.cts +6 -0
- package/dist/types/src/string.d.cts.map +1 -0
- package/dist/types/src/string.d.mts +6 -0
- package/dist/types/src/string.d.mts.map +1 -0
- package/dist/types/src/utilities.d.cts +7 -0
- package/dist/types/src/utilities.d.cts.map +1 -0
- package/dist/types/src/utilities.d.mts +7 -0
- package/dist/types/src/utilities.d.mts.map +1 -0
- package/dist/unflatten-object.cjs +1 -1
- package/dist/unflatten-object.d.cts +35 -2
- package/dist/unflatten-object.d.cts.map +1 -0
- package/dist/unflatten-object.d.mts +35 -2
- package/dist/unflatten-object.d.mts.map +1 -0
- package/dist/unflatten-object.mjs +2 -1
- package/dist/unflatten-object.mjs.map +1 -0
- package/dist/union.cjs +1 -1
- package/dist/union.d.cts +24 -2
- package/dist/union.d.cts.map +1 -0
- package/dist/union.d.mts +24 -2
- package/dist/union.d.mts.map +1 -0
- package/dist/union.mjs +2 -1
- package/dist/union.mjs.map +1 -0
- package/dist/with-timeout.cjs +1 -1
- package/dist/with-timeout.d.cts +24 -2
- package/dist/with-timeout.d.cts.map +1 -0
- package/dist/with-timeout.d.mts +24 -2
- package/dist/with-timeout.d.mts.map +1 -0
- package/dist/with-timeout.mjs +2 -1
- package/dist/with-timeout.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/arg-identity-BIir8uzO.d.mts +0 -14
- package/dist/arg-identity-BIir8uzO.d.mts.map +0 -1
- package/dist/arg-identity-BfviduMt.mjs +0 -2
- package/dist/arg-identity-BfviduMt.mjs.map +0 -1
- package/dist/arg-identity-C-pVjd0u.d.cts +0 -14
- package/dist/arg-identity-C-pVjd0u.d.cts.map +0 -1
- package/dist/arg-identity-dlKw6BsD.cjs +0 -1
- package/dist/debounce-C5O3IDKy.mjs +0 -2
- package/dist/debounce-C5O3IDKy.mjs.map +0 -1
- package/dist/debounce-CIMf8-Yr.d.mts +0 -47
- package/dist/debounce-CIMf8-Yr.d.mts.map +0 -1
- package/dist/debounce-CLb-VvJv.d.cts +0 -47
- package/dist/debounce-CLb-VvJv.d.cts.map +0 -1
- package/dist/debounce-SIYbhEOF.cjs +0 -1
- package/dist/deep-clone-BlN5QTtW.mjs +0 -2
- package/dist/deep-clone-BlN5QTtW.mjs.map +0 -1
- package/dist/deep-clone-CoUy-Hrt.cjs +0 -1
- package/dist/deep-clone-CpLJcTgz.d.mts +0 -65
- package/dist/deep-clone-CpLJcTgz.d.mts.map +0 -1
- package/dist/deep-clone-jRNy1xoj.d.cts +0 -65
- package/dist/deep-clone-jRNy1xoj.d.cts.map +0 -1
- package/dist/deep-merge-BDZ6c79O.mjs +0 -2
- package/dist/deep-merge-BDZ6c79O.mjs.map +0 -1
- package/dist/deep-merge-BpFjvumi.cjs +0 -1
- package/dist/deep-merge-C9qDSleg.d.cts +0 -26
- package/dist/deep-merge-C9qDSleg.d.cts.map +0 -1
- package/dist/deep-merge-eCT712Cv.d.mts +0 -26
- package/dist/deep-merge-eCT712Cv.d.mts.map +0 -1
- package/dist/delay-Bd_sGzMj.d.mts +0 -77
- package/dist/delay-Bd_sGzMj.d.mts.map +0 -1
- package/dist/delay-UwR_fCwt.cjs +0 -1
- package/dist/delay-VkcrQf1l.d.cts +0 -77
- package/dist/delay-VkcrQf1l.d.cts.map +0 -1
- package/dist/delay-wdNbY6sk.mjs +0 -2
- package/dist/delay-wdNbY6sk.mjs.map +0 -1
- package/dist/errors-BXYY8wXj.cjs +0 -1
- package/dist/errors-DWX9ET_b.mjs +0 -2
- package/dist/errors-DWX9ET_b.mjs.map +0 -1
- package/dist/filter-empty-5_nMg04e.cjs +0 -1
- package/dist/filter-empty-BMtd0K07.d.mts +0 -5
- package/dist/filter-empty-BMtd0K07.d.mts.map +0 -1
- package/dist/filter-empty-C2fq9M7o.d.cts +0 -5
- package/dist/filter-empty-C2fq9M7o.d.cts.map +0 -1
- package/dist/filter-empty-Dsc1ymCj.mjs +0 -2
- package/dist/filter-empty-Dsc1ymCj.mjs.map +0 -1
- package/dist/flatten-object-Bk2VT-b2.d.mts +0 -35
- package/dist/flatten-object-Bk2VT-b2.d.mts.map +0 -1
- package/dist/flatten-object-D-EbEZqR.cjs +0 -1
- package/dist/flatten-object-DFCZmly9.mjs +0 -2
- package/dist/flatten-object-DFCZmly9.mjs.map +0 -1
- package/dist/flatten-object-DjaJJaY0.d.cts +0 -35
- package/dist/flatten-object-DjaJJaY0.d.cts.map +0 -1
- package/dist/get-field-5XqtknPs.d.mts +0 -254
- package/dist/get-field-5XqtknPs.d.mts.map +0 -1
- package/dist/get-field-D4F_p-Ov.cjs +0 -1
- package/dist/get-field-ngQ9O38X.mjs +0 -2
- package/dist/get-field-ngQ9O38X.mjs.map +0 -1
- package/dist/get-field-oltWWNRO.d.cts +0 -254
- package/dist/get-field-oltWWNRO.d.cts.map +0 -1
- package/dist/get-object-tag-D53RvMgo.cjs +0 -1
- package/dist/get-object-tag-oBoWkttN.mjs +0 -2
- package/dist/get-object-tag-oBoWkttN.mjs.map +0 -1
- package/dist/get-ordered-by-C45FfW2T.d.mts +0 -39
- package/dist/get-ordered-by-C45FfW2T.d.mts.map +0 -1
- package/dist/get-ordered-by-CBKKJr4R.mjs +0 -2
- package/dist/get-ordered-by-CBKKJr4R.mjs.map +0 -1
- package/dist/get-ordered-by-D2Sr6vUN.cjs +0 -1
- package/dist/get-ordered-by-DuD7QRma.d.cts +0 -39
- package/dist/get-ordered-by-DuD7QRma.d.cts.map +0 -1
- package/dist/get-unique-BOiakY6A.cjs +0 -1
- package/dist/get-unique-C0SBPUBv.d.cts +0 -26
- package/dist/get-unique-C0SBPUBv.d.cts.map +0 -1
- package/dist/get-unique-DZ6E1Kvc.d.mts +0 -26
- package/dist/get-unique-DZ6E1Kvc.d.mts.map +0 -1
- package/dist/get-unique-DzZ7Z34U.mjs +0 -2
- package/dist/get-unique-DzZ7Z34U.mjs.map +0 -1
- package/dist/identity-B_cGeF8o.d.mts +0 -18
- package/dist/identity-B_cGeF8o.d.mts.map +0 -1
- package/dist/identity-DBwwvmGU.mjs +0 -2
- package/dist/identity-DBwwvmGU.mjs.map +0 -1
- package/dist/identity-DRhIvbPG.d.cts +0 -18
- package/dist/identity-DRhIvbPG.d.cts.map +0 -1
- package/dist/identity-z2xaIqpe.cjs +0 -1
- package/dist/is-empty-C7vlSVFD.mjs +0 -2
- package/dist/is-empty-C7vlSVFD.mjs.map +0 -1
- package/dist/is-empty-DZZDqzjD.cjs +0 -1
- package/dist/is-equal-0Z-K2uIG.mjs +0 -2
- package/dist/is-equal-0Z-K2uIG.mjs.map +0 -1
- package/dist/is-equal-BJgVhUVS.cjs +0 -1
- package/dist/is-equal-BMlMHlVi.d.cts +0 -22
- package/dist/is-equal-BMlMHlVi.d.cts.map +0 -1
- package/dist/is-equal-Baqurdpn.d.mts +0 -22
- package/dist/is-equal-Baqurdpn.d.mts.map +0 -1
- package/dist/is-number-BcjxCzDM.cjs +0 -1
- package/dist/is-number-bwhfkHlC.mjs +0 -2
- package/dist/is-number-bwhfkHlC.mjs.map +0 -1
- package/dist/is-plain-object-BQuFhL4M.cjs +0 -1
- package/dist/is-plain-object-D8GSMOhY.mjs +0 -2
- package/dist/is-plain-object-D8GSMOhY.mjs.map +0 -1
- package/dist/is-set-B9o0NIT4.mjs +0 -2
- package/dist/is-set-B9o0NIT4.mjs.map +0 -1
- package/dist/is-set-ByJOY6h2.cjs +0 -1
- package/dist/is-set-string-48_jZFw0.cjs +0 -1
- package/dist/is-set-string-Dr1MlMk0.mjs +0 -2
- package/dist/is-set-string-Dr1MlMk0.mjs.map +0 -1
- package/dist/is-string-CvmuuuDj.mjs.map +0 -1
- package/dist/is-string-DPanLeA_.cjs +0 -1
- package/dist/lru-cache-CzQ_kKXk.d.mts +0 -103
- package/dist/lru-cache-CzQ_kKXk.d.mts.map +0 -1
- package/dist/lru-cache-D4VEIgtR.d.cts +0 -103
- package/dist/lru-cache-D4VEIgtR.d.cts.map +0 -1
- package/dist/lru-cache-DLY_yZRN.mjs +0 -2
- package/dist/lru-cache-DLY_yZRN.mjs.map +0 -1
- package/dist/lru-cache-DgTSGx5W.cjs +0 -1
- package/dist/match-sorter-B9_7YvTo.mjs +0 -2
- package/dist/match-sorter-B9_7YvTo.mjs.map +0 -1
- package/dist/match-sorter-BjnWjkKu.cjs +0 -1
- package/dist/match-sorter-CMYN3GuY.d.cts +0 -78
- package/dist/match-sorter-CMYN3GuY.d.cts.map +0 -1
- package/dist/match-sorter-DCRerxVe.d.mts +0 -78
- package/dist/match-sorter-DCRerxVe.d.mts.map +0 -1
- package/dist/memoize-Cr5jFKxi.mjs +0 -2
- package/dist/memoize-Cr5jFKxi.mjs.map +0 -1
- package/dist/memoize-TyrmWrfR.d.mts +0 -11
- package/dist/memoize-TyrmWrfR.d.mts.map +0 -1
- package/dist/memoize-qxvbI-0y.cjs +0 -1
- package/dist/memoize-tSTYY522.d.cts +0 -11
- package/dist/memoize-tSTYY522.d.cts.map +0 -1
- package/dist/mutex-CnQQBndt.cjs +0 -1
- package/dist/mutex-DAZduiSP.d.mts +0 -72
- package/dist/mutex-DAZduiSP.d.mts.map +0 -1
- package/dist/mutex-DCyX7B66.d.cts +0 -72
- package/dist/mutex-DCyX7B66.d.cts.map +0 -1
- package/dist/mutex-TqoKHosg.mjs +0 -2
- package/dist/mutex-TqoKHosg.mjs.map +0 -1
- package/dist/noop-B7OetrhD.mjs +0 -2
- package/dist/noop-B7OetrhD.mjs.map +0 -1
- package/dist/noop-BnXKMH6Z.d.mts +0 -22
- package/dist/noop-BnXKMH6Z.d.mts.map +0 -1
- package/dist/noop-CnJXOCpF.d.cts +0 -22
- package/dist/noop-CnJXOCpF.d.cts.map +0 -1
- package/dist/noop-Dpf7hIui.cjs +0 -1
- package/dist/object-CHmrmQna.d.mts.map +0 -1
- package/dist/object-D8HGAGMr.d.cts.map +0 -1
- package/dist/omit-A0uVyAS4.cjs +0 -1
- package/dist/omit-BROsDK0D.mjs +0 -2
- package/dist/omit-BROsDK0D.mjs.map +0 -1
- package/dist/omit-D1FKiOYz.d.cts +0 -22
- package/dist/omit-D1FKiOYz.d.cts.map +0 -1
- package/dist/omit-DpqOAtKt.d.mts +0 -22
- package/dist/omit-DpqOAtKt.d.mts.map +0 -1
- package/dist/once-DNPPQd3P.d.mts +0 -13
- package/dist/once-DNPPQd3P.d.mts.map +0 -1
- package/dist/once-DZCwmdkv.cjs +0 -1
- package/dist/once-DqmxXwEB.d.cts +0 -13
- package/dist/once-DqmxXwEB.d.cts.map +0 -1
- package/dist/once-txoW63yJ.mjs +0 -2
- package/dist/once-txoW63yJ.mjs.map +0 -1
- package/dist/pick-CuXTvXaw.mjs +0 -2
- package/dist/pick-CuXTvXaw.mjs.map +0 -1
- package/dist/pick-DXREvZBr.d.cts +0 -22
- package/dist/pick-DXREvZBr.d.cts.map +0 -1
- package/dist/pick-GDOwAh6I.cjs +0 -1
- package/dist/pick-ZrWD4de2.d.mts +0 -22
- package/dist/pick-ZrWD4de2.d.mts.map +0 -1
- package/dist/remove-accents-BFmyvTRZ.mjs +0 -2
- package/dist/remove-accents-BFmyvTRZ.mjs.map +0 -1
- package/dist/remove-accents-C4C0A2ex.d.mts +0 -12
- package/dist/remove-accents-C4C0A2ex.d.mts.map +0 -1
- package/dist/remove-accents-CXBUC-Id.cjs +0 -1
- package/dist/remove-accents-Yo3-2jWO.d.cts +0 -12
- package/dist/remove-accents-Yo3-2jWO.d.cts.map +0 -1
- package/dist/remove-empty-items-BglsRCyG.d.cts +0 -11
- package/dist/remove-empty-items-BglsRCyG.d.cts.map +0 -1
- package/dist/remove-empty-items-BzI9Vid9.mjs +0 -2
- package/dist/remove-empty-items-BzI9Vid9.mjs.map +0 -1
- package/dist/remove-empty-items-COwdCPHC.d.mts +0 -11
- package/dist/remove-empty-items-COwdCPHC.d.mts.map +0 -1
- package/dist/remove-empty-items-CjTxJuyS.cjs +0 -1
- package/dist/semaphore-4zJqtox8.mjs +0 -2
- package/dist/semaphore-4zJqtox8.mjs.map +0 -1
- package/dist/semaphore-CsGTxqsW.d.cts +0 -86
- package/dist/semaphore-CsGTxqsW.d.cts.map +0 -1
- package/dist/semaphore-DkHqPlow.cjs +0 -1
- package/dist/semaphore-WaZBtCk5.d.mts +0 -86
- package/dist/semaphore-WaZBtCk5.d.mts.map +0 -1
- package/dist/set-field-CUgbKEjW.mjs +0 -2
- package/dist/set-field-CUgbKEjW.mjs.map +0 -1
- package/dist/set-field-CcCiXZNl.d.cts +0 -16
- package/dist/set-field-CcCiXZNl.d.cts.map +0 -1
- package/dist/set-field-DyvXgpNP.d.mts +0 -16
- package/dist/set-field-DyvXgpNP.d.mts.map +0 -1
- package/dist/set-field-mr4GkhFb.cjs +0 -1
- package/dist/throttle-BOKOTo3m.cjs +0 -1
- package/dist/throttle-BWPQuZty.d.cts +0 -32
- package/dist/throttle-BWPQuZty.d.cts.map +0 -1
- package/dist/throttle-BgU4k6qs.d.mts +0 -32
- package/dist/throttle-BgU4k6qs.d.mts.map +0 -1
- package/dist/throttle-CYK3F0mZ.mjs +0 -2
- package/dist/throttle-CYK3F0mZ.mjs.map +0 -1
- package/dist/timeout-43rG9ETK.mjs +0 -2
- package/dist/timeout-43rG9ETK.mjs.map +0 -1
- package/dist/timeout-CLhwG-oo.d.mts +0 -12
- package/dist/timeout-CLhwG-oo.d.mts.map +0 -1
- package/dist/timeout-CoYbhliP.cjs +0 -1
- package/dist/timeout-DC38jHR8.d.cts +0 -12
- package/dist/timeout-DC38jHR8.d.cts.map +0 -1
- package/dist/to-deep-key-Cma9aiEz.cjs +0 -1
- package/dist/to-deep-key-D8uDBd6T.mjs +0 -2
- package/dist/to-deep-key-D8uDBd6T.mjs.map +0 -1
- package/dist/to-deep-key-DO-Z0Zjs.d.mts +0 -42
- package/dist/to-deep-key-DO-Z0Zjs.d.mts.map +0 -1
- package/dist/to-deep-key-DlsE4ziE.d.cts +0 -42
- package/dist/to-deep-key-DlsE4ziE.d.cts.map +0 -1
- package/dist/to-path-BajxeMmo.d.mts +0 -24
- package/dist/to-path-BajxeMmo.d.mts.map +0 -1
- package/dist/to-path-CdOFd4od.cjs +0 -1
- package/dist/to-path-D2zWXeYc.d.cts +0 -24
- package/dist/to-path-D2zWXeYc.d.cts.map +0 -1
- package/dist/to-path-Dm1fe-Ix.mjs +0 -2
- package/dist/to-path-Dm1fe-Ix.mjs.map +0 -1
- package/dist/unflatten-object-C7TE8J80.mjs +0 -2
- package/dist/unflatten-object-C7TE8J80.mjs.map +0 -1
- package/dist/unflatten-object-CPJIUozj.d.mts +0 -35
- package/dist/unflatten-object-CPJIUozj.d.mts.map +0 -1
- package/dist/unflatten-object-CvZj41LG.cjs +0 -1
- package/dist/unflatten-object-Cvbj7Q__.d.cts +0 -35
- package/dist/unflatten-object-Cvbj7Q__.d.cts.map +0 -1
- package/dist/union-BMOMEzO-.d.cts +0 -24
- package/dist/union-BMOMEzO-.d.cts.map +0 -1
- package/dist/union-C-2CRoFc.mjs +0 -2
- package/dist/union-C-2CRoFc.mjs.map +0 -1
- package/dist/union-D4bbjM2i.d.mts +0 -24
- package/dist/union-D4bbjM2i.d.mts.map +0 -1
- package/dist/union-EwdcZzNT.cjs +0 -1
- package/dist/with-timeout-BPaAIZtS.d.cts +0 -24
- package/dist/with-timeout-BPaAIZtS.d.cts.map +0 -1
- package/dist/with-timeout-BoZYdcOg.d.mts +0 -24
- package/dist/with-timeout-BoZYdcOg.d.mts.map +0 -1
- package/dist/with-timeout-CAuUr1ck.mjs +0 -2
- package/dist/with-timeout-CAuUr1ck.mjs.map +0 -1
- package/dist/with-timeout-CPUBGT4X.cjs +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
1
|
+
import { argIdentity } from "./arg-identity.cjs";
|
|
2
|
+
import { DebounceOptions, debounce } from "./debounce.cjs";
|
|
3
|
+
import { Resolved, deepClone } from "./deep-clone.cjs";
|
|
4
|
+
import { DeepMergeOptions, deepMerge } from "./deep-merge.cjs";
|
|
5
|
+
import { delay, sleep } from "./delay.cjs";
|
|
6
|
+
import { filterEmpty } from "./filter-empty.cjs";
|
|
7
|
+
import { flattenObject } from "./flatten-object.cjs";
|
|
8
|
+
import { GetField, getField } from "./get-field.cjs";
|
|
9
|
+
import { getOrderedBy } from "./get-ordered-by.cjs";
|
|
10
|
+
import { getUnique, getUniqueBy } from "./get-unique.cjs";
|
|
11
|
+
import { identity } from "./identity.cjs";
|
|
12
|
+
import { isEqual } from "./is-equal.cjs";
|
|
13
|
+
import { LRUCache } from "./lru-cache.cjs";
|
|
14
|
+
import { KeyAttributes, KeyAttributesOptions, KeyOption, MatchSorterOptions, RankingInfo, ValueGetterKey, defaultBaseSortFn, matchSorter, rankings } from "./match-sorter.cjs";
|
|
15
|
+
import { memoizeOnId } from "./memoize.cjs";
|
|
16
|
+
import { Mutex } from "./mutex.cjs";
|
|
17
|
+
import { asyncNoop, noop } from "./noop.cjs";
|
|
18
|
+
import { omit } from "./omit.cjs";
|
|
19
|
+
import { once, safeFunctionCast } from "./once.cjs";
|
|
20
|
+
import { pick } from "./pick.cjs";
|
|
21
|
+
import { characterMap, removeAccents } from "./remove-accents.cjs";
|
|
22
|
+
import { removeEmptyItems } from "./remove-empty-items.cjs";
|
|
23
|
+
import { Semaphore } from "./semaphore.cjs";
|
|
24
|
+
import { setField } from "./set-field.cjs";
|
|
25
|
+
import { throttle } from "./throttle.cjs";
|
|
26
|
+
import { timeout } from "./timeout.cjs";
|
|
27
|
+
import { addPathToDeepKey, toDeepKey } from "./to-deep-key.cjs";
|
|
28
|
+
import { toPath } from "./to-path.cjs";
|
|
29
|
+
import { unflattenObject } from "./unflatten-object.cjs";
|
|
30
|
+
import { union } from "./union.cjs";
|
|
31
|
+
import { withTimeout } from "./with-timeout.cjs";
|
|
32
32
|
export { DebounceOptions, DeepMergeOptions, GetField, KeyAttributes, KeyAttributesOptions, KeyOption, LRUCache, MatchSorterOptions, Mutex, RankingInfo, Resolved, Semaphore, ValueGetterKey, addPathToDeepKey, argIdentity, asyncNoop, characterMap, debounce, deepClone, deepMerge, defaultBaseSortFn, delay, filterEmpty, flattenObject, getField, getOrderedBy, getUnique, getUniqueBy, identity, isEqual, matchSorter, memoizeOnId, noop, omit, once, pick, rankings, removeAccents, removeEmptyItems, safeFunctionCast, setField, sleep, throttle, timeout, toDeepKey, toPath, unflattenObject, union, withTimeout };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
1
|
+
import { argIdentity } from "./arg-identity.mjs";
|
|
2
|
+
import { DebounceOptions, debounce } from "./debounce.mjs";
|
|
3
|
+
import { Resolved, deepClone } from "./deep-clone.mjs";
|
|
4
|
+
import { DeepMergeOptions, deepMerge } from "./deep-merge.mjs";
|
|
5
|
+
import { delay, sleep } from "./delay.mjs";
|
|
6
|
+
import { filterEmpty } from "./filter-empty.mjs";
|
|
7
|
+
import { flattenObject } from "./flatten-object.mjs";
|
|
8
|
+
import { GetField, getField } from "./get-field.mjs";
|
|
9
|
+
import { getOrderedBy } from "./get-ordered-by.mjs";
|
|
10
|
+
import { getUnique, getUniqueBy } from "./get-unique.mjs";
|
|
11
|
+
import { identity } from "./identity.mjs";
|
|
12
|
+
import { isEqual } from "./is-equal.mjs";
|
|
13
|
+
import { LRUCache } from "./lru-cache.mjs";
|
|
14
|
+
import { KeyAttributes, KeyAttributesOptions, KeyOption, MatchSorterOptions, RankingInfo, ValueGetterKey, defaultBaseSortFn, matchSorter, rankings } from "./match-sorter.mjs";
|
|
15
|
+
import { memoizeOnId } from "./memoize.mjs";
|
|
16
|
+
import { Mutex } from "./mutex.mjs";
|
|
17
|
+
import { asyncNoop, noop } from "./noop.mjs";
|
|
18
|
+
import { omit } from "./omit.mjs";
|
|
19
|
+
import { once, safeFunctionCast } from "./once.mjs";
|
|
20
|
+
import { pick } from "./pick.mjs";
|
|
21
|
+
import { characterMap, removeAccents } from "./remove-accents.mjs";
|
|
22
|
+
import { removeEmptyItems } from "./remove-empty-items.mjs";
|
|
23
|
+
import { Semaphore } from "./semaphore.mjs";
|
|
24
|
+
import { setField } from "./set-field.mjs";
|
|
25
|
+
import { throttle } from "./throttle.mjs";
|
|
26
|
+
import { timeout } from "./timeout.mjs";
|
|
27
|
+
import { addPathToDeepKey, toDeepKey } from "./to-deep-key.mjs";
|
|
28
|
+
import { toPath } from "./to-path.mjs";
|
|
29
|
+
import { unflattenObject } from "./unflatten-object.mjs";
|
|
30
|
+
import { union } from "./union.mjs";
|
|
31
|
+
import { withTimeout } from "./with-timeout.mjs";
|
|
32
32
|
export { DebounceOptions, DeepMergeOptions, GetField, KeyAttributes, KeyAttributesOptions, KeyOption, LRUCache, MatchSorterOptions, Mutex, RankingInfo, Resolved, Semaphore, ValueGetterKey, addPathToDeepKey, argIdentity, asyncNoop, characterMap, debounce, deepClone, deepMerge, defaultBaseSortFn, delay, filterEmpty, flattenObject, getField, getOrderedBy, getUnique, getUniqueBy, identity, isEqual, matchSorter, memoizeOnId, noop, omit, once, pick, rankings, removeAccents, removeEmptyItems, safeFunctionCast, setField, sleep, throttle, timeout, toDeepKey, toPath, unflattenObject, union, withTimeout };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{argIdentity as e}from"./arg-identity.mjs";import{debounce as t}from"./debounce.mjs";import{deepClone as n}from"./deep-clone.mjs";import{deepMerge as r}from"./deep-merge.mjs";import{delay as i,sleep as a}from"./delay.mjs";import{filterEmpty as o}from"./filter-empty.mjs";import{flattenObject as s}from"./flatten-object.mjs";import{toPath as c}from"./to-path.mjs";import{getField as l}from"./get-field.mjs";import{getOrderedBy as u}from"./get-ordered-by.mjs";import{getUnique as d,getUniqueBy as f}from"./get-unique.mjs";import{identity as p}from"./identity.mjs";import{isEqual as m}from"./is-equal.mjs";import{LRUCache as h}from"./lru-cache.mjs";import{characterMap as g,removeAccents as _}from"./remove-accents.mjs";import{defaultBaseSortFn as v,matchSorter as y,rankings as b}from"./match-sorter.mjs";import{memoizeOnId as x}from"./memoize.mjs";import{Semaphore as S}from"./semaphore.mjs";import{Mutex as C}from"./mutex.mjs";import{asyncNoop as w,noop as T}from"./noop.mjs";import{omit as E}from"./omit.mjs";import{once as D,safeFunctionCast as O}from"./once.mjs";import{pick as k}from"./pick.mjs";import{removeEmptyItems as A}from"./remove-empty-items.mjs";import{setField as j}from"./set-field.mjs";import{throttle as M}from"./throttle.mjs";import{timeout as N}from"./timeout.mjs";import{addPathToDeepKey as P,toDeepKey as F}from"./to-deep-key.mjs";import{unflattenObject as I}from"./unflatten-object.mjs";import{union as L}from"./union.mjs";import{withTimeout as R}from"./with-timeout.mjs";export{h as LRUCache,C as Mutex,S as Semaphore,P as addPathToDeepKey,e as argIdentity,w as asyncNoop,g as characterMap,t as debounce,n as deepClone,r as deepMerge,v as defaultBaseSortFn,i as delay,o as filterEmpty,s as flattenObject,l as getField,u as getOrderedBy,d as getUnique,f as getUniqueBy,p as identity,m as isEqual,y as matchSorter,x as memoizeOnId,T as noop,E as omit,D as once,k as pick,b as rankings,_ as removeAccents,A as removeEmptyItems,O as safeFunctionCast,j as setField,a as sleep,M as throttle,N as timeout,F as toDeepKey,c as toPath,I as unflattenObject,L as union,R as withTimeout};
|
package/dist/is-equal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./is-
|
|
1
|
+
const e=require(`./type-checks/src/is-set.cjs`),t=require(`./type-checks/src/is-set-string.cjs`),n=typeof Map==`function`,r=typeof Set==`function`,i=typeof ArrayBuffer==`function`&&ArrayBuffer.isView!==void 0;function a(o,s){if(o===s)return!0;if(o&&s&&typeof o==`object`&&typeof s==`object`){if(o.constructor!==s.constructor)return!1;let c;if(Array.isArray(o)){if(c=o.length,c!=s.length)return!1;for(let e=c;e--!==0;)if(!a(o[e],s[e]))return!1;return!0}let l;if(n&&o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;l=o.entries();let e;for(;!(e=l.next()).done;)if(!s.has(e.value[0]))return!1;for(l=o.entries();!(e=l.next()).done;)if(!a(e.value[1],s.get(e.value[0])))return!1;return!0}if(r&&o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;l=o.entries();let e;for(;!(e=l.next()).done;)if(!s.has(e.value[0]))return!1;return!0}if(Array.isArray(o)&&Array.isArray(s)&&i&&ArrayBuffer.isView(o)&&ArrayBuffer.isView(s)){if(c=o.length,c!=s.length)return!1;for(let e=c;e--!==0;)if(o[e]!==s[e])return!1;return!0}if(o.constructor===RegExp)return o.source===s.source&&o.flags===s.flags;if(o.valueOf!==Object.prototype.valueOf&&typeof o.valueOf==`function`&&typeof s.valueOf==`function`)return o.valueOf()===s.valueOf();if(o.toString!==Object.prototype.toString&&typeof o.toString==`function`&&typeof s.toString==`function`)return o.toString()===s.toString();let u=Object.keys(o);if(c=u.length,c!==Object.keys(s).length)return!1;for(let n=c;n--!==0;)if(!e.isSet(n)||!t.isSetString(u[n])||!Object.prototype.hasOwnProperty.call(s,u[n]))return!1;for(let n=c;n--!==0;)if(!(Array.isArray(u)&&(u[n]===`_owner`||u[n]===`__v`||u[n]===`__o`)&&o.$$typeof)&&(!e.isSet(n)||!t.isSetString(u[n])||!a(o[u[n]],s[u[n]])))return!1;return!0}return o!==o&&s!==s}function o(e,t){try{return a(e,t)}catch(e){if(/stack|recursion/i.test(e?.message||``))return console.warn(`isEqual cannot handle circular refs`),!1;throw e}}exports.isEqual=o;
|
package/dist/is-equal.d.cts
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/is-equal.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* isEqual(1, 1); // true
|
|
8
|
+
* isEqual({ a: 1 }, { a: 1 }); // true
|
|
9
|
+
* isEqual(/abc/g, /abc/g); // true
|
|
10
|
+
* isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true
|
|
11
|
+
* isEqual([1, 2, 3], [1, 2, 3]); // true
|
|
12
|
+
* isEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); // true
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param a - The first value to compare.
|
|
16
|
+
* @param b - The second value to compare.
|
|
17
|
+
* @returns `true` if the values are equal, otherwise `false`.
|
|
18
|
+
*/
|
|
19
|
+
declare function isEqual(a: any, b: any): boolean;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isEqual };
|
|
22
|
+
//# sourceMappingURL=is-equal.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-equal.d.cts","names":[],"sources":["../src/is-equal.ts"],"sourcesContent":[],"mappings":";;AA8JA;;;;;;;;;;;;;;;;iBAAgB,OAAA"}
|
package/dist/is-equal.d.mts
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/is-equal.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* isEqual(1, 1); // true
|
|
8
|
+
* isEqual({ a: 1 }, { a: 1 }); // true
|
|
9
|
+
* isEqual(/abc/g, /abc/g); // true
|
|
10
|
+
* isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true
|
|
11
|
+
* isEqual([1, 2, 3], [1, 2, 3]); // true
|
|
12
|
+
* isEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); // true
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param a - The first value to compare.
|
|
16
|
+
* @param b - The second value to compare.
|
|
17
|
+
* @returns `true` if the values are equal, otherwise `false`.
|
|
18
|
+
*/
|
|
19
|
+
declare function isEqual(a: any, b: any): boolean;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isEqual };
|
|
22
|
+
//# sourceMappingURL=is-equal.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-equal.d.mts","names":[],"sources":["../src/is-equal.ts"],"sourcesContent":[],"mappings":";;AA8JA;;;;;;;;;;;;;;;;iBAAgB,OAAA"}
|
package/dist/is-equal.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isSet as e}from"./type-checks/src/is-set.mjs";import{isSetString as t}from"./type-checks/src/is-set-string.mjs";const n=typeof Map==`function`,r=typeof Set==`function`,i=typeof ArrayBuffer==`function`&&ArrayBuffer.isView!==void 0;function a(o,s){if(o===s)return!0;if(o&&s&&typeof o==`object`&&typeof s==`object`){if(o.constructor!==s.constructor)return!1;let c;if(Array.isArray(o)){if(c=o.length,c!=s.length)return!1;for(let e=c;e--!==0;)if(!a(o[e],s[e]))return!1;return!0}let l;if(n&&o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;l=o.entries();let e;for(;!(e=l.next()).done;)if(!s.has(e.value[0]))return!1;for(l=o.entries();!(e=l.next()).done;)if(!a(e.value[1],s.get(e.value[0])))return!1;return!0}if(r&&o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;l=o.entries();let e;for(;!(e=l.next()).done;)if(!s.has(e.value[0]))return!1;return!0}if(Array.isArray(o)&&Array.isArray(s)&&i&&ArrayBuffer.isView(o)&&ArrayBuffer.isView(s)){if(c=o.length,c!=s.length)return!1;for(let e=c;e--!==0;)if(o[e]!==s[e])return!1;return!0}if(o.constructor===RegExp)return o.source===s.source&&o.flags===s.flags;if(o.valueOf!==Object.prototype.valueOf&&typeof o.valueOf==`function`&&typeof s.valueOf==`function`)return o.valueOf()===s.valueOf();if(o.toString!==Object.prototype.toString&&typeof o.toString==`function`&&typeof s.toString==`function`)return o.toString()===s.toString();let u=Object.keys(o);if(c=u.length,c!==Object.keys(s).length)return!1;for(let n=c;n--!==0;)if(!e(n)||!t(u[n])||!Object.prototype.hasOwnProperty.call(s,u[n]))return!1;for(let n=c;n--!==0;)if(!(Array.isArray(u)&&(u[n]===`_owner`||u[n]===`__v`||u[n]===`__o`)&&o.$$typeof)&&(!e(n)||!t(u[n])||!a(o[u[n]],s[u[n]])))return!1;return!0}return o!==o&&s!==s}function o(e,t){try{return a(e,t)}catch(e){if(/stack|recursion/i.test(e?.message||``))return console.warn(`isEqual cannot handle circular refs`),!1;throw e}}export{o as isEqual};
|
|
2
|
+
//# sourceMappingURL=is-equal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-equal.mjs","names":[],"sources":["../src/is-equal.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\n\nconst hasMap = typeof Map === \"function\";\nconst hasSet = typeof Set === \"function\";\nconst hasArrayBuffer =\n typeof ArrayBuffer === \"function\" && ArrayBuffer.isView !== undefined;\n\nfunction equal(a: any, b: any) {\n if (a === b) {\n return true;\n }\n\n if (a && b && typeof a === \"object\" && typeof b === \"object\") {\n if (a.constructor !== b.constructor) {\n return false;\n }\n\n let length;\n if (Array.isArray(a)) {\n length = a.length;\n\n if (length != b.length) return false;\n for (let i = length; i-- !== 0; ) if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n let it;\n if (hasMap && a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n it = a.entries();\n let i;\n while (!(i = it.next()).done) if (!b.has(i.value[0])) return false;\n it = a.entries();\n while (!(i = it.next()).done) {\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n }\n return true;\n }\n\n if (hasSet && a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n it = a.entries();\n let i;\n while (!(i = it.next()).done) if (!b.has(i.value[0])) return false;\n return true;\n }\n\n if (\n Array.isArray(a) &&\n Array.isArray(b) &&\n hasArrayBuffer &&\n ArrayBuffer.isView(a) &&\n ArrayBuffer.isView(b)\n ) {\n length = a.length;\n\n if (length != b.length) return false;\n for (let i = length; i-- !== 0; ) if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (\n a.valueOf !== Object.prototype.valueOf &&\n typeof a.valueOf === \"function\" &&\n typeof b.valueOf === \"function\"\n ) {\n // eslint-disable-next-line ts/no-unsafe-call\n return a.valueOf() === b.valueOf();\n }\n if (\n a.toString !== Object.prototype.toString &&\n typeof a.toString === \"function\" &&\n typeof b.toString === \"function\"\n ) {\n // eslint-disable-next-line ts/no-unsafe-call\n return a.toString() === b.toString();\n }\n\n const keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n\n for (let i = length; i-- !== 0; ) {\n if (\n !isSet(i) ||\n !isSetString(keys[i]) ||\n !Object.prototype.hasOwnProperty.call(b, keys[i] as any)\n ) {\n return false;\n }\n }\n\n for (let i = length; i-- !== 0; ) {\n if (\n Array.isArray(keys) &&\n (keys[i] === \"_owner\" || keys[i] === \"__v\" || keys[i] === \"__o\") &&\n a.$$typeof\n ) {\n continue;\n }\n\n if (\n !isSet(i) ||\n !isSetString(keys[i]) ||\n !equal(a[keys[i] as any], b[keys[i] as any])\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n // eslint-disable-next-line no-self-compare\n return a !== a && b !== b;\n}\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @example\n * ```ts\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n * isEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); // true\n * ```\n *\n * @param a - The first value to compare.\n * @param b - The second value to compare.\n * @returns `true` if the values are equal, otherwise `false`.\n */\nexport function isEqual(a: any, b: any): boolean {\n try {\n return equal(a, b);\n } catch (error) {\n if (/stack|recursion/i.test((error as any)?.message || \"\")) {\n // eslint-disable-next-line no-console\n console.warn(\"isEqual cannot handle circular refs\");\n\n return false;\n }\n\n throw error;\n }\n}\n"],"mappings":"uHAoBA,MAAM,EAAS,OAAO,KAAQ,WACxB,EAAS,OAAO,KAAQ,WACxB,EACJ,OAAO,aAAgB,YAAc,YAAY,SAAW,IAAA,GAE9D,SAAS,EAAM,EAAQ,EAAQ,CAC7B,GAAI,IAAM,EACR,MAAO,GAGT,GAAI,GAAK,GAAK,OAAO,GAAM,UAAY,OAAO,GAAM,SAAU,CAC5D,GAAI,EAAE,cAAgB,EAAE,YACtB,MAAO,GAGT,IAAI,EACJ,GAAI,MAAM,QAAQ,EAAE,CAAE,CAGpB,GAFA,EAAS,EAAE,OAEP,GAAU,EAAE,OAAQ,MAAO,GAC/B,IAAK,IAAI,EAAI,EAAQ,MAAQ,GAAK,GAAI,CAAC,EAAM,EAAE,GAAI,EAAE,GAAG,CAAE,MAAO,GACjE,MAAO,GAGT,IAAI,EACJ,GAAI,GAAU,aAAa,KAAO,aAAa,IAAK,CAClD,GAAI,EAAE,OAAS,EAAE,KAAM,MAAO,GAC9B,EAAK,EAAE,SAAS,CAChB,IAAI,EACJ,KAAO,EAAE,EAAI,EAAG,MAAM,EAAE,MAAM,GAAI,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAE,MAAO,GAE7D,IADA,EAAK,EAAE,SAAS,CACT,EAAE,EAAI,EAAG,MAAM,EAAE,MACtB,GAAI,CAAC,EAAM,EAAE,MAAM,GAAI,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAE,MAAO,GAEpD,MAAO,GAGT,GAAI,GAAU,aAAa,KAAO,aAAa,IAAK,CAClD,GAAI,EAAE,OAAS,EAAE,KAAM,MAAO,GAC9B,EAAK,EAAE,SAAS,CAChB,IAAI,EACJ,KAAO,EAAE,EAAI,EAAG,MAAM,EAAE,MAAM,GAAI,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAE,MAAO,GAC7D,MAAO,GAGT,GACE,MAAM,QAAQ,EAAE,EAChB,MAAM,QAAQ,EAAE,EAChB,GACA,YAAY,OAAO,EAAE,EACrB,YAAY,OAAO,EAAE,CACrB,CAGA,GAFA,EAAS,EAAE,OAEP,GAAU,EAAE,OAAQ,MAAO,GAC/B,IAAK,IAAI,EAAI,EAAQ,MAAQ,GAAK,GAAI,EAAE,KAAO,EAAE,GAAI,MAAO,GAC5D,MAAO,GAGT,GAAI,EAAE,cAAgB,OACpB,OAAO,EAAE,SAAW,EAAE,QAAU,EAAE,QAAU,EAAE,MAGhD,GACE,EAAE,UAAY,OAAO,UAAU,SAC/B,OAAO,EAAE,SAAY,YACrB,OAAO,EAAE,SAAY,WAGrB,OAAO,EAAE,SAAS,GAAK,EAAE,SAAS,CAEpC,GACE,EAAE,WAAa,OAAO,UAAU,UAChC,OAAO,EAAE,UAAa,YACtB,OAAO,EAAE,UAAa,WAGtB,OAAO,EAAE,UAAU,GAAK,EAAE,UAAU,CAGtC,IAAM,EAAO,OAAO,KAAK,EAAE,CAE3B,GADA,EAAS,EAAK,OACV,IAAW,OAAO,KAAK,EAAE,CAAC,OAC5B,MAAO,GAGT,IAAK,IAAI,EAAI,EAAQ,MAAQ,GAC3B,GACE,CAAC,EAAM,EAAE,EACT,CAAC,EAAY,EAAK,GAAG,EACrB,CAAC,OAAO,UAAU,eAAe,KAAK,EAAG,EAAK,GAAU,CAExD,MAAO,GAIX,IAAK,IAAI,EAAI,EAAQ,MAAQ,GAEzB,WAAM,QAAQ,EAAK,GAClB,EAAK,KAAO,UAAY,EAAK,KAAO,OAAS,EAAK,KAAO,QAC1D,EAAE,YAMF,CAAC,EAAM,EAAE,EACT,CAAC,EAAY,EAAK,GAAG,EACrB,CAAC,EAAM,EAAE,EAAK,IAAY,EAAE,EAAK,IAAW,EAE5C,MAAO,GAIX,MAAO,GAIT,OAAO,IAAM,GAAK,IAAM,EAoB1B,SAAgB,EAAQ,EAAQ,EAAiB,CAC/C,GAAI,CACF,OAAO,EAAM,EAAG,EAAE,OACX,EAAO,CACd,GAAI,mBAAmB,KAAM,GAAe,SAAW,GAAG,CAIxD,OAFA,QAAQ,KAAK,sCAAsC,CAE5C,GAGT,MAAM"}
|
package/dist/lru-cache.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=class{key;data;size;prev=null;next=null;constructor(e,t,n){this.key=e,this.data=t,this.size=n}},t=class{prev=null;next=null},n=class{cache=new Map;head;tail;totalSize=0;maxSize;calculateSize;constructor(e,n){this.maxSize=e,this.calculateSize=n,this.head=new t,this.tail=new t,this.head.next=this.tail,this.tail.prev=this.head}addToHead(e){e.prev=this.head,e.next=this.head.next,this.head.next.prev=e,this.head.next=e}removeNode(e){e.prev.next=e.next,e.next.prev=e.prev}moveToHead(e){this.removeNode(e),this.addToHead(e)}removeTail(){let e=this.tail.prev;return this.removeNode(e),e}set(t,n){let r=this.calculateSize?.(n)??1;if(r>this.maxSize)return;let i=this.cache.get(t);if(i)i.data=n,this.totalSize=this.totalSize-i.size+r,i.size=r,this.moveToHead(i);else{let i=new e(t,n,r);this.cache.set(t,i),this.addToHead(i),this.totalSize+=r}for(;this.totalSize>this.maxSize&&this.cache.size>0;){let e=this.removeTail();this.cache.delete(e.key),this.totalSize-=e.size}}has(e){return this.cache.has(e)}get(e){let t=this.cache.get(e);if(t)return this.moveToHead(t),t.data}*[Symbol.iterator](){let e=this.head.next;for(;e&&e!==this.tail;){let t=e;yield[t.key,t.data],e=e.next}}remove(e){let t=this.cache.get(e);t&&(this.removeNode(t),this.cache.delete(e),this.totalSize-=t.size)}get size(){return this.cache.size}get currentSize(){return this.totalSize}};exports.LRUCache=n;
|
package/dist/lru-cache.d.cts
CHANGED
|
@@ -1,2 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/lru-cache.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* LRU (Least Recently Used) Cache implementation using a doubly-linked list
|
|
4
|
+
* and hash map for O(1) operations.
|
|
5
|
+
*
|
|
6
|
+
* Algorithm:
|
|
7
|
+
* - Uses a doubly-linked list to maintain access order (most recent at head)
|
|
8
|
+
* - Hash map provides O(1) key-to-node lookup
|
|
9
|
+
* - Sentinel head/tail nodes simplify edge case handling
|
|
10
|
+
* - Size-based eviction supports custom size calculation functions
|
|
11
|
+
*
|
|
12
|
+
* Data Structure Layout:
|
|
13
|
+
* HEAD \<-\> [most recent] \<-\> ... \<-\> [least recent] \<-\> TAIL
|
|
14
|
+
*
|
|
15
|
+
* Operations:
|
|
16
|
+
* - get(): Move accessed node to head (mark as most recent)
|
|
17
|
+
* - set(): Add new node at head, evict from tail if over capacity
|
|
18
|
+
* - Eviction: Remove least recent node (tail.prev) when size exceeds limit
|
|
19
|
+
*/
|
|
20
|
+
declare class LRUCache<T> {
|
|
21
|
+
private readonly cache;
|
|
22
|
+
private readonly head;
|
|
23
|
+
private readonly tail;
|
|
24
|
+
private totalSize;
|
|
25
|
+
private readonly maxSize;
|
|
26
|
+
private readonly calculateSize;
|
|
27
|
+
constructor(maxSize: number, calculateSize?: (value: T) => number);
|
|
28
|
+
/**
|
|
29
|
+
* Adds a node immediately after the head (marks as most recently used). Used when inserting new items or when an item is accessed. **PRECONDITION:** node must be disconnected (prev/next should be null)
|
|
30
|
+
*
|
|
31
|
+
* @param node - The node to add after the head.
|
|
32
|
+
*/
|
|
33
|
+
private addToHead;
|
|
34
|
+
/**
|
|
35
|
+
* Removes a node from its current position in the doubly-linked list. Updates the prev/next pointers of adjacent nodes to maintain list integrity. **PRECONDITION:** node must be connected (prev/next are non-null)
|
|
36
|
+
*
|
|
37
|
+
* @param node - The node to remove from the list.
|
|
38
|
+
*/
|
|
39
|
+
private removeNode;
|
|
40
|
+
/**
|
|
41
|
+
* Moves an existing node to the head position (marks as most recently used). This is the core LRU operation - accessed items become most recent.
|
|
42
|
+
*
|
|
43
|
+
* @param node - The node to move to the head.
|
|
44
|
+
*/
|
|
45
|
+
private moveToHead;
|
|
46
|
+
/**
|
|
47
|
+
* Removes and returns the least recently used node (the one before tail). This is called during eviction when the cache exceeds capacity. **PRECONDITION:** cache is not empty (ensured by caller)
|
|
48
|
+
*
|
|
49
|
+
* @returns The removed least recently used node.
|
|
50
|
+
*/
|
|
51
|
+
private removeTail;
|
|
52
|
+
/**
|
|
53
|
+
* Sets a key-value pair in the cache.
|
|
54
|
+
* If the key exists, updates the value and moves to head.
|
|
55
|
+
* If new, adds at head and evicts from tail if necessary.
|
|
56
|
+
*
|
|
57
|
+
* Time Complexity:
|
|
58
|
+
* - O(1) for uniform item sizes
|
|
59
|
+
* - O(k) where k is the number of items evicted (can be O(N) for variable sizes)
|
|
60
|
+
*
|
|
61
|
+
* @param key - The key to set.
|
|
62
|
+
* @param value - The value to set.
|
|
63
|
+
*/
|
|
64
|
+
set(key: string, value: T): void;
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a key exists in the cache.
|
|
67
|
+
* This is a pure query operation - does NOT update LRU order.
|
|
68
|
+
*
|
|
69
|
+
* Time Complexity: O(1)
|
|
70
|
+
*/
|
|
71
|
+
has(key: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves a value by key and marks it as most recently used.
|
|
74
|
+
* Moving to head maintains the LRU property for future evictions.
|
|
75
|
+
*
|
|
76
|
+
* Time Complexity: O(1)
|
|
77
|
+
*/
|
|
78
|
+
get(key: string): T | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Returns an iterator over the cache entries. The order is outputted in the
|
|
81
|
+
* order of most recently used to least recently used.
|
|
82
|
+
*/
|
|
83
|
+
[Symbol.iterator](): IterableIterator<[string, T]>;
|
|
84
|
+
/**
|
|
85
|
+
* Removes a specific key from the cache.
|
|
86
|
+
* Updates both the hash map and doubly-linked list.
|
|
87
|
+
*
|
|
88
|
+
* Time Complexity: O(1)
|
|
89
|
+
*/
|
|
90
|
+
remove(key: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the number of items in the cache.
|
|
93
|
+
*/
|
|
94
|
+
get size(): number;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the current total size of all cached items.
|
|
97
|
+
* This uses the custom size calculation if provided.
|
|
98
|
+
*/
|
|
99
|
+
get currentSize(): number;
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { LRUCache };
|
|
103
|
+
//# sourceMappingURL=lru-cache.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.d.cts","names":[],"sources":["../src/lru-cache.ts"],"sourcesContent":[],"mappings":";;AAgEA;;;;;;;;;;;;;;;;;cAAa;;;;;;;uDAa0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAsEtB;;;;;;;;;;;;;;oBA8CN;;;;;GAchB,MAAA,CAAO,QAAA,KAAa,0BAA0B"}
|
package/dist/lru-cache.d.mts
CHANGED
|
@@ -1,2 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/lru-cache.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* LRU (Least Recently Used) Cache implementation using a doubly-linked list
|
|
4
|
+
* and hash map for O(1) operations.
|
|
5
|
+
*
|
|
6
|
+
* Algorithm:
|
|
7
|
+
* - Uses a doubly-linked list to maintain access order (most recent at head)
|
|
8
|
+
* - Hash map provides O(1) key-to-node lookup
|
|
9
|
+
* - Sentinel head/tail nodes simplify edge case handling
|
|
10
|
+
* - Size-based eviction supports custom size calculation functions
|
|
11
|
+
*
|
|
12
|
+
* Data Structure Layout:
|
|
13
|
+
* HEAD \<-\> [most recent] \<-\> ... \<-\> [least recent] \<-\> TAIL
|
|
14
|
+
*
|
|
15
|
+
* Operations:
|
|
16
|
+
* - get(): Move accessed node to head (mark as most recent)
|
|
17
|
+
* - set(): Add new node at head, evict from tail if over capacity
|
|
18
|
+
* - Eviction: Remove least recent node (tail.prev) when size exceeds limit
|
|
19
|
+
*/
|
|
20
|
+
declare class LRUCache<T> {
|
|
21
|
+
private readonly cache;
|
|
22
|
+
private readonly head;
|
|
23
|
+
private readonly tail;
|
|
24
|
+
private totalSize;
|
|
25
|
+
private readonly maxSize;
|
|
26
|
+
private readonly calculateSize;
|
|
27
|
+
constructor(maxSize: number, calculateSize?: (value: T) => number);
|
|
28
|
+
/**
|
|
29
|
+
* Adds a node immediately after the head (marks as most recently used). Used when inserting new items or when an item is accessed. **PRECONDITION:** node must be disconnected (prev/next should be null)
|
|
30
|
+
*
|
|
31
|
+
* @param node - The node to add after the head.
|
|
32
|
+
*/
|
|
33
|
+
private addToHead;
|
|
34
|
+
/**
|
|
35
|
+
* Removes a node from its current position in the doubly-linked list. Updates the prev/next pointers of adjacent nodes to maintain list integrity. **PRECONDITION:** node must be connected (prev/next are non-null)
|
|
36
|
+
*
|
|
37
|
+
* @param node - The node to remove from the list.
|
|
38
|
+
*/
|
|
39
|
+
private removeNode;
|
|
40
|
+
/**
|
|
41
|
+
* Moves an existing node to the head position (marks as most recently used). This is the core LRU operation - accessed items become most recent.
|
|
42
|
+
*
|
|
43
|
+
* @param node - The node to move to the head.
|
|
44
|
+
*/
|
|
45
|
+
private moveToHead;
|
|
46
|
+
/**
|
|
47
|
+
* Removes and returns the least recently used node (the one before tail). This is called during eviction when the cache exceeds capacity. **PRECONDITION:** cache is not empty (ensured by caller)
|
|
48
|
+
*
|
|
49
|
+
* @returns The removed least recently used node.
|
|
50
|
+
*/
|
|
51
|
+
private removeTail;
|
|
52
|
+
/**
|
|
53
|
+
* Sets a key-value pair in the cache.
|
|
54
|
+
* If the key exists, updates the value and moves to head.
|
|
55
|
+
* If new, adds at head and evicts from tail if necessary.
|
|
56
|
+
*
|
|
57
|
+
* Time Complexity:
|
|
58
|
+
* - O(1) for uniform item sizes
|
|
59
|
+
* - O(k) where k is the number of items evicted (can be O(N) for variable sizes)
|
|
60
|
+
*
|
|
61
|
+
* @param key - The key to set.
|
|
62
|
+
* @param value - The value to set.
|
|
63
|
+
*/
|
|
64
|
+
set(key: string, value: T): void;
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a key exists in the cache.
|
|
67
|
+
* This is a pure query operation - does NOT update LRU order.
|
|
68
|
+
*
|
|
69
|
+
* Time Complexity: O(1)
|
|
70
|
+
*/
|
|
71
|
+
has(key: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves a value by key and marks it as most recently used.
|
|
74
|
+
* Moving to head maintains the LRU property for future evictions.
|
|
75
|
+
*
|
|
76
|
+
* Time Complexity: O(1)
|
|
77
|
+
*/
|
|
78
|
+
get(key: string): T | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Returns an iterator over the cache entries. The order is outputted in the
|
|
81
|
+
* order of most recently used to least recently used.
|
|
82
|
+
*/
|
|
83
|
+
[Symbol.iterator](): IterableIterator<[string, T]>;
|
|
84
|
+
/**
|
|
85
|
+
* Removes a specific key from the cache.
|
|
86
|
+
* Updates both the hash map and doubly-linked list.
|
|
87
|
+
*
|
|
88
|
+
* Time Complexity: O(1)
|
|
89
|
+
*/
|
|
90
|
+
remove(key: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the number of items in the cache.
|
|
93
|
+
*/
|
|
94
|
+
get size(): number;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the current total size of all cached items.
|
|
97
|
+
* This uses the custom size calculation if provided.
|
|
98
|
+
*/
|
|
99
|
+
get currentSize(): number;
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { LRUCache };
|
|
103
|
+
//# sourceMappingURL=lru-cache.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.d.mts","names":[],"sources":["../src/lru-cache.ts"],"sourcesContent":[],"mappings":";;AAgEA;;;;;;;;;;;;;;;;;cAAa;;;;;;;uDAa0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAsEtB;;;;;;;;;;;;;;oBA8CN;;;;;GAchB,MAAA,CAAO,QAAA,KAAa,0BAA0B"}
|
package/dist/lru-cache.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
var e=class{key;data;size;prev=null;next=null;constructor(e,t,n){this.key=e,this.data=t,this.size=n}},t=class{prev=null;next=null},n=class{cache=new Map;head;tail;totalSize=0;maxSize;calculateSize;constructor(e,n){this.maxSize=e,this.calculateSize=n,this.head=new t,this.tail=new t,this.head.next=this.tail,this.tail.prev=this.head}addToHead(e){e.prev=this.head,e.next=this.head.next,this.head.next.prev=e,this.head.next=e}removeNode(e){e.prev.next=e.next,e.next.prev=e.prev}moveToHead(e){this.removeNode(e),this.addToHead(e)}removeTail(){let e=this.tail.prev;return this.removeNode(e),e}set(t,n){let r=this.calculateSize?.(n)??1;if(r>this.maxSize)return;let i=this.cache.get(t);if(i)i.data=n,this.totalSize=this.totalSize-i.size+r,i.size=r,this.moveToHead(i);else{let i=new e(t,n,r);this.cache.set(t,i),this.addToHead(i),this.totalSize+=r}for(;this.totalSize>this.maxSize&&this.cache.size>0;){let e=this.removeTail();this.cache.delete(e.key),this.totalSize-=e.size}}has(e){return this.cache.has(e)}get(e){let t=this.cache.get(e);if(t)return this.moveToHead(t),t.data}*[Symbol.iterator](){let e=this.head.next;for(;e&&e!==this.tail;){let t=e;yield[t.key,t.data],e=e.next}}remove(e){let t=this.cache.get(e);t&&(this.removeNode(t),this.cache.delete(e),this.totalSize-=t.size)}get size(){return this.cache.size}get currentSize(){return this.totalSize}};export{n as LRUCache};
|
|
2
|
+
//# sourceMappingURL=lru-cache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.mjs","names":[],"sources":["../src/lru-cache.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nclass LRUNode<T> {\n public readonly key: string;\n\n public data: T;\n\n public size: number;\n\n public prev: LRUNode<T> | SentinelNode<T> | null = null;\n\n public next: LRUNode<T> | SentinelNode<T> | null = null;\n\n constructor(key: string, data: T, size: number) {\n this.key = key;\n this.data = data;\n this.size = size;\n }\n}\n\n/**\n * Sentinel node used for head/tail boundaries.\n * These nodes don't contain actual cache data but simplify list operations.\n */\nclass SentinelNode<T> {\n public prev: LRUNode<T> | SentinelNode<T> | null = null;\n\n public next: LRUNode<T> | SentinelNode<T> | null = null;\n}\n\n/**\n * LRU (Least Recently Used) Cache implementation using a doubly-linked list\n * and hash map for O(1) operations.\n *\n * Algorithm:\n * - Uses a doubly-linked list to maintain access order (most recent at head)\n * - Hash map provides O(1) key-to-node lookup\n * - Sentinel head/tail nodes simplify edge case handling\n * - Size-based eviction supports custom size calculation functions\n *\n * Data Structure Layout:\n * HEAD \\<-\\> [most recent] \\<-\\> ... \\<-\\> [least recent] \\<-\\> TAIL\n *\n * Operations:\n * - get(): Move accessed node to head (mark as most recent)\n * - set(): Add new node at head, evict from tail if over capacity\n * - Eviction: Remove least recent node (tail.prev) when size exceeds limit\n */\nexport class LRUCache<T> {\n private readonly cache: Map<string, LRUNode<T>> = new Map();\n\n private readonly head: SentinelNode<T>;\n\n private readonly tail: SentinelNode<T>;\n\n private totalSize: number = 0;\n\n private readonly maxSize: number;\n\n private readonly calculateSize: ((value: T) => number) | undefined;\n\n constructor(maxSize: number, calculateSize?: (value: T) => number) {\n this.maxSize = maxSize;\n this.calculateSize = calculateSize;\n\n // Create sentinel nodes to simplify doubly-linked list operations\n // HEAD <-> TAIL (empty list)\n this.head = new SentinelNode<T>();\n this.tail = new SentinelNode<T>();\n this.head.next = this.tail;\n this.tail.prev = this.head;\n }\n\n /**\n * Adds a node immediately after the head (marks as most recently used). Used when inserting new items or when an item is accessed. **PRECONDITION:** node must be disconnected (prev/next should be null)\n *\n * @param node - The node to add after the head.\n */\n private addToHead(node: LRUNode<T>): void {\n node.prev = this.head;\n node.next = this.head.next;\n // head.next is always non-null (points to tail or another node)\n this.head.next!.prev = node;\n this.head.next = node;\n }\n\n /**\n * Removes a node from its current position in the doubly-linked list. Updates the prev/next pointers of adjacent nodes to maintain list integrity. **PRECONDITION:** node must be connected (prev/next are non-null)\n *\n * @param node - The node to remove from the list.\n */\n private removeNode(node: LRUNode<T>): void {\n // Connected nodes always have non-null prev/next\n node.prev!.next = node.next;\n node.next!.prev = node.prev;\n }\n\n /**\n * Moves an existing node to the head position (marks as most recently used). This is the core LRU operation - accessed items become most recent.\n *\n * @param node - The node to move to the head.\n */\n private moveToHead(node: LRUNode<T>): void {\n this.removeNode(node);\n this.addToHead(node);\n }\n\n /**\n * Removes and returns the least recently used node (the one before tail). This is called during eviction when the cache exceeds capacity. **PRECONDITION:** cache is not empty (ensured by caller)\n *\n * @returns The removed least recently used node.\n */\n private removeTail(): LRUNode<T> {\n const lastNode = this.tail.prev as LRUNode<T>;\n // tail.prev is always non-null and always LRUNode when cache is not empty\n this.removeNode(lastNode);\n return lastNode;\n }\n\n /**\n * Sets a key-value pair in the cache.\n * If the key exists, updates the value and moves to head.\n * If new, adds at head and evicts from tail if necessary.\n *\n * Time Complexity:\n * - O(1) for uniform item sizes\n * - O(k) where k is the number of items evicted (can be O(N) for variable sizes)\n *\n * @param key - The key to set.\n * @param value - The value to set.\n */\n public set(key: string, value: T): void {\n const size = this.calculateSize?.(value) ?? 1;\n if (size > this.maxSize) {\n // console.warn(\"Single item size exceeds maxSize\");\n return;\n }\n\n const existing = this.cache.get(key);\n if (existing) {\n // Update existing node: adjust size and move to head (most recent)\n existing.data = value;\n this.totalSize = this.totalSize - existing.size + size;\n existing.size = size;\n this.moveToHead(existing);\n } else {\n // Add new node at head (most recent position)\n const newNode = new LRUNode(key, value, size);\n this.cache.set(key, newNode);\n this.addToHead(newNode);\n this.totalSize += size;\n }\n\n // Evict least recently used items until under capacity\n while (this.totalSize > this.maxSize && this.cache.size > 0) {\n const tail = this.removeTail();\n this.cache.delete(tail.key);\n this.totalSize -= tail.size;\n }\n }\n\n /**\n * Checks if a key exists in the cache.\n * This is a pure query operation - does NOT update LRU order.\n *\n * Time Complexity: O(1)\n */\n public has(key: string): boolean {\n return this.cache.has(key);\n }\n\n /**\n * Retrieves a value by key and marks it as most recently used.\n * Moving to head maintains the LRU property for future evictions.\n *\n * Time Complexity: O(1)\n */\n public get(key: string): T | undefined {\n const node = this.cache.get(key);\n if (!node) return undefined;\n\n // Mark as most recently used by moving to head\n this.moveToHead(node);\n\n return node.data;\n }\n\n /**\n * Returns an iterator over the cache entries. The order is outputted in the\n * order of most recently used to least recently used.\n */\n public *[Symbol.iterator](): IterableIterator<[string, T]> {\n let current = this.head.next;\n while (current && current !== this.tail) {\n // Between head and tail, current is always LRUNode\n const node = current as LRUNode<T>;\n yield [node.key, node.data];\n current = current.next;\n }\n }\n\n /**\n * Removes a specific key from the cache.\n * Updates both the hash map and doubly-linked list.\n *\n * Time Complexity: O(1)\n */\n public remove(key: string): void {\n const node = this.cache.get(key);\n if (!node) return;\n\n this.removeNode(node);\n this.cache.delete(key);\n this.totalSize -= node.size;\n }\n\n /**\n * Returns the number of items in the cache.\n */\n public get size(): number {\n return this.cache.size;\n }\n\n /**\n * Returns the current total size of all cached items.\n * This uses the custom size calculation if provided.\n */\n public get currentSize(): number {\n return this.totalSize;\n }\n}\n"],"mappings":"AAkBA,IAAM,EAAN,KAAiB,CACf,IAEA,KAEA,KAEA,KAAmD,KAEnD,KAAmD,KAEnD,YAAY,EAAa,EAAS,EAAc,CAC9C,KAAK,IAAM,EACX,KAAK,KAAO,EACZ,KAAK,KAAO,IAQV,EAAN,KAAsB,CACpB,KAAmD,KAEnD,KAAmD,MAqBxC,EAAb,KAAyB,CACvB,MAAkD,IAAI,IAEtD,KAEA,KAEA,UAA4B,EAE5B,QAEA,cAEA,YAAY,EAAiB,EAAsC,CACjE,KAAK,QAAU,EACf,KAAK,cAAgB,EAIrB,KAAK,KAAO,IAAI,EAChB,KAAK,KAAO,IAAI,EAChB,KAAK,KAAK,KAAO,KAAK,KACtB,KAAK,KAAK,KAAO,KAAK,KAQxB,UAAkB,EAAwB,CACxC,EAAK,KAAO,KAAK,KACjB,EAAK,KAAO,KAAK,KAAK,KAEtB,KAAK,KAAK,KAAM,KAAO,EACvB,KAAK,KAAK,KAAO,EAQnB,WAAmB,EAAwB,CAEzC,EAAK,KAAM,KAAO,EAAK,KACvB,EAAK,KAAM,KAAO,EAAK,KAQzB,WAAmB,EAAwB,CACzC,KAAK,WAAW,EAAK,CACrB,KAAK,UAAU,EAAK,CAQtB,YAAiC,CAC/B,IAAM,EAAW,KAAK,KAAK,KAG3B,OADA,KAAK,WAAW,EAAS,CAClB,EAeT,IAAW,EAAa,EAAgB,CACtC,IAAM,EAAO,KAAK,gBAAgB,EAAM,EAAI,EAC5C,GAAI,EAAO,KAAK,QAEd,OAGF,IAAM,EAAW,KAAK,MAAM,IAAI,EAAI,CACpC,GAAI,EAEF,EAAS,KAAO,EAChB,KAAK,UAAY,KAAK,UAAY,EAAS,KAAO,EAClD,EAAS,KAAO,EAChB,KAAK,WAAW,EAAS,KACpB,CAEL,IAAM,EAAU,IAAI,EAAQ,EAAK,EAAO,EAAK,CAC7C,KAAK,MAAM,IAAI,EAAK,EAAQ,CAC5B,KAAK,UAAU,EAAQ,CACvB,KAAK,WAAa,EAIpB,KAAO,KAAK,UAAY,KAAK,SAAW,KAAK,MAAM,KAAO,GAAG,CAC3D,IAAM,EAAO,KAAK,YAAY,CAC9B,KAAK,MAAM,OAAO,EAAK,IAAI,CAC3B,KAAK,WAAa,EAAK,MAU3B,IAAW,EAAsB,CAC/B,OAAO,KAAK,MAAM,IAAI,EAAI,CAS5B,IAAW,EAA4B,CACrC,IAAM,EAAO,KAAK,MAAM,IAAI,EAAI,CAC3B,KAKL,OAFA,KAAK,WAAW,EAAK,CAEd,EAAK,KAOd,EAAS,OAAO,WAA2C,CACzD,IAAI,EAAU,KAAK,KAAK,KACxB,KAAO,GAAW,IAAY,KAAK,MAAM,CAEvC,IAAM,EAAO,EACb,KAAM,CAAC,EAAK,IAAK,EAAK,KAAK,CAC3B,EAAU,EAAQ,MAUtB,OAAc,EAAmB,CAC/B,IAAM,EAAO,KAAK,MAAM,IAAI,EAAI,CAC3B,IAEL,KAAK,WAAW,EAAK,CACrB,KAAK,MAAM,OAAO,EAAI,CACtB,KAAK,WAAa,EAAK,MAMzB,IAAW,MAAe,CACxB,OAAO,KAAK,MAAM,KAOpB,IAAW,aAAsB,CAC/B,OAAO,KAAK"}
|
package/dist/match-sorter.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./remove-accents
|
|
1
|
+
const e=require(`./remove-accents.cjs`),t={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},n=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function r(e,r,a={}){let{keys:o,threshold:s=t.MATCHES,baseSort:l=n,sorter:u=e=>e.sort((e,t)=>c(e,t,l))}=a;return u(e.reduce((e,t,n)=>d(e,t,n),[])).map(({item:e})=>e);function d(e,t,n){let c=i(t,o,r,a),{rank:l,keyThreshold:u=s}=c;return l>=u&&e.push({...c,item:t,index:n}),e}}r.rankings=t;function i(e,n,r,i){if(!n){let t=e;return{rankedValue:t,rank:a(t,r,i),keyIndex:-1,keyThreshold:i.threshold}}return f(e,n).reduce(({rank:e,rankedValue:n,keyIndex:o,keyThreshold:s},{itemValue:c,attributes:l},u)=>{let d=a(c,r,i),f=n,{minRanking:p,maxRanking:m,threshold:h}=l;return d<p&&d>=t.MATCHES?d=p:d>m&&(d=m),d>e&&(e=d,o=u,s=h,f=c),{rankedValue:f,rank:e,keyIndex:o,keyThreshold:s}},{rankedValue:e,rank:t.NO_MATCH,keyIndex:-1,keyThreshold:i.threshold})}function a(e,n,r){return e=l(e,r),n=l(n,r),n.length>e.length?t.NO_MATCH:e===n?t.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),n=n.toLowerCase(),e===n?t.EQUAL:e.startsWith(n)?t.STARTS_WITH:e.includes(` ${n}`)?t.WORD_STARTS_WITH:e.includes(n)?t.CONTAINS:n.length===1?t.NO_MATCH:o(e).includes(n)?t.ACRONYM:s(e,n))}function o(e){let t=``,n=e.split(` `);for(let e of n){let n=e.split(`-`);for(let e of n)t+=e.slice(0,1)}return t}function s(e,n){let r=0,i=0;function a(e,t,n){for(let i=n,a=t.length;i<a;i++)if(t[i]===e)return r+=1,i+1;return-1}function o(e){let i=1/e,a=r/n.length;return t.MATCHES+a*i}let s=a(n[0],e,0);if(s<0)return t.NO_MATCH;i=s;for(let r=1,o=n.length;r<o;r++){let o=n[r];if(i=a(o,e,i),!(i>-1))return t.NO_MATCH}return o(i-s)}function c(e,t,n){let{rank:r,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return r===a?i===o?n(e,t):i<o?-1:1:r>a?-1:1}function l(t,{keepDiacritics:n}){return t=`${t}`,n||(t=e.removeAccents(t)),t}function u(e,t){typeof t==`object`&&(t=t.key);let n;if(typeof t==`function`)n=t(e);else if(e===null)n=null;else if(Object.hasOwnProperty.call(e,t))n=e[t];else if(t.includes(`.`))return d(t,e);else n=null;return n===null?[]:Array.isArray(n)?n:[String(n)]}function d(e,t){let n=e.split(`.`),r=[t];for(let e=0,t=n.length;e<t;e++){let t=n[e],i=[];for(let e=0,n=r.length;e<n;e++){let n=r[e];if(n!==null)if(t&&Object.hasOwnProperty.call(n,t)){let e=n[t];e!==null&&i.push(e)}else n&&t===`*`&&(i=[...i,n])}r=i}return Array.isArray(r[0])?[].concat(...r):r}function f(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r],a=m(i),o=u(e,i);for(let e=0,t=o.length;e<t;e++)n.push({itemValue:o[e],attributes:a})}return n}const p={maxRanking:1/0,minRanking:-1/0};function m(e){return typeof e==`string`?p:{...p,...e}}exports.defaultBaseSortFn=n,exports.matchSorter=r,exports.rankings=t;
|
package/dist/match-sorter.d.cts
CHANGED
|
@@ -1,2 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/match-sorter.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Forked from match-sorter by Kent C. Dodds
|
|
4
|
+
*/
|
|
5
|
+
interface KeyAttributes {
|
|
6
|
+
threshold?: Ranking;
|
|
7
|
+
maxRanking: Ranking;
|
|
8
|
+
minRanking: Ranking;
|
|
9
|
+
}
|
|
10
|
+
interface RankingInfo {
|
|
11
|
+
rankedValue: string;
|
|
12
|
+
rank: Ranking;
|
|
13
|
+
keyIndex: number;
|
|
14
|
+
keyThreshold: Ranking | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface ValueGetterKey<ItemType> {
|
|
17
|
+
(item: ItemType): string | Array<string>;
|
|
18
|
+
}
|
|
19
|
+
interface IndexedItem<ItemType> {
|
|
20
|
+
item: ItemType;
|
|
21
|
+
index: number;
|
|
22
|
+
}
|
|
23
|
+
interface RankedItem<ItemType> extends RankingInfo, IndexedItem<ItemType> {}
|
|
24
|
+
interface BaseSorter<ItemType> {
|
|
25
|
+
(a: RankedItem<ItemType>, b: RankedItem<ItemType>): number;
|
|
26
|
+
}
|
|
27
|
+
interface Sorter<ItemType> {
|
|
28
|
+
(matchItems: Array<RankedItem<ItemType>>): Array<RankedItem<ItemType>>;
|
|
29
|
+
}
|
|
30
|
+
interface KeyAttributesOptions<ItemType> {
|
|
31
|
+
key?: string | ValueGetterKey<ItemType>;
|
|
32
|
+
threshold?: Ranking;
|
|
33
|
+
maxRanking?: Ranking;
|
|
34
|
+
minRanking?: Ranking;
|
|
35
|
+
}
|
|
36
|
+
type KeyOption<ItemType> = KeyAttributesOptions<ItemType> | ValueGetterKey<ItemType> | string;
|
|
37
|
+
interface MatchSorterOptions<ItemType = unknown> {
|
|
38
|
+
keys?: ReadonlyArray<KeyOption<ItemType>>;
|
|
39
|
+
threshold?: Ranking;
|
|
40
|
+
baseSort?: BaseSorter<ItemType>;
|
|
41
|
+
keepDiacritics?: boolean;
|
|
42
|
+
sorter?: Sorter<ItemType>;
|
|
43
|
+
}
|
|
44
|
+
declare const rankings: {
|
|
45
|
+
readonly CASE_SENSITIVE_EQUAL: 7;
|
|
46
|
+
readonly EQUAL: 6;
|
|
47
|
+
readonly STARTS_WITH: 5;
|
|
48
|
+
readonly WORD_STARTS_WITH: 4;
|
|
49
|
+
readonly CONTAINS: 3;
|
|
50
|
+
readonly ACRONYM: 2;
|
|
51
|
+
readonly MATCHES: 1;
|
|
52
|
+
readonly NO_MATCH: 0;
|
|
53
|
+
};
|
|
54
|
+
type Ranking = (typeof rankings)[keyof typeof rankings];
|
|
55
|
+
declare const defaultBaseSortFn: BaseSorter<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
58
|
+
* @param items - the items to sort
|
|
59
|
+
* @param value - the value to use for ranking
|
|
60
|
+
* @param options - Some options to configure the sorter
|
|
61
|
+
* @returns - the new sorted array
|
|
62
|
+
*/
|
|
63
|
+
declare function matchSorter<ItemType = string>(items: ReadonlyArray<ItemType>, value: string, options?: MatchSorterOptions<ItemType>): Array<ItemType>;
|
|
64
|
+
declare namespace matchSorter {
|
|
65
|
+
var rankings: {
|
|
66
|
+
readonly CASE_SENSITIVE_EQUAL: 7;
|
|
67
|
+
readonly EQUAL: 6;
|
|
68
|
+
readonly STARTS_WITH: 5;
|
|
69
|
+
readonly WORD_STARTS_WITH: 4;
|
|
70
|
+
readonly CONTAINS: 3;
|
|
71
|
+
readonly ACRONYM: 2;
|
|
72
|
+
readonly MATCHES: 1;
|
|
73
|
+
readonly NO_MATCH: 0;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { type KeyAttributes, type KeyAttributesOptions, type KeyOption, type MatchSorterOptions, type RankingInfo, type ValueGetterKey, defaultBaseSortFn, matchSorter, rankings };
|
|
78
|
+
//# sourceMappingURL=match-sorter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-sorter.d.cts","names":[],"sources":["../src/match-sorter.ts"],"sourcesContent":[],"mappings":";;;;UAyBU,aAAA,CAEI;EACA,SAAA,CAAA,EAFA,OAEA;EAAO,UAAA,EADP,OACO;EAEX,UAAA,EAFI,OAEO;AAIE;AAIW,UARxB,WAAA,CAUW;EAIX,WAAA,EAAU,MAAA;EAA4C,IAAA,EAZxD,OAYwD;EAAzB,QAAA,EAAA,MAAA;EAAa,YAAA,EAVpC,OAUoC,GAAA,SAAA;;AAAW,UAPrD,cASU,CAAA,QAAA,CAAA,CAAA;EACH,CAAA,IAAA,EATR,QASQ,CAAA,EAAA,MAAA,GATY,KASZ,CAAA,MAAA,CAAA;;UAPP,WAOgC,CAAA,QAAA,CAAA,CAAA;EAAX,IAAA,EANvB,QAMuB;EAAU,KAAA,EAAA,MAAA;AAAA;UAH/B,UAOsB,CAAA,QAAA,CAAA,SAPO,WAOP,EAPoB,WAOpB,CAPgC,QAOhC,CAAA,CAAA;UALtB,UAKK,CAAA,QAAA,CAAA,CAAA;EAA+C,CAAA,CAAA,EAJxD,UAIwD,CAJ7C,QAI6C,CAAA,EAAA,CAAA,EAJ/B,UAI+B,CAJpB,QAIoB,CAAA,CAAA,EAAA,MAAA;;UADpD,MACmC,CAAA,QAAA,CAAA,CAAA;EAAK,CAAA,UAAA,EAAnC,KAAmC,CAA7B,UAA6B,CAAlB,QAAkB,CAAA,CAAA,CAAA,EAAL,KAAK,CAAC,UAAD,CAAY,QAAZ,CAAA,CAAA;AAAA;UAGxC,oBACsB,CAAA,QAAA,CAAA,CAAA;EAAf,GAAA,CAAA,EAAA,MAAA,GAAA,cAAA,CAAe,QAAf,CAAA;EACH,SAAA,CAAA,EAAA,OAAA;EACC,UAAA,CAAA,EAAA,OAAA;EACA,UAAA,CAAA,EAAA,OAAA;;AAAO,KAGjB,SAAA,CAAA,QAAS,CAAA,GACV,oBADU,CACW,QADX,CAAA,GAEV,cAFU,CAEK,QAFL,CAAA,GAAA,MAAA;UAKJ,kBAJe,CAAA,WAAA,OAAA,CAAA,CAAA;EAArB,IAAA,CAAA,EAKK,aALL,CAKmB,SALnB,CAK6B,QAL7B,CAAA,CAAA;EACe,SAAA,CAAA,EAKL,OALK;EAAf,QAAA,CAAA,EAMS,UANT,CAMoB,QANpB,CAAA;EAAc,cAAA,CAAA,EAAA,OAAA;EAGR,MAAA,CAAA,EAKC,MALD,CAKQ,QALU,CAAA;;cAStB,QARiB,EAAA;EAAd,SAAA,oBAAA,EAAA,CAAA;EACK,SAAA,KAAA,EAAA,CAAA;EACU,SAAA,WAAA,EAAA,CAAA;EAAX,SAAA,gBAAA,EAAA,CAAA;EAEK,SAAA,QAAA,EAAA,CAAA;EAAP,SAAA,OAAA,EAAA,CAAA;EAAM,SAAA,OAAA,EAAA,CAAA;EAIX,SAAA,QASI,EAAA,CAAA;AAAA,CAAA;AAE4C,KAAjD,OAAA,GAEC,CAAA,OAFiB,QAGqC,CAAA,CAAA,MADnC,OAFqB,QAEX,CAAA;AAAA,cAA7B,iBAUc,EAVK,UAUL,CAAA,OAAA,CAAA;;;;;;;;AAIZ,iBAJC,WAAW,CAAA,WAAA,MAAA,CAAA,CAAA,KAAA,EACX,aADW,CACG,QADH,CAAA,EAAA,KAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAGT,kBAHS,CAGU,QAHV,CAAA,CAAA,EAIjB,KAJiB,CAIX,QAJW,CAAA;kBAAX,WAAA"}
|