@stryke/helpers 0.9.14 → 0.9.22
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 +419 -0
- package/README.md +33 -25
- package/dist/{arg-identity.d.ts → arg-identity-BIir8uzO.d.mts} +5 -1
- package/dist/arg-identity-BIir8uzO.d.mts.map +1 -0
- package/dist/arg-identity-BfviduMt.mjs +2 -0
- package/dist/arg-identity-BfviduMt.mjs.map +1 -0
- package/dist/arg-identity-C-pVjd0u.d.cts +14 -0
- package/dist/arg-identity-C-pVjd0u.d.cts.map +1 -0
- package/dist/arg-identity-dlKw6BsD.cjs +1 -0
- package/dist/arg-identity.cjs +1 -9
- package/dist/arg-identity.d.cts +2 -0
- package/dist/arg-identity.d.mts +2 -0
- package/dist/arg-identity.mjs +1 -1
- package/dist/debounce-C5O3IDKy.mjs +2 -0
- package/dist/debounce-C5O3IDKy.mjs.map +1 -0
- package/dist/{debounce.d.ts → debounce-CIMf8-Yr.d.mts} +10 -4
- package/dist/debounce-CIMf8-Yr.d.mts.map +1 -0
- package/dist/debounce-CLb-VvJv.d.cts +47 -0
- package/dist/debounce-CLb-VvJv.d.cts.map +1 -0
- package/dist/debounce-SIYbhEOF.cjs +1 -0
- package/dist/debounce.cjs +1 -24
- package/dist/debounce.d.cts +2 -0
- package/dist/debounce.d.mts +2 -0
- package/dist/debounce.mjs +1 -1
- package/dist/deep-clone-BlN5QTtW.mjs +2 -0
- package/dist/deep-clone-BlN5QTtW.mjs.map +1 -0
- package/dist/deep-clone-CoUy-Hrt.cjs +1 -0
- package/dist/{deep-clone.d.ts → deep-clone-CpLJcTgz.d.mts} +11 -12
- package/dist/deep-clone-CpLJcTgz.d.mts.map +1 -0
- package/dist/deep-clone-jRNy1xoj.d.cts +65 -0
- package/dist/deep-clone-jRNy1xoj.d.cts.map +1 -0
- package/dist/deep-clone.cjs +1 -62
- package/dist/deep-clone.d.cts +2 -0
- package/dist/deep-clone.d.mts +2 -0
- package/dist/deep-clone.mjs +1 -1
- package/dist/deep-merge-BDZ6c79O.mjs +2 -0
- package/dist/deep-merge-BDZ6c79O.mjs.map +1 -0
- package/dist/deep-merge-BpFjvumi.cjs +1 -0
- package/dist/deep-merge-C9qDSleg.d.cts +26 -0
- package/dist/deep-merge-C9qDSleg.d.cts.map +1 -0
- package/dist/deep-merge-eCT712Cv.d.mts +26 -0
- package/dist/deep-merge-eCT712Cv.d.mts.map +1 -0
- package/dist/deep-merge.cjs +1 -36
- package/dist/deep-merge.d.cts +2 -0
- package/dist/deep-merge.d.mts +2 -0
- package/dist/deep-merge.mjs +1 -1
- package/dist/{delay.d.ts → delay-Bd_sGzMj.d.mts} +9 -4
- package/dist/delay-Bd_sGzMj.d.mts.map +1 -0
- package/dist/delay-UwR_fCwt.cjs +1 -0
- package/dist/delay-VkcrQf1l.d.cts +77 -0
- package/dist/delay-VkcrQf1l.d.cts.map +1 -0
- package/dist/delay-wdNbY6sk.mjs +2 -0
- package/dist/delay-wdNbY6sk.mjs.map +1 -0
- package/dist/delay.cjs +1 -28
- package/dist/delay.d.cts +2 -0
- package/dist/delay.d.mts +2 -0
- package/dist/delay.mjs +1 -1
- package/dist/errors-BXYY8wXj.cjs +1 -0
- package/dist/errors-DWX9ET_b.mjs +2 -0
- package/dist/errors-DWX9ET_b.mjs.map +1 -0
- package/dist/errors.cjs +1 -18
- package/dist/errors.d.cts +16 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +16 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +1 -1
- package/dist/filter-empty-5_nMg04e.cjs +1 -0
- package/dist/filter-empty-BMtd0K07.d.mts +5 -0
- package/dist/filter-empty-BMtd0K07.d.mts.map +1 -0
- package/dist/filter-empty-C2fq9M7o.d.cts +5 -0
- package/dist/filter-empty-C2fq9M7o.d.cts.map +1 -0
- package/dist/filter-empty-Dsc1ymCj.mjs +2 -0
- package/dist/filter-empty-Dsc1ymCj.mjs.map +1 -0
- package/dist/filter-empty.cjs +1 -9
- package/dist/filter-empty.d.cts +2 -0
- package/dist/filter-empty.d.mts +2 -0
- package/dist/filter-empty.mjs +1 -1
- package/dist/{flatten-object.d.ts → flatten-object-Bk2VT-b2.d.mts} +8 -6
- package/dist/flatten-object-Bk2VT-b2.d.mts.map +1 -0
- package/dist/flatten-object-D-EbEZqR.cjs +1 -0
- package/dist/flatten-object-DFCZmly9.mjs +2 -0
- package/dist/flatten-object-DFCZmly9.mjs.map +1 -0
- package/dist/{unflatten-object.d.ts → flatten-object-DjaJJaY0.d.cts} +8 -6
- package/dist/flatten-object-DjaJJaY0.d.cts.map +1 -0
- package/dist/flatten-object.cjs +1 -20
- package/dist/flatten-object.d.cts +2 -0
- package/dist/flatten-object.d.mts +2 -0
- package/dist/flatten-object.mjs +1 -1
- package/dist/{get-field.d.ts → get-field-5XqtknPs.d.mts} +25 -22
- package/dist/get-field-5XqtknPs.d.mts.map +1 -0
- package/dist/get-field-D4F_p-Ov.cjs +1 -0
- package/dist/get-field-ngQ9O38X.mjs +2 -0
- package/dist/get-field-ngQ9O38X.mjs.map +1 -0
- package/dist/get-field-oltWWNRO.d.cts +254 -0
- package/dist/get-field-oltWWNRO.d.cts.map +1 -0
- package/dist/get-field.cjs +1 -43
- package/dist/get-field.d.cts +2 -0
- package/dist/get-field.d.mts +2 -0
- package/dist/get-field.mjs +1 -1
- package/dist/get-object-tag-D53RvMgo.cjs +1 -0
- package/dist/get-object-tag-oBoWkttN.mjs +2 -0
- package/dist/get-object-tag-oBoWkttN.mjs.map +1 -0
- package/dist/{get-ordered-by.d.ts → get-ordered-by-C45FfW2T.d.mts} +5 -2
- package/dist/get-ordered-by-C45FfW2T.d.mts.map +1 -0
- package/dist/get-ordered-by-CBKKJr4R.mjs +2 -0
- package/dist/get-ordered-by-CBKKJr4R.mjs.map +1 -0
- package/dist/get-ordered-by-D2Sr6vUN.cjs +1 -0
- package/dist/get-ordered-by-DuD7QRma.d.cts +39 -0
- package/dist/get-ordered-by-DuD7QRma.d.cts.map +1 -0
- package/dist/get-ordered-by.cjs +1 -18
- package/dist/get-ordered-by.d.cts +2 -0
- package/dist/get-ordered-by.d.mts +2 -0
- package/dist/get-ordered-by.mjs +1 -1
- package/dist/get-unique-BOiakY6A.cjs +1 -0
- package/dist/{get-unique.d.ts → get-unique-C0SBPUBv.d.cts} +6 -2
- package/dist/get-unique-C0SBPUBv.d.cts.map +1 -0
- package/dist/get-unique-DZ6E1Kvc.d.mts +26 -0
- package/dist/get-unique-DZ6E1Kvc.d.mts.map +1 -0
- package/dist/get-unique-DzZ7Z34U.mjs +2 -0
- package/dist/get-unique-DzZ7Z34U.mjs.map +1 -0
- package/dist/get-unique.cjs +1 -17
- package/dist/get-unique.d.cts +2 -0
- package/dist/get-unique.d.mts +2 -0
- package/dist/get-unique.mjs +1 -1
- package/dist/{identity.d.ts → identity-B_cGeF8o.d.mts} +5 -1
- package/dist/identity-B_cGeF8o.d.mts.map +1 -0
- package/dist/identity-DBwwvmGU.mjs +2 -0
- package/dist/identity-DBwwvmGU.mjs.map +1 -0
- package/dist/identity-DRhIvbPG.d.cts +18 -0
- package/dist/identity-DRhIvbPG.d.cts.map +1 -0
- package/dist/identity-z2xaIqpe.cjs +1 -0
- package/dist/identity.cjs +1 -9
- package/dist/identity.d.cts +2 -0
- package/dist/identity.d.mts +2 -0
- package/dist/identity.mjs +1 -1
- package/dist/index.cjs +1 -346
- package/dist/index.d.cts +32 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +1 -1
- package/dist/is-empty-C7vlSVFD.mjs +2 -0
- package/dist/is-empty-C7vlSVFD.mjs.map +1 -0
- package/dist/is-empty-DZZDqzjD.cjs +1 -0
- package/dist/is-equal-0Z-K2uIG.mjs +2 -0
- package/dist/is-equal-0Z-K2uIG.mjs.map +1 -0
- package/dist/is-equal-BJgVhUVS.cjs +1 -0
- package/dist/{is-equal.d.ts → is-equal-BMlMHlVi.d.cts} +5 -1
- package/dist/is-equal-BMlMHlVi.d.cts.map +1 -0
- package/dist/is-equal-Baqurdpn.d.mts +22 -0
- package/dist/is-equal-Baqurdpn.d.mts.map +1 -0
- package/dist/is-equal.cjs +1 -61
- package/dist/is-equal.d.cts +2 -0
- package/dist/is-equal.d.mts +2 -0
- package/dist/is-equal.mjs +1 -1
- package/dist/is-number-BcjxCzDM.cjs +1 -0
- package/dist/is-number-bwhfkHlC.mjs +2 -0
- package/dist/is-number-bwhfkHlC.mjs.map +1 -0
- package/dist/is-plain-object-BQuFhL4M.cjs +1 -0
- package/dist/is-plain-object-D8GSMOhY.mjs +2 -0
- package/dist/is-plain-object-D8GSMOhY.mjs.map +1 -0
- package/dist/is-set-B9o0NIT4.mjs +2 -0
- package/dist/is-set-B9o0NIT4.mjs.map +1 -0
- package/dist/is-set-ByJOY6h2.cjs +1 -0
- package/dist/is-set-string-48_jZFw0.cjs +1 -0
- package/dist/is-set-string-Dr1MlMk0.mjs +2 -0
- package/dist/is-set-string-Dr1MlMk0.mjs.map +1 -0
- package/dist/is-string-CvmuuuDj.mjs +2 -0
- package/dist/is-string-CvmuuuDj.mjs.map +1 -0
- package/dist/is-string-DPanLeA_.cjs +1 -0
- package/dist/lru-cache-CzQ_kKXk.d.mts +103 -0
- package/dist/lru-cache-CzQ_kKXk.d.mts.map +1 -0
- package/dist/lru-cache-D4VEIgtR.d.cts +103 -0
- package/dist/lru-cache-D4VEIgtR.d.cts.map +1 -0
- package/dist/lru-cache-DLY_yZRN.mjs +2 -0
- package/dist/lru-cache-DLY_yZRN.mjs.map +1 -0
- package/dist/lru-cache-DgTSGx5W.cjs +1 -0
- package/dist/lru-cache.cjs +1 -82
- package/dist/lru-cache.d.cts +2 -0
- package/dist/lru-cache.d.mts +2 -0
- package/dist/lru-cache.mjs +1 -1
- package/dist/match-sorter-B9_7YvTo.mjs +2 -0
- package/dist/match-sorter-B9_7YvTo.mjs.map +1 -0
- package/dist/match-sorter-BjnWjkKu.cjs +1 -0
- package/dist/{match-sorter.d.ts → match-sorter-CMYN3GuY.d.cts} +44 -43
- package/dist/match-sorter-CMYN3GuY.d.cts.map +1 -0
- package/dist/match-sorter-DCRerxVe.d.mts +78 -0
- package/dist/match-sorter-DCRerxVe.d.mts.map +1 -0
- package/dist/match-sorter.cjs +1 -184
- package/dist/match-sorter.d.cts +2 -0
- package/dist/match-sorter.d.mts +2 -0
- package/dist/match-sorter.mjs +1 -1
- package/dist/memoize-Cr5jFKxi.mjs +2 -0
- package/dist/memoize-Cr5jFKxi.mjs.map +1 -0
- package/dist/memoize-TyrmWrfR.d.mts +11 -0
- package/dist/memoize-TyrmWrfR.d.mts.map +1 -0
- package/dist/memoize-qxvbI-0y.cjs +1 -0
- package/dist/memoize-tSTYY522.d.cts +11 -0
- package/dist/memoize-tSTYY522.d.cts.map +1 -0
- package/dist/memoize.cjs +1 -12
- package/dist/memoize.d.cts +2 -0
- package/dist/memoize.d.mts +2 -0
- package/dist/memoize.mjs +1 -1
- package/dist/mutex-CnQQBndt.cjs +1 -0
- package/dist/mutex-DAZduiSP.d.mts +72 -0
- package/dist/mutex-DAZduiSP.d.mts.map +1 -0
- package/dist/mutex-DCyX7B66.d.cts +72 -0
- package/dist/mutex-DCyX7B66.d.cts.map +1 -0
- package/dist/mutex-TqoKHosg.mjs +2 -0
- package/dist/mutex-TqoKHosg.mjs.map +1 -0
- package/dist/mutex.cjs +1 -20
- package/dist/mutex.d.cts +2 -0
- package/dist/mutex.d.mts +2 -0
- package/dist/mutex.mjs +1 -1
- package/dist/noop-B7OetrhD.mjs +2 -0
- package/dist/noop-B7OetrhD.mjs.map +1 -0
- package/dist/{noop.d.ts → noop-BnXKMH6Z.d.mts} +6 -2
- package/dist/noop-BnXKMH6Z.d.mts.map +1 -0
- package/dist/noop-CnJXOCpF.d.cts +22 -0
- package/dist/noop-CnJXOCpF.d.cts.map +1 -0
- package/dist/noop-Dpf7hIui.cjs +1 -0
- package/dist/noop.cjs +1 -10
- package/dist/noop.d.cts +2 -0
- package/dist/noop.d.mts +2 -0
- package/dist/noop.mjs +1 -1
- package/dist/object-CHmrmQna.d.mts +160 -0
- package/dist/object-CHmrmQna.d.mts.map +1 -0
- package/dist/object-D8HGAGMr.d.cts +160 -0
- package/dist/object-D8HGAGMr.d.cts.map +1 -0
- package/dist/omit-A0uVyAS4.cjs +1 -0
- package/dist/omit-BROsDK0D.mjs +2 -0
- package/dist/omit-BROsDK0D.mjs.map +1 -0
- package/dist/{omit.d.ts → omit-D1FKiOYz.d.cts} +5 -1
- package/dist/omit-D1FKiOYz.d.cts.map +1 -0
- package/dist/omit-DpqOAtKt.d.mts +22 -0
- package/dist/omit-DpqOAtKt.d.mts.map +1 -0
- package/dist/omit.cjs +1 -16
- package/dist/omit.d.cts +2 -0
- package/dist/omit.d.mts +2 -0
- package/dist/omit.mjs +1 -1
- package/dist/once-DNPPQd3P.d.mts +13 -0
- package/dist/once-DNPPQd3P.d.mts.map +1 -0
- package/dist/once-DZCwmdkv.cjs +1 -0
- package/dist/once-DqmxXwEB.d.cts +13 -0
- package/dist/once-DqmxXwEB.d.cts.map +1 -0
- package/dist/once-txoW63yJ.mjs +2 -0
- package/dist/once-txoW63yJ.mjs.map +1 -0
- package/dist/once.cjs +1 -17
- package/dist/once.d.cts +2 -0
- package/dist/once.d.mts +2 -0
- package/dist/once.mjs +1 -1
- package/dist/pick-CuXTvXaw.mjs +2 -0
- package/dist/pick-CuXTvXaw.mjs.map +1 -0
- package/dist/{pick.d.ts → pick-DXREvZBr.d.cts} +5 -1
- package/dist/pick-DXREvZBr.d.cts.map +1 -0
- package/dist/pick-GDOwAh6I.cjs +1 -0
- package/dist/pick-ZrWD4de2.d.mts +22 -0
- package/dist/pick-ZrWD4de2.d.mts.map +1 -0
- package/dist/pick.cjs +1 -14
- package/dist/pick.d.cts +2 -0
- package/dist/pick.d.mts +2 -0
- package/dist/pick.mjs +1 -1
- package/dist/remove-accents-BFmyvTRZ.mjs +2 -0
- package/dist/remove-accents-BFmyvTRZ.mjs.map +1 -0
- package/dist/remove-accents-C4C0A2ex.d.mts +12 -0
- package/dist/remove-accents-C4C0A2ex.d.mts.map +1 -0
- package/dist/remove-accents-CXBUC-Id.cjs +1 -0
- package/dist/remove-accents-Yo3-2jWO.d.cts +12 -0
- package/dist/remove-accents-Yo3-2jWO.d.cts.map +1 -0
- package/dist/remove-accents.cjs +1 -411
- package/dist/remove-accents.d.cts +2 -0
- package/dist/remove-accents.d.mts +2 -0
- package/dist/remove-accents.mjs +1 -1
- package/dist/remove-empty-items-BglsRCyG.d.cts +11 -0
- package/dist/remove-empty-items-BglsRCyG.d.cts.map +1 -0
- package/dist/remove-empty-items-BzI9Vid9.mjs +2 -0
- package/dist/remove-empty-items-BzI9Vid9.mjs.map +1 -0
- package/dist/remove-empty-items-COwdCPHC.d.mts +11 -0
- package/dist/remove-empty-items-COwdCPHC.d.mts.map +1 -0
- package/dist/remove-empty-items-CjTxJuyS.cjs +1 -0
- package/dist/remove-empty-items.cjs +1 -8
- package/dist/remove-empty-items.d.cts +2 -0
- package/dist/remove-empty-items.d.mts +2 -0
- package/dist/remove-empty-items.mjs +1 -1
- package/dist/semaphore-4zJqtox8.mjs +2 -0
- package/dist/semaphore-4zJqtox8.mjs.map +1 -0
- package/dist/semaphore-CsGTxqsW.d.cts +86 -0
- package/dist/semaphore-CsGTxqsW.d.cts.map +1 -0
- package/dist/semaphore-DkHqPlow.cjs +1 -0
- package/dist/semaphore-WaZBtCk5.d.mts +86 -0
- package/dist/semaphore-WaZBtCk5.d.mts.map +1 -0
- package/dist/semaphore.cjs +1 -32
- package/dist/semaphore.d.cts +2 -0
- package/dist/semaphore.d.mts +2 -0
- package/dist/semaphore.mjs +1 -1
- package/dist/set-field-CUgbKEjW.mjs +2 -0
- package/dist/set-field-CUgbKEjW.mjs.map +1 -0
- package/dist/set-field-CcCiXZNl.d.cts +16 -0
- package/dist/set-field-CcCiXZNl.d.cts.map +1 -0
- package/dist/set-field-DyvXgpNP.d.mts +16 -0
- package/dist/set-field-DyvXgpNP.d.mts.map +1 -0
- package/dist/set-field-mr4GkhFb.cjs +1 -0
- package/dist/set-field.cjs +1 -21
- package/dist/set-field.d.cts +2 -0
- package/dist/set-field.d.mts +2 -0
- package/dist/set-field.mjs +1 -1
- package/dist/throttle-BOKOTo3m.cjs +1 -0
- package/dist/{throttle.d.ts → throttle-BWPQuZty.d.cts} +5 -1
- package/dist/throttle-BWPQuZty.d.cts.map +1 -0
- package/dist/throttle-BgU4k6qs.d.mts +32 -0
- package/dist/throttle-BgU4k6qs.d.mts.map +1 -0
- package/dist/throttle-CYK3F0mZ.mjs +2 -0
- package/dist/throttle-CYK3F0mZ.mjs.map +1 -0
- package/dist/throttle.cjs +1 -13
- package/dist/throttle.d.cts +2 -0
- package/dist/throttle.d.mts +2 -0
- package/dist/throttle.mjs +1 -1
- package/dist/timeout-43rG9ETK.mjs +2 -0
- package/dist/timeout-43rG9ETK.mjs.map +1 -0
- package/dist/{timeout.d.ts → timeout-CLhwG-oo.d.mts} +5 -1
- package/dist/timeout-CLhwG-oo.d.mts.map +1 -0
- package/dist/timeout-CoYbhliP.cjs +1 -0
- package/dist/timeout-DC38jHR8.d.cts +12 -0
- package/dist/timeout-DC38jHR8.d.cts.map +1 -0
- package/dist/timeout.cjs +1 -11
- package/dist/timeout.d.cts +2 -0
- package/dist/timeout.d.mts +2 -0
- package/dist/timeout.mjs +1 -1
- package/dist/to-deep-key-Cma9aiEz.cjs +1 -0
- package/dist/to-deep-key-D8uDBd6T.mjs +2 -0
- package/dist/to-deep-key-D8uDBd6T.mjs.map +1 -0
- package/dist/{to-deep-key.d.ts → to-deep-key-DO-Z0Zjs.d.mts} +6 -2
- package/dist/to-deep-key-DO-Z0Zjs.d.mts.map +1 -0
- package/dist/to-deep-key-DlsE4ziE.d.cts +42 -0
- package/dist/to-deep-key-DlsE4ziE.d.cts.map +1 -0
- package/dist/to-deep-key.cjs +1 -15
- package/dist/to-deep-key.d.cts +2 -0
- package/dist/to-deep-key.d.mts +2 -0
- package/dist/to-deep-key.mjs +1 -1
- package/dist/{to-path.d.ts → to-path-BajxeMmo.d.mts} +5 -1
- package/dist/to-path-BajxeMmo.d.mts.map +1 -0
- package/dist/to-path-CdOFd4od.cjs +1 -0
- package/dist/to-path-D2zWXeYc.d.cts +24 -0
- package/dist/to-path-D2zWXeYc.d.cts.map +1 -0
- package/dist/to-path-Dm1fe-Ix.mjs +2 -0
- package/dist/to-path-Dm1fe-Ix.mjs.map +1 -0
- package/dist/to-path.cjs +1 -23
- package/dist/to-path.d.cts +2 -0
- package/dist/to-path.d.mts +2 -0
- package/dist/to-path.mjs +1 -1
- package/dist/unflatten-object-C7TE8J80.mjs +2 -0
- package/dist/unflatten-object-C7TE8J80.mjs.map +1 -0
- package/dist/unflatten-object-CPJIUozj.d.mts +35 -0
- package/dist/unflatten-object-CPJIUozj.d.mts.map +1 -0
- package/dist/unflatten-object-CvZj41LG.cjs +1 -0
- package/dist/unflatten-object-Cvbj7Q__.d.cts +35 -0
- package/dist/unflatten-object-Cvbj7Q__.d.cts.map +1 -0
- package/dist/unflatten-object.cjs +1 -10
- package/dist/unflatten-object.d.cts +2 -0
- package/dist/unflatten-object.d.mts +2 -0
- package/dist/unflatten-object.mjs +1 -1
- package/dist/{union.d.ts → union-BMOMEzO-.d.cts} +5 -1
- package/dist/union-BMOMEzO-.d.cts.map +1 -0
- package/dist/union-C-2CRoFc.mjs +2 -0
- package/dist/union-C-2CRoFc.mjs.map +1 -0
- package/dist/union-D4bbjM2i.d.mts +24 -0
- package/dist/union-D4bbjM2i.d.mts.map +1 -0
- package/dist/union-EwdcZzNT.cjs +1 -0
- package/dist/union.cjs +1 -10
- package/dist/union.d.cts +2 -0
- package/dist/union.d.mts +2 -0
- package/dist/union.mjs +1 -1
- package/dist/{with-timeout.d.ts → with-timeout-BPaAIZtS.d.cts} +5 -1
- package/dist/with-timeout-BPaAIZtS.d.cts.map +1 -0
- package/dist/with-timeout-BoZYdcOg.d.mts +24 -0
- package/dist/with-timeout-BoZYdcOg.d.mts.map +1 -0
- package/dist/with-timeout-CAuUr1ck.mjs +2 -0
- package/dist/with-timeout-CAuUr1ck.mjs.map +1 -0
- package/dist/with-timeout-CPUBGT4X.cjs +1 -0
- package/dist/with-timeout.cjs +1 -10
- package/dist/with-timeout.d.cts +2 -0
- package/dist/with-timeout.d.mts +2 -0
- package/dist/with-timeout.mjs +1 -1
- package/package.json +91 -440
- package/dist/deep-merge.d.ts +0 -22
- package/dist/errors.d.ts +0 -12
- package/dist/filter-empty.d.ts +0 -1
- package/dist/index.d.ts +0 -31
- package/dist/lru-cache.d.ts +0 -99
- package/dist/memoize.d.ts +0 -7
- package/dist/mutex.d.ts +0 -68
- package/dist/once.d.ts +0 -9
- package/dist/remove-accents.d.ts +0 -8
- package/dist/remove-empty-items.d.ts +0 -7
- package/dist/semaphore.d.ts +0 -82
- package/dist/set-field.d.ts +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay-VkcrQf1l.d.cts","names":[],"sources":["../src/delay.ts"],"sourcesContent":[],"mappings":";UAoBU,YAAA;EAAA,MAAA,CAAA,EACC,WADW;AAqCtB;;;;;AA2DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA3DsB,KAAA;;IAER,eACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwDmB,KAAA,uBAA4B,eAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./errors-DWX9ET_b.mjs";async function t(t,{signal:n}={}){return new Promise((r,i)=>{let a=()=>{i(new e)},o=()=>{clearTimeout(s),a()};if(n?.aborted)return a();let s=setTimeout(r,t);n?.addEventListener(`abort`,o,{once:!0})})}async function n(e,n){return t(e,n)}export{n,t};
|
|
2
|
+
//# sourceMappingURL=delay-wdNbY6sk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay-wdNbY6sk.mjs","names":[],"sources":["../src/delay.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\nimport { AbortError } from \"./errors\";\n\ninterface DelayOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Delays the execution of code for a specified number of milliseconds.\n *\n * This function returns a Promise that resolves after the specified delay, allowing you to use it\n * with async/await to pause execution.\n *\n * @example\n * ```typescript\n * async function foo() {\n * console.log('Start');\n * await delay(1000); // Delays execution for 1 second\n * console.log('End');\n * }\n *\n * foo();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const { signal } = controller;\n *\n * setTimeout(() => controller.abort(), 50); // Will cancel the delay after 50ms\n * try {\n * await delay(100, { signal });\n * } catch (error) {\n * console.error(error); // Will log 'AbortError'\n * }\n * }\n * ```\n *\n * @param ms - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns A Promise that resolves after the specified delay.\n */\nexport async function delay(\n ms: number,\n { signal }: DelayOptions = {}\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const abortError = () => {\n reject(new AbortError());\n };\n\n const abortHandler = () => {\n // eslint-disable-next-line ts/no-use-before-define\n clearTimeout(timeoutId);\n abortError();\n };\n\n if (signal?.aborted) {\n // eslint-disable-next-line no-promise-executor-return\n return abortError();\n }\n\n const timeoutId = setTimeout(resolve, ms);\n\n signal?.addEventListener(\"abort\", abortHandler, { once: true });\n });\n}\n\n/**\n * Delays the execution of code for a specified number of milliseconds.\n *\n * This function returns a Promise that resolves after the specified delay, allowing you to use it\n * with async/await to pause execution.\n *\n * @example\n * ```typescript\n * async function foo() {\n * console.log('Start');\n * await sleep(1000); // Delays execution for 1 second\n * console.log('End');\n * }\n *\n * foo();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const { signal } = controller;\n *\n * setTimeout(() => controller.abort(), 50); // Will cancel the delay after 50ms\n * try {\n * await sleep(100, { signal });\n * } catch (error) {\n * console.error(error); // Will log 'AbortError'\n * }\n * }\n * ```\n *\n * @param ms - The number of milliseconds to sleep.\n * @param options - The options object.\n * @returns A Promise that resolves after the specified sleep.\n */\nexport async function sleep(ms: number, options?: DelayOptions): Promise<void> {\n return delay(ms, options);\n}\n"],"mappings":"0CAyDA,eAAsB,EACpB,EACA,CAAE,UAAyB,EAAE,CACd,CACf,OAAO,IAAI,SAAS,EAAS,IAAW,CACtC,IAAM,MAAmB,CACvB,EAAO,IAAI,EAAa,EAGpB,MAAqB,CAEzB,aAAa,EAAU,CACvB,GAAY,EAGd,GAAI,GAAQ,QAEV,OAAO,GAAY,CAGrB,IAAM,EAAY,WAAW,EAAS,EAAG,CAEzC,GAAQ,iBAAiB,QAAS,EAAc,CAAE,KAAM,GAAM,CAAC,EAC/D,CAoCJ,eAAsB,EAAM,EAAY,EAAuC,CAC7E,OAAO,EAAM,EAAI,EAAQ"}
|
package/dist/delay.cjs
CHANGED
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.delay = delay;
|
|
7
|
-
exports.sleep = sleep;
|
|
8
|
-
var _errors = require("./errors.cjs");
|
|
9
|
-
async function delay(r, {
|
|
10
|
-
signal: e
|
|
11
|
-
} = {}) {
|
|
12
|
-
return new Promise((t, n) => {
|
|
13
|
-
const o = () => {
|
|
14
|
-
n(new _errors.AbortError());
|
|
15
|
-
},
|
|
16
|
-
i = () => {
|
|
17
|
-
clearTimeout(a), o();
|
|
18
|
-
};
|
|
19
|
-
if (e?.aborted) return o();
|
|
20
|
-
const a = setTimeout(t, r);
|
|
21
|
-
e?.addEventListener("abort", i, {
|
|
22
|
-
once: !0
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async function sleep(r, e) {
|
|
27
|
-
return delay(r, e);
|
|
28
|
-
}
|
|
1
|
+
const e=require(`./delay-UwR_fCwt.cjs`);exports.delay=e.t,exports.sleep=e.n;
|
package/dist/delay.d.cts
ADDED
package/dist/delay.d.mts
ADDED
package/dist/delay.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,t}from"./delay-wdNbY6sk.mjs";export{t as delay,e as sleep};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class extends Error{constructor(e=`The operation was aborted`){super(e),this.name=`AbortError`}},t=class extends Error{constructor(e=`The operation was timed out`){super(e),this.name=`TimeoutError`}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-DWX9ET_b.mjs","names":[],"sources":["../src/errors.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\n/**\n * An error class representing an aborted operation.\n */\nexport class AbortError extends Error {\n constructor(message = \"The operation was aborted\") {\n super(message);\n this.name = \"AbortError\";\n }\n}\n\n/**\n * An error class representing an timeout operation.\n */\nexport class TimeoutError extends Error {\n constructor(message = \"The operation was timed out\") {\n super(message);\n this.name = \"TimeoutError\";\n }\n}\n"],"mappings":"AAqBA,IAAa,EAAb,cAAgC,KAAM,CACpC,YAAY,EAAU,4BAA6B,CACjD,MAAM,EAAQ,CACd,KAAK,KAAO,eAOH,EAAb,cAAkC,KAAM,CACtC,YAAY,EAAU,8BAA+B,CACnD,MAAM,EAAQ,CACd,KAAK,KAAO"}
|
package/dist/errors.cjs
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TimeoutError = exports.AbortError = void 0;
|
|
7
|
-
class AbortError extends Error {
|
|
8
|
-
constructor(r = "The operation was aborted") {
|
|
9
|
-
super(r), this.name = "AbortError";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.AbortError = AbortError;
|
|
13
|
-
class TimeoutError extends Error {
|
|
14
|
-
constructor(r = "The operation was timed out") {
|
|
15
|
-
super(r), this.name = "TimeoutError";
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.TimeoutError = TimeoutError;
|
|
1
|
+
const e=require(`./errors-BXYY8wXj.cjs`);exports.AbortError=e.t,exports.TimeoutError=e.n;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An error class representing an aborted operation.
|
|
4
|
+
*/
|
|
5
|
+
declare class AbortError extends Error {
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* An error class representing an timeout operation.
|
|
10
|
+
*/
|
|
11
|
+
declare class TimeoutError extends Error {
|
|
12
|
+
constructor(message?: string);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AbortError, TimeoutError };
|
|
16
|
+
//# sourceMappingURL=errors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.cts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAUA;cAVa,UAAA,SAAmB,KAAA;;;;;;cAUnB,YAAA,SAAqB,KAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An error class representing an aborted operation.
|
|
4
|
+
*/
|
|
5
|
+
declare class AbortError extends Error {
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* An error class representing an timeout operation.
|
|
10
|
+
*/
|
|
11
|
+
declare class TimeoutError extends Error {
|
|
12
|
+
constructor(message?: string);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AbortError, TimeoutError };
|
|
16
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAUA;cAVa,UAAA,SAAmB,KAAA;;;;;;cAUnB,YAAA,SAAqB,KAAA"}
|
package/dist/errors.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{n as e,t}from"./errors-DWX9ET_b.mjs";export{t as AbortError,e as TimeoutError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-empty-DZZDqzjD.cjs`),t=(t=[])=>t.filter(t=>!e.t(t));Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-empty-BMtd0K07.d.mts","names":[],"sources":["../src/filter-empty.ts"],"sourcesContent":[],"mappings":";cAmBa,2BAA2B,4BAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-empty-C2fq9M7o.d.cts","names":[],"sources":["../src/filter-empty.ts"],"sourcesContent":[],"mappings":";cAmBa,2BAA2B,4BAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-empty-Dsc1ymCj.mjs","names":[],"sources":["../src/filter-empty.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 { isEmpty } from \"@stryke/type-checks/is-empty\";\n\nexport const filterEmpty = <T>(values: (T | null | undefined)[] = []): T[] =>\n values.filter(value => !isEmpty(value)) as T[];\n"],"mappings":"4CAmBA,MAAa,GAAkB,EAAmC,EAAE,GAClE,EAAO,OAAO,GAAS,CAAC,EAAQ,EAAM,CAAC"}
|
package/dist/filter-empty.cjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.filterEmpty = void 0;
|
|
7
|
-
var _isEmpty = require("@stryke/type-checks/is-empty");
|
|
8
|
-
const filterEmpty = (t = []) => t.filter(e => !(0, _isEmpty.isEmpty)(e));
|
|
9
|
-
exports.filterEmpty = filterEmpty;
|
|
1
|
+
const e=require(`./filter-empty-5_nMg04e.cjs`);exports.filterEmpty=e.t;
|
package/dist/filter-empty.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"./filter-empty-Dsc1ymCj.mjs";export{e as filterEmpty};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { n as DeepValue, t as DeepKey } from "./object-CHmrmQna.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/flatten-object.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Flattens a nested object into a single level object with dot-separated keys.
|
|
4
7
|
*
|
|
@@ -26,8 +29,7 @@ import type { DeepKey, DeepValue } from "@stryke/types/object";
|
|
|
26
29
|
* @param object - The object to flatten.
|
|
27
30
|
* @returns - The flattened object.
|
|
28
31
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}>(object: TObject): TDeepKeyObject;
|
|
32
|
+
declare function flattenObject<TObject extends Record<string, any> = Record<string, any>, TDeepKeyObject extends { [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey> } = { [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey> }>(object: TObject): TDeepKeyObject;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { flattenObject as t };
|
|
35
|
+
//# sourceMappingURL=flatten-object-Bk2VT-b2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-object-Bk2VT-b2.d.mts","names":[],"sources":["../src/flatten-object.ts"],"sourcesContent":[],"mappings":";;;;;;AA+CA;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,8BACE,sBAAsB,uDAE3B,QAAQ,WAAW,UAAU,SAAS,qBAClC,QAAQ,WAAW,UAAU,SAAS,iBAC7C,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-plain-object-BQuFhL4M.cjs`);function t(e){return n(e)}function n(t,r=``){let i={},a=Object.keys(t);for(let o of a){let a=t[o],s=r?`${r}.${o}`:o;if(e.t(a)&&Object.keys(a).length>0)Object.assign(i,n(a,s));else if(Array.isArray(a))for(let[e,t]of a.entries())i[`${s}.${e}`]=t;else i[s]=a}return i}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./is-plain-object-D8GSMOhY.mjs";function t(e){return n(e)}function n(t,r=``){let i={},a=Object.keys(t);for(let o of a){let a=t[o],s=r?`${r}.${o}`:o;if(e(a)&&Object.keys(a).length>0)Object.assign(i,n(a,s));else if(Array.isArray(a))for(let[e,t]of a.entries())i[`${s}.${e}`]=t;else i[s]=a}return i}export{t};
|
|
2
|
+
//# sourceMappingURL=flatten-object-DFCZmly9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-object-DFCZmly9.mjs","names":[],"sources":["../src/flatten-object.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 { isPlainObject } from \"@stryke/type-checks/is-plain-object\";\nimport type { DeepKey, DeepValue } from \"@stryke/types/object\";\n\n/**\n * Flattens a nested object into a single level object with dot-separated keys.\n *\n * @example\n * ```typescript\n * const nestedObject = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: [2, 3]\n * };\n *\n * const flattened = flattenObject(nestedObject);\n * console.log(flattened);\n * // Output:\n * // {\n * // 'a.b.c': 1,\n * // 'd.0': 2,\n * // 'd.1': 3\n * // }\n * ```\n *\n * @param object - The object to flatten.\n * @returns - The flattened object.\n */\nexport function flattenObject<\n TObject extends Record<string, any> = Record<string, any>,\n TDeepKeyObject extends {\n [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey>;\n } = { [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey> }\n>(object: TObject): TDeepKeyObject {\n return flattenObjectImpl<TObject, TDeepKeyObject>(object);\n}\n\nfunction flattenObjectImpl<\n TObject extends Record<string, any> = Record<string, any>,\n TDeepKeyObject extends {\n [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey>;\n } = { [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey> }\n>(object: TObject, prefix = \"\"): TDeepKeyObject {\n const result = {} as TDeepKeyObject;\n const keys = Object.keys(object);\n\n for (const key of keys) {\n const value = (object as any)[key];\n\n const prefixedKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(value) && Object.keys(value).length > 0) {\n Object.assign(\n result,\n flattenObjectImpl<typeof value>(value, prefixedKey)\n );\n } else if (Array.isArray(value)) {\n for (const [index, element_] of value.entries()) {\n (result as any)[`${prefixedKey}.${index}` as DeepKey<TObject>] =\n element_;\n }\n } else {\n (result as any)[prefixedKey as DeepKey<TObject>] = value;\n }\n }\n\n return result;\n}\n"],"mappings":"mDA+CA,SAAgB,EAKd,EAAiC,CACjC,OAAO,EAA2C,EAAO,CAG3D,SAAS,EAKP,EAAiB,EAAS,GAAoB,CAC9C,IAAM,EAAS,EAAE,CACX,EAAO,OAAO,KAAK,EAAO,CAEhC,IAAK,IAAM,KAAO,EAAM,CACtB,IAAM,EAAS,EAAe,GAExB,EAAc,EAAS,GAAG,EAAO,GAAG,IAAQ,EAElD,GAAI,EAAc,EAAM,EAAI,OAAO,KAAK,EAAM,CAAC,OAAS,EACtD,OAAO,OACL,EACA,EAAgC,EAAO,EAAY,CACpD,SACQ,MAAM,QAAQ,EAAM,CAC7B,IAAK,GAAM,CAAC,EAAO,KAAa,EAAM,SAAS,CAC5C,EAAe,GAAG,EAAY,GAAG,KAChC,OAGH,EAAe,GAAmC,EAIvD,OAAO"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { n as DeepValue, t as DeepKey } from "./object-D8HGAGMr.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/flatten-object.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Flattens a nested object into a single level object with dot-separated keys.
|
|
4
7
|
*
|
|
@@ -26,8 +29,7 @@ import type { DeepKey, DeepValue } from "@stryke/types/object";
|
|
|
26
29
|
* @param object - The object to flatten.
|
|
27
30
|
* @returns - The flattened object.
|
|
28
31
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}>(deepKeyObject: TDeepKeyObject): TObject;
|
|
32
|
+
declare function flattenObject<TObject extends Record<string, any> = Record<string, any>, TDeepKeyObject extends { [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey> } = { [TKey in DeepKey<TObject>]: DeepValue<TObject, TKey> }>(object: TObject): TDeepKeyObject;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { flattenObject as t };
|
|
35
|
+
//# sourceMappingURL=flatten-object-DjaJJaY0.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-object-DjaJJaY0.d.cts","names":[],"sources":["../src/flatten-object.ts"],"sourcesContent":[],"mappings":";;;;;;AA+CA;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,8BACE,sBAAsB,uDAE3B,QAAQ,WAAW,UAAU,SAAS,qBAClC,QAAQ,WAAW,UAAU,SAAS,iBAC7C,UAAU"}
|
package/dist/flatten-object.cjs
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.flattenObject = flattenObject;
|
|
7
|
-
var _isPlainObject = require("@stryke/type-checks/is-plain-object");
|
|
8
|
-
function flattenObject(t) {
|
|
9
|
-
return T(t);
|
|
10
|
-
}
|
|
11
|
-
function T(t, s = "") {
|
|
12
|
-
const c = {},
|
|
13
|
-
b = Object.keys(t);
|
|
14
|
-
for (const n of b) {
|
|
15
|
-
const e = t[n],
|
|
16
|
-
y = s ? `${s}.${n}` : n;
|
|
17
|
-
if ((0, _isPlainObject.isPlainObject)(e) && Object.keys(e).length > 0) Object.assign(c, T(e, y));else if (Array.isArray(e)) for (const [j, O] of e.entries()) c[`${y}.${j}`] = O;else c[y] = e;
|
|
18
|
-
}
|
|
19
|
-
return c;
|
|
20
|
-
}
|
|
1
|
+
const e=require(`./flatten-object-D-EbEZqR.cjs`);exports.flattenObject=e.t;
|
package/dist/flatten-object.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"./flatten-object-DFCZmly9.mjs";export{e as flattenObject};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
//#region src/get-field.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* See the definition of `@types/lodash`.
|
|
3
4
|
*/
|
|
4
5
|
type GetIndexedField<T, K> = K extends keyof T ? T[K] : K extends `${number}` ? "length" extends keyof T ? number extends T["length"] ? number extends keyof T ? T[number] : undefined : undefined : undefined : undefined;
|
|
5
6
|
type FieldWithPossiblyUndefined<T, Key> = GetField<Exclude<T, undefined>, Key> | Extract<T, undefined>;
|
|
6
7
|
type IndexedFieldWithPossiblyUndefined<T, Key> = GetIndexedField<Exclude<T, undefined>, Key> | Extract<T, undefined>;
|
|
7
|
-
|
|
8
|
+
type GetField<T, P> = P extends `${infer Left}.${infer Right}` ? Left extends keyof Exclude<T, undefined> ? FieldWithPossiblyUndefined<Exclude<T, undefined>[Left], Right> | Extract<T, undefined> : Left extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof T ? FieldWithPossiblyUndefined<IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>, Right> : undefined : undefined : P extends keyof T ? T[P] : P extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof T ? IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey> : undefined : IndexedFieldWithPossiblyUndefined<T, P>;
|
|
8
9
|
/**
|
|
9
10
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
10
11
|
*
|
|
@@ -16,7 +17,7 @@ export type GetField<T, P> = P extends `${infer Left}.${infer Right}` ? Left ext
|
|
|
16
17
|
* @param {K | [K]} path - The path of the property to get.
|
|
17
18
|
* @returns {T[K]} - Returns the resolved value.
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
declare function getField<T extends object, K extends keyof T>(object: T, path: K | readonly [K]): T[K];
|
|
20
21
|
/**
|
|
21
22
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
22
23
|
*
|
|
@@ -27,7 +28,7 @@ export declare function getField<T extends object, K extends keyof T>(object: T,
|
|
|
27
28
|
* @param {K | [K]} path - The path of the property to get.
|
|
28
29
|
* @returns {T[K] | undefined} - Returns the resolved value.
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
declare function getField<T extends object, K extends keyof T>(object: T | null | undefined, path: K | readonly [K]): T[K] | undefined;
|
|
31
32
|
/**
|
|
32
33
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
33
34
|
*
|
|
@@ -40,7 +41,7 @@ export declare function getField<T extends object, K extends keyof T>(object: T
|
|
|
40
41
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
41
42
|
* @returns {Exclude<T[K], undefined> | D} - Returns the resolved value.
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
+
declare function getField<T extends object, K extends keyof T, D>(object: T | null | undefined, path: K | readonly [K], defaultValue: D): Exclude<T[K], undefined> | D;
|
|
44
45
|
/**
|
|
45
46
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
46
47
|
*
|
|
@@ -52,7 +53,7 @@ export declare function getField<T extends object, K extends keyof T, D>(object:
|
|
|
52
53
|
* @param {[K1, K2]} path - The path of the property to get.
|
|
53
54
|
* @returns {T[K1][K2]} - Returns the resolved value.
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, path: readonly [K1, K2]): T[K1][K2];
|
|
56
57
|
/**
|
|
57
58
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
58
59
|
*
|
|
@@ -64,7 +65,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
64
65
|
* @param {[K1, K2]} path - The path of the property to get.
|
|
65
66
|
* @returns {T[K1][K2] | undefined} - Returns the resolved value.
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T | null | undefined, path: readonly [K1, K2]): T[K1][K2] | undefined;
|
|
68
69
|
/**
|
|
69
70
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
70
71
|
*
|
|
@@ -78,7 +79,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
78
79
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
79
80
|
* @returns {Exclude<T[K1][K2], undefined> | D} - Returns the resolved value.
|
|
80
81
|
*/
|
|
81
|
-
|
|
82
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], D>(object: T | null | undefined, path: readonly [K1, K2], defaultValue: D): Exclude<T[K1][K2], undefined> | D;
|
|
82
83
|
/**
|
|
83
84
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
84
85
|
*
|
|
@@ -91,7 +92,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
91
92
|
* @param {[K1, K2, K3]} path - The path of the property to get.
|
|
92
93
|
* @returns {T[K1][K2][K3]} - Returns the resolved value.
|
|
93
94
|
*/
|
|
94
|
-
|
|
95
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T, path: readonly [K1, K2, K3]): T[K1][K2][K3];
|
|
95
96
|
/**
|
|
96
97
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
97
98
|
*
|
|
@@ -104,7 +105,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
104
105
|
* @param {[K1, K2, K3]} path - The path of the property to get.
|
|
105
106
|
* @returns {T[K1][K2][K3] | undefined} - Returns the resolved value.
|
|
106
107
|
*/
|
|
107
|
-
|
|
108
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T | null | undefined, path: readonly [K1, K2, K3]): T[K1][K2][K3] | undefined;
|
|
108
109
|
/**
|
|
109
110
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
110
111
|
*
|
|
@@ -119,7 +120,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
119
120
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
120
121
|
* @returns {Exclude<T[K1][K2][K3], undefined> | D} - Returns the resolved value.
|
|
121
122
|
*/
|
|
122
|
-
|
|
123
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], D>(object: T | null | undefined, path: readonly [K1, K2, K3], defaultValue: D): Exclude<T[K1][K2][K3], undefined> | D;
|
|
123
124
|
/**
|
|
124
125
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
125
126
|
*
|
|
@@ -133,7 +134,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
133
134
|
* @param {[K1, K2, K3, K4]} path - The path of the property to get.
|
|
134
135
|
* @returns {T[K1][K2][K3][K4]} - Returns the resolved value.
|
|
135
136
|
*/
|
|
136
|
-
|
|
137
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T, path: readonly [K1, K2, K3, K4]): T[K1][K2][K3][K4];
|
|
137
138
|
/**
|
|
138
139
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
139
140
|
*
|
|
@@ -147,7 +148,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
147
148
|
* @param {[K1, K2, K3, K4]} path - The path of the property to get.
|
|
148
149
|
* @returns {T[K1][K2][K3][K4] | undefined} - Returns the resolved value.
|
|
149
150
|
*/
|
|
150
|
-
|
|
151
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T | null | undefined, path: readonly [K1, K2, K3, K4]): T[K1][K2][K3][K4] | undefined;
|
|
151
152
|
/**
|
|
152
153
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
153
154
|
*
|
|
@@ -163,7 +164,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
163
164
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
164
165
|
* @returns {Exclude<T[K1][K2][K3][K4], undefined> | D} - Returns the resolved value.
|
|
165
166
|
*/
|
|
166
|
-
|
|
167
|
+
declare function getField<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], D>(object: T | null | undefined, path: readonly [K1, K2, K3, K4], defaultValue: D): Exclude<T[K1][K2][K3][K4], undefined> | D;
|
|
167
168
|
/**
|
|
168
169
|
* Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.
|
|
169
170
|
*
|
|
@@ -173,7 +174,7 @@ export declare function getField<T extends object, K1 extends keyof T, K2 extend
|
|
|
173
174
|
* @param {number} path - The path of the property to get.
|
|
174
175
|
* @returns {T} - Returns the resolved value.
|
|
175
176
|
*/
|
|
176
|
-
|
|
177
|
+
declare function getField<T>(object: Record<number, T>, path: number): T;
|
|
177
178
|
/**
|
|
178
179
|
* Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.
|
|
179
180
|
*
|
|
@@ -183,7 +184,7 @@ export declare function getField<T>(object: Record<number, T>, path: number): T;
|
|
|
183
184
|
* @param {number} path - The path of the property to get.
|
|
184
185
|
* @returns {T | undefined} - Returns the resolved value.
|
|
185
186
|
*/
|
|
186
|
-
|
|
187
|
+
declare function getField<T>(object: Record<number, T> | null | undefined, path: number): T | undefined;
|
|
187
188
|
/**
|
|
188
189
|
* Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.
|
|
189
190
|
*
|
|
@@ -195,7 +196,7 @@ export declare function getField<T>(object: Record<number, T> | null | undefined
|
|
|
195
196
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
196
197
|
* @returns {T | D} - Returns the resolved value.
|
|
197
198
|
*/
|
|
198
|
-
|
|
199
|
+
declare function getField<T, D>(object: Record<number, T> | null | undefined, path: number, defaultValue: D): T | D;
|
|
199
200
|
/**
|
|
200
201
|
* Retrieves the value at a given path from a null or undefined object, returning the default value.
|
|
201
202
|
*
|
|
@@ -206,7 +207,7 @@ export declare function getField<T, D>(object: Record<number, T> | null | undefi
|
|
|
206
207
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
207
208
|
* @returns {D} - Returns the default value.
|
|
208
209
|
*/
|
|
209
|
-
|
|
210
|
+
declare function getField<D>(object: null | undefined, path: PropertyKey, defaultValue: D): D;
|
|
210
211
|
/**
|
|
211
212
|
* Retrieves the value at a given path from a null or undefined object, returning undefined.
|
|
212
213
|
*
|
|
@@ -214,7 +215,7 @@ export declare function getField<D>(object: null | undefined, path: PropertyKey,
|
|
|
214
215
|
* @param {PropertyKey} path - The path of the property to get.
|
|
215
216
|
* @returns {undefined} - Returns undefined.
|
|
216
217
|
*/
|
|
217
|
-
|
|
218
|
+
declare function getField(object: null | undefined, path: PropertyKey): undefined;
|
|
218
219
|
/**
|
|
219
220
|
* Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
220
221
|
*
|
|
@@ -225,7 +226,7 @@ export declare function getField(object: null | undefined, path: PropertyKey): u
|
|
|
225
226
|
* @param {P} path - The path of the property to get.
|
|
226
227
|
* @returns {string extends P ? any : GetField<T, P>} - Returns the resolved value.
|
|
227
228
|
*/
|
|
228
|
-
|
|
229
|
+
declare function getField<T, P extends string>(data: T, path: P): string extends P ? any : GetField<T, P>;
|
|
229
230
|
/**
|
|
230
231
|
* Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
231
232
|
*
|
|
@@ -238,7 +239,7 @@ export declare function getField<T, P extends string>(data: T, path: P): string
|
|
|
238
239
|
* @param {D} defaultValue - The value returned if the resolved value is undefined.
|
|
239
240
|
* @returns {Exclude<GetField<T, P>, null | undefined> | D} - Returns the resolved value.
|
|
240
241
|
*/
|
|
241
|
-
|
|
242
|
+
declare function getField<T, P extends string, D = GetField<T, P>>(data: T, path: P, defaultValue: D): Exclude<GetField<T, P>, null | undefined> | D;
|
|
242
243
|
/**
|
|
243
244
|
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
244
245
|
*
|
|
@@ -247,5 +248,7 @@ export declare function getField<T, P extends string, D = GetField<T, P>>(data:
|
|
|
247
248
|
* @param {unknown} [defaultValue] - The value returned if the resolved value is undefined.
|
|
248
249
|
* @returns {any} - Returns the resolved value.
|
|
249
250
|
*/
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
declare function getField(object: unknown, path: PropertyKey | readonly PropertyKey[], defaultValue?: unknown): any;
|
|
252
|
+
//#endregion
|
|
253
|
+
export { getField as n, GetField as t };
|
|
254
|
+
//# sourceMappingURL=get-field-5XqtknPs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-5XqtknPs.d.mts","names":[],"sources":["../src/get-field.ts"],"sourcesContent":[],"mappings":";;;;KAyBK,eAAwC,CAAA,CAAA,EAAA,CAAA,CAAA,GAAhB,CAAgB,SAAA,MAAA,CAAA,GACzC,CADyC,CACvC,CADuC,CAAA,GAEzC,CAFyC,SAAA,GAAA,MAAA,EAAA,GAAA,QAAA,SAAA,MAGhB,CAHgB,GAAA,MAAA,SAItB,CAJsB,CAAA,QAAA,C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,GAqFG,QArFH,CAqFY,CArFZ,EAqFe,CArFf,CAAA;;;;;;;;;;;;;AAMtB,iBA4Fa,QA5Fb,CAAA,CAAA,EAAA,UAAA,MAAA,EAAA,IA4F+C,QA5F/C,CA4FwD,CA5FxD,EA4F2D,CA5F3D,CAAA,CAAA,CAAA,IAAA,EA6FK,CA7FL,EAAA,IAAA,EA8FK,CA9FL,EAAA,YAAA,EA+Fa,CA/Fb,CAAA,EAgGA,OAhGA,CAgGQ,QAhGR,CAgGiB,CAhGjB,EAgGoB,CAhGpB,CAAA,EAAA,IAAA,GAAA,SAAA,CAAA,GAgG4C,CAhG5C;;;AAUH;;;;;AAUA;AACyB,iBAoFT,QAAA,CApFS,MAAA,EAAA,OAAA,EAAA,IAAA,EAsFjB,WAtFiB,GAAA,SAsFM,WAtFN,EAAA,EAAA,YAAA,CAAA,EAAA,OAAA,CAAA,EAAA,GAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-number-BcjxCzDM.cjs`),t=require(`./to-path-CdOFd4od.cjs`);function n(e){return Object.is(e,-0)?`-0`:e.toString()}function r(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function i(o,s,c){if(o===null)return c;switch(typeof s){case`string`:{let e=o[s];return e===void 0?r(s)?i(o,t.t(s),c):c:e}case`number`:case`symbol`:{e.t(s)&&(s=n(s));let t=Array.isArray(s)?void 0:o[s];return t===void 0?c:t}default:{if(Array.isArray(s))return a(o,s,c);s=Object.is(s?.valueOf(),-0)?`-0`:String(s);let e=o[s];return e===void 0?c:e}}}function a(e,t,n){if(t.length===0)return n;let r=e;for(let e of t){if(r===null)return n;r=r[e]}return r===void 0?n:r}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./is-number-bwhfkHlC.mjs";import{t}from"./to-path-Dm1fe-Ix.mjs";function n(e){return Object.is(e,-0)?`-0`:e.toString()}function r(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function i(o,s,c){if(o===null)return c;switch(typeof s){case`string`:{let e=o[s];return e===void 0?r(s)?i(o,t(s),c):c:e}case`number`:case`symbol`:{e(s)&&(s=n(s));let t=Array.isArray(s)?void 0:o[s];return t===void 0?c:t}default:{if(Array.isArray(s))return a(o,s,c);s=Object.is(s?.valueOf(),-0)?`-0`:String(s);let e=o[s];return e===void 0?c:e}}}function a(e,t,n){if(t.length===0)return n;let r=e;for(let e of t){if(r===null)return n;r=r[e]}return r===void 0?n:r}export{i as t};
|
|
2
|
+
//# sourceMappingURL=get-field-ngQ9O38X.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-ngQ9O38X.mjs","names":[],"sources":["../../convert/src/to-string-key.ts","../../type-checks/src/is-deep-key.ts","../src/get-field.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\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @param value - The value to inspect.\n * @returns Returns the key.\n */\nexport function toStringKey(value: number): string | symbol {\n if (Object.is(value, -0)) {\n return \"-0\";\n }\n\n return value.toString();\n}\n","/* -------------------------------------------------------------------\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\nimport type { DeepKey } from \"@stryke/types/object\";\n\n/**\n * Checks if a given key is a deep key.\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @example\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // false\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n *\n * @param key - The key to check.\n * @returns Returns true if the key is a deep key, otherwise false.\n */\nexport function isDeepKey(key: PropertyKey): key is DeepKey<any> {\n switch (typeof key) {\n case \"number\":\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return key.includes(\".\") || key.includes(\"[\") || key.includes(\"]\");\n }\n }\n}\n\n/**\n * Checks if a given key is a deep key or normal (shallow key).\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @example\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // true\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n *\n * @param key - The key to check.\n * @returns Returns true if the key is a deep key, otherwise false.\n */\nexport function isKeyOrDeepKey(key: PropertyKey): key is DeepKey<any> {\n switch (typeof key) {\n case \"number\": {\n return true;\n }\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return true;\n }\n }\n}\n","/* -------------------------------------------------------------------\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 { toStringKey } from \"@stryke/convert/to-string-key\";\nimport { isDeepKey } from \"@stryke/type-checks/is-deep-key\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { toPath } from \"./to-path\";\n\n/**\n * See the definition of `@types/lodash`.\n */\ntype GetIndexedField<T, K> = K extends keyof T\n ? T[K]\n : K extends `${number}`\n ? \"length\" extends keyof T\n ? number extends T[\"length\"]\n ? number extends keyof T\n ? T[number]\n : undefined\n : undefined\n : undefined\n : undefined;\n\ntype FieldWithPossiblyUndefined<T, Key> =\n | GetField<Exclude<T, undefined>, Key>\n | Extract<T, undefined>;\n\ntype IndexedFieldWithPossiblyUndefined<T, Key> =\n | GetIndexedField<Exclude<T, undefined>, Key>\n | Extract<T, undefined>;\n\nexport type GetField<T, P> = P extends `${infer Left}.${infer Right}`\n ? Left extends keyof Exclude<T, undefined>\n ?\n | FieldWithPossiblyUndefined<Exclude<T, undefined>[Left], Right>\n | Extract<T, undefined>\n : Left extends `${infer FieldKey}[${infer IndexKey}]`\n ? FieldKey extends keyof T\n ? FieldWithPossiblyUndefined<\n IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>,\n Right\n >\n : undefined\n : undefined\n : P extends keyof T\n ? T[P]\n : P extends `${infer FieldKey}[${infer IndexKey}]`\n ? FieldKey extends keyof T\n ? IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>\n : undefined\n : IndexedFieldWithPossiblyUndefined<T, P>;\n\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n *\n * @param {T} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K]} - Returns the resolved value.\n */\nexport function getField<T extends object, K extends keyof T>(\n object: T,\n path: K | readonly [K]\n): T[K];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K] | undefined} - Returns the resolved value.\n */\nexport function getField<T extends object, K extends keyof T>(\n object: T | null | undefined,\n path: K | readonly [K]\n): T[K] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K], undefined> | D} - Returns the resolved value.\n */\nexport function getField<T extends object, K extends keyof T, D>(\n object: T | null | undefined,\n path: K | readonly [K],\n defaultValue: D\n): Exclude<T[K], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n *\n * @param {T} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2]} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1]\n>(object: T, path: readonly [K1, K2]): T[K1][K2];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2] | undefined} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1]\n>(object: T | null | undefined, path: readonly [K1, K2]): T[K1][K2] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template D - The type of the default value.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2], undefined> | D} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n D\n>(\n object: T | null | undefined,\n path: readonly [K1, K2],\n defaultValue: D\n): Exclude<T[K1][K2], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n *\n * @param {T} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3]} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2]\n>(object: T, path: readonly [K1, K2, K3]): T[K1][K2][K3];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3] | undefined} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2]\n>(\n object: T | null | undefined,\n path: readonly [K1, K2, K3]\n): T[K1][K2][K3] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template D - The type of the default value.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3], undefined> | D} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n D\n>(\n object: T | null | undefined,\n path: readonly [K1, K2, K3],\n defaultValue: D\n): Exclude<T[K1][K2][K3], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n *\n * @param {T} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4]} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3]\n>(object: T, path: readonly [K1, K2, K3, K4]): T[K1][K2][K3][K4];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4] | undefined} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3]\n>(\n object: T | null | undefined,\n path: readonly [K1, K2, K3, K4]\n): T[K1][K2][K3][K4] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * @template D - The type of the default value.\n *\n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3][K4], undefined> | D} - Returns the resolved value.\n */\nexport function getField<\n T extends object,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n D\n>(\n object: T | null | undefined,\n path: readonly [K1, K2, K3, K4],\n defaultValue: D\n): Exclude<T[K1][K2][K3][K4], undefined> | D;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the value.\n *\n * @param {Record<number, T>} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T} - Returns the resolved value.\n */\nexport function getField<T>(object: Record<number, T>, path: number): T;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the value.\n *\n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T | undefined} - Returns the resolved value.\n */\nexport function getField<T>(\n object: Record<number, T> | null | undefined,\n path: number\n): T | undefined;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the value.\n * @template D - The type of the default value.\n *\n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {T | D} - Returns the resolved value.\n */\nexport function getField<T, D>(\n object: Record<number, T> | null | undefined,\n path: number,\n defaultValue: D\n): T | D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning the default value.\n *\n * @template D - The type of the default value.\n *\n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {D} - Returns the default value.\n */\nexport function getField<D>(\n object: null | undefined,\n path: PropertyKey,\n defaultValue: D\n): D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning undefined.\n *\n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @returns {undefined} - Returns undefined.\n */\nexport function getField(\n object: null | undefined,\n path: PropertyKey\n): undefined;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template P - The type of the path.\n *\n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @returns {string extends P ? any : GetField<T, P>} - Returns the resolved value.\n */\nexport function getField<T, P extends string>(\n data: T,\n path: P\n): string extends P ? any : GetField<T, P>;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @template T - The type of the object.\n * @template P - The type of the path.\n * @template D - The type of the default value.\n *\n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<GetField<T, P>, null | undefined> | D} - Returns the resolved value.\n */\nexport function getField<T, P extends string, D = GetField<T, P>>(\n data: T,\n path: P,\n defaultValue: D\n): Exclude<GetField<T, P>, null | undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @param {unknown} object - The object to query.\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @param {unknown} [defaultValue] - The value returned if the resolved value is undefined.\n * @returns {any} - Returns the resolved value.\n */\nexport function getField(\n object: unknown,\n path: PropertyKey | readonly PropertyKey[],\n defaultValue?: unknown\n): any;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n *\n * @param {unknown} object - The object to query.\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @param {unknown} [defaultValue] - The value returned if the resolved value is undefined.\n * @returns {any} - Returns the resolved value.\n */\nexport function getField(\n object: any,\n path: PropertyKey | readonly PropertyKey[],\n defaultValue?: any\n): any {\n if (object === null) {\n return defaultValue;\n }\n\n switch (typeof path) {\n case \"string\": {\n const result = object[path];\n\n if (result === undefined) {\n if (isDeepKey(path)) {\n return getField(object, toPath(path), defaultValue);\n }\n return defaultValue;\n }\n\n return result;\n }\n case \"number\":\n case \"symbol\": {\n if (isNumber(path)) {\n path = toStringKey(path);\n }\n\n const result = Array.isArray(path)\n ? undefined\n : object[path as PropertyKey];\n if (result === undefined) {\n return defaultValue;\n }\n\n return result;\n }\n default: {\n if (Array.isArray(path)) {\n return getWithPath(object, path, defaultValue);\n }\n\n path = Object.is(path?.valueOf(), -0) ? \"-0\" : String(path);\n\n const result = object[path];\n\n if (result === undefined) {\n return defaultValue;\n }\n\n return result;\n }\n }\n}\n\nfunction getWithPath(\n object: any,\n path: readonly PropertyKey[],\n defaultValue?: any\n): any {\n if (path.length === 0) {\n return defaultValue;\n }\n\n let current = object;\n\n for (const element_ of path) {\n if (current === null) {\n return defaultValue;\n }\n\n current = current[element_];\n }\n\n if (current === undefined) {\n return defaultValue;\n }\n\n return current;\n}\n"],"mappings":"mFAwBA,SAAgB,EAAY,EAAgC,CAK1D,OAJI,OAAO,GAAG,EAAO,GAAG,CACf,KAGF,EAAM,UAAU,CCOzB,SAAgB,EAAU,EAAuC,CAC/D,OAAQ,OAAO,EAAf,CACE,IAAK,SACL,IAAK,SACH,MAAO,GAET,IAAK,SACH,OAAO,EAAI,SAAS,IAAI,EAAI,EAAI,SAAS,IAAI,EAAI,EAAI,SAAS,IAAI,ECuXxE,SAAgB,EACd,EACA,EACA,EACK,CACL,GAAI,IAAW,KACb,OAAO,EAGT,OAAQ,OAAO,EAAf,CACE,IAAK,SAAU,CACb,IAAM,EAAS,EAAO,GAStB,OAPI,IAAW,IAAA,GACT,EAAU,EAAK,CACV,EAAS,EAAQ,EAAO,EAAK,CAAE,EAAa,CAE9C,EAGF,EAET,IAAK,SACL,IAAK,SAAU,CACT,EAAS,EAAK,GAChB,EAAO,EAAY,EAAK,EAG1B,IAAM,EAAS,MAAM,QAAQ,EAAK,CAC9B,IAAA,GACA,EAAO,GAKX,OAJI,IAAW,IAAA,GACN,EAGF,EAET,QAAS,CACP,GAAI,MAAM,QAAQ,EAAK,CACrB,OAAO,EAAY,EAAQ,EAAM,EAAa,CAGhD,EAAO,OAAO,GAAG,GAAM,SAAS,CAAE,GAAG,CAAG,KAAO,OAAO,EAAK,CAE3D,IAAM,EAAS,EAAO,GAMtB,OAJI,IAAW,IAAA,GACN,EAGF,IAKb,SAAS,EACP,EACA,EACA,EACK,CACL,GAAI,EAAK,SAAW,EAClB,OAAO,EAGT,IAAI,EAAU,EAEd,IAAK,IAAM,KAAY,EAAM,CAC3B,GAAI,IAAY,KACd,OAAO,EAGT,EAAU,EAAQ,GAOpB,OAJI,IAAY,IAAA,GACP,EAGF"}
|