@vinicunca/perkakas 1.15.0 → 1.16.0
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/dist/add-prop.cjs +1 -1
- package/dist/add-prop.cjs.map +1 -1
- package/dist/add-prop.js.map +1 -1
- package/dist/add.cjs +1 -1
- package/dist/add.cjs.map +1 -1
- package/dist/add.js.map +1 -1
- package/dist/all-pass.cjs +1 -1
- package/dist/all-pass.cjs.map +1 -1
- package/dist/all-pass.js.map +1 -1
- package/dist/any-pass.cjs +1 -1
- package/dist/any-pass.cjs.map +1 -1
- package/dist/any-pass.js.map +1 -1
- package/dist/{binary-search-cutoff-index-TJlnoie4.js → binary-search-cutoff-index-CRPy-dOJ.js} +1 -1
- package/dist/{binary-search-cutoff-index-TJlnoie4.js.map → binary-search-cutoff-index-CRPy-dOJ.js.map} +1 -1
- package/dist/binary-search-cutoff-index-CdUUMUB1.cjs +2 -0
- package/dist/{binary-search-cutoff-index-CLFtXYPc.cjs.map → binary-search-cutoff-index-CdUUMUB1.cjs.map} +1 -1
- package/dist/capitalize.cjs +1 -1
- package/dist/capitalize.cjs.map +1 -1
- package/dist/capitalize.js.map +1 -1
- package/dist/ceil.cjs +1 -1
- package/dist/ceil.cjs.map +1 -1
- package/dist/ceil.js +1 -1
- package/dist/ceil.js.map +1 -1
- package/dist/chunk.cjs +1 -1
- package/dist/chunk.cjs.map +1 -1
- package/dist/chunk.js.map +1 -1
- package/dist/clamp.cjs +1 -1
- package/dist/clamp.cjs.map +1 -1
- package/dist/clamp.js.map +1 -1
- package/dist/clone.cjs +1 -1
- package/dist/clone.cjs.map +1 -1
- package/dist/clone.js.map +1 -1
- package/dist/concat.cjs +1 -1
- package/dist/concat.cjs.map +1 -1
- package/dist/concat.js.map +1 -1
- package/dist/conditional.cjs +2 -1
- package/dist/conditional.cjs.map +1 -0
- package/dist/conditional.js +2 -1
- package/dist/conditional.js.map +1 -0
- package/dist/constant.cjs.map +1 -1
- package/dist/constant.js.map +1 -1
- package/dist/count-by.cjs +1 -1
- package/dist/count-by.cjs.map +1 -1
- package/dist/count-by.js.map +1 -1
- package/dist/{curry-from-lazy-CtH1dp14.js → curry-from-lazy-BoPMn2L_.js} +1 -1
- package/dist/{curry-from-lazy-CtH1dp14.js.map → curry-from-lazy-BoPMn2L_.js.map} +1 -1
- package/dist/{curry-from-lazy-BvN_VKlH.cjs → curry-from-lazy-mdjeRP1g.cjs} +2 -2
- package/dist/{curry-from-lazy-BvN_VKlH.cjs.map → curry-from-lazy-mdjeRP1g.cjs.map} +1 -1
- package/dist/curry-on-Et2NUOHd.js +2 -0
- package/dist/curry-on-Et2NUOHd.js.map +1 -0
- package/dist/curry-on-wBH_q-mO.cjs +2 -0
- package/dist/curry-on-wBH_q-mO.cjs.map +1 -0
- package/dist/{curry-order-rules-DsJSy3gX.cjs → curry-order-rules-CacOTzfW.cjs} +2 -2
- package/dist/{curry-order-rules-DsJSy3gX.cjs.map → curry-order-rules-CacOTzfW.cjs.map} +1 -1
- package/dist/{curry-order-rules-BLyCSMdZ.js → curry-order-rules-Dage-BeC.js} +1 -1
- package/dist/{curry-order-rules-BLyCSMdZ.js.map → curry-order-rules-Dage-BeC.js.map} +1 -1
- package/dist/curry.cjs +1 -1
- package/dist/curry.cjs.map +1 -1
- package/dist/curry.js +1 -1
- package/dist/curry.js.map +1 -1
- package/dist/debounce.cjs.map +1 -1
- package/dist/debounce.js.map +1 -1
- package/dist/default-to.cjs +1 -1
- package/dist/default-to.cjs.map +1 -1
- package/dist/default-to.js.map +1 -1
- package/dist/difference-with.cjs +1 -1
- package/dist/difference-with.cjs.map +1 -1
- package/dist/difference-with.js +1 -1
- package/dist/difference-with.js.map +1 -1
- package/dist/difference.cjs +1 -1
- package/dist/difference.cjs.map +1 -1
- package/dist/difference.js +1 -1
- package/dist/difference.js.map +1 -1
- package/dist/divide.cjs +1 -1
- package/dist/divide.cjs.map +1 -1
- package/dist/divide.js.map +1 -1
- package/dist/do-nothing.cjs.map +1 -1
- package/dist/do-nothing.js.map +1 -1
- package/dist/drop-first-by.cjs +1 -1
- package/dist/drop-first-by.cjs.map +1 -1
- package/dist/drop-first-by.js +1 -1
- package/dist/drop-first-by.js.map +1 -1
- package/dist/drop-last-while.cjs +1 -1
- package/dist/drop-last-while.cjs.map +1 -1
- package/dist/drop-last-while.js.map +1 -1
- package/dist/drop-last.cjs +1 -1
- package/dist/drop-last.cjs.map +1 -1
- package/dist/drop-last.js.map +1 -1
- package/dist/drop-while.cjs +1 -1
- package/dist/drop-while.cjs.map +1 -1
- package/dist/drop-while.js.map +1 -1
- package/dist/drop.cjs +1 -1
- package/dist/drop.cjs.map +1 -1
- package/dist/drop.js +1 -1
- package/dist/drop.js.map +1 -1
- package/dist/ends-with.cjs +1 -1
- package/dist/ends-with.cjs.map +1 -1
- package/dist/ends-with.js.map +1 -1
- package/dist/entries.cjs +1 -1
- package/dist/entries.cjs.map +1 -1
- package/dist/entries.js.map +1 -1
- package/dist/evolve.cjs +1 -1
- package/dist/evolve.cjs.map +1 -1
- package/dist/evolve.js.map +1 -1
- package/dist/filter.cjs +1 -1
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/find-index.cjs +1 -1
- package/dist/find-index.cjs.map +1 -1
- package/dist/find-index.js.map +1 -1
- package/dist/find-last-index.cjs +1 -1
- package/dist/find-last-index.cjs.map +1 -1
- package/dist/find-last-index.js.map +1 -1
- package/dist/find-last.cjs +1 -1
- package/dist/find-last.cjs.map +1 -1
- package/dist/find-last.js.map +1 -1
- package/dist/find.cjs +1 -1
- package/dist/find.cjs.map +1 -1
- package/dist/find.js +1 -1
- package/dist/find.js.map +1 -1
- package/dist/first-by.cjs +1 -1
- package/dist/first-by.cjs.map +1 -1
- package/dist/first-by.js +1 -1
- package/dist/first-by.js.map +1 -1
- package/dist/first.cjs +1 -1
- package/dist/first.cjs.map +1 -1
- package/dist/first.js +1 -1
- package/dist/first.js.map +1 -1
- package/dist/flat-map.cjs +1 -1
- package/dist/flat-map.cjs.map +1 -1
- package/dist/flat-map.js.map +1 -1
- package/dist/flat.cjs +1 -1
- package/dist/flat.cjs.map +1 -1
- package/dist/flat.js +1 -1
- package/dist/flat.js.map +1 -1
- package/dist/floor.cjs +1 -1
- package/dist/floor.cjs.map +1 -1
- package/dist/floor.js +1 -1
- package/dist/floor.js.map +1 -1
- package/dist/for-each-obj.cjs +1 -1
- package/dist/for-each-obj.cjs.map +1 -1
- package/dist/for-each-obj.js.map +1 -1
- package/dist/for-each.cjs +1 -1
- package/dist/for-each.cjs.map +1 -1
- package/dist/for-each.js.map +1 -1
- package/dist/from-entries.cjs +1 -1
- package/dist/from-entries.cjs.map +1 -1
- package/dist/from-entries.js.map +1 -1
- package/dist/from-keys.cjs +1 -1
- package/dist/from-keys.cjs.map +1 -1
- package/dist/from-keys.js.map +1 -1
- package/dist/funnel.cjs.map +1 -1
- package/dist/funnel.js.map +1 -1
- package/dist/group-by-prop.cjs +1 -1
- package/dist/group-by-prop.cjs.map +1 -1
- package/dist/group-by-prop.js.map +1 -1
- package/dist/group-by.cjs +1 -1
- package/dist/group-by.cjs.map +1 -1
- package/dist/group-by.js.map +1 -1
- package/dist/has-at-least.cjs +1 -1
- package/dist/has-at-least.cjs.map +1 -1
- package/dist/has-at-least.js.map +1 -1
- package/dist/has-prop.cjs +2 -0
- package/dist/has-prop.cjs.map +1 -0
- package/dist/has-prop.js +2 -0
- package/dist/has-prop.js.map +1 -0
- package/dist/has-sub-object.cjs +1 -1
- package/dist/has-sub-object.cjs.map +1 -1
- package/dist/has-sub-object.js.map +1 -1
- package/dist/heap-BK0Y5t1Y.cjs +2 -0
- package/dist/{heap-C0zPQGC0.cjs.map → heap-BK0Y5t1Y.cjs.map} +1 -1
- package/dist/{heap-M6D40vkc.js → heap-CL5ahv5n.js} +2 -2
- package/dist/{heap-M6D40vkc.js.map → heap-CL5ahv5n.js.map} +1 -1
- package/dist/human-readable-file-size.cjs.map +1 -1
- package/dist/human-readable-file-size.js.map +1 -1
- package/dist/identity.cjs.map +1 -1
- package/dist/identity.js.map +1 -1
- package/dist/index-by.cjs +1 -1
- package/dist/index-by.cjs.map +1 -1
- package/dist/index-by.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +174 -202
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +174 -202
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intersection-with.cjs +1 -1
- package/dist/intersection-with.cjs.map +1 -1
- package/dist/intersection-with.js +1 -1
- package/dist/intersection-with.js.map +1 -1
- package/dist/intersection.cjs +1 -1
- package/dist/intersection.cjs.map +1 -1
- package/dist/intersection.js +1 -1
- package/dist/intersection.js.map +1 -1
- package/dist/invert.cjs +1 -1
- package/dist/invert.cjs.map +1 -1
- package/dist/invert.js.map +1 -1
- package/dist/is-array.cjs.map +1 -1
- package/dist/is-array.js.map +1 -1
- package/dist/is-big-int.cjs.map +1 -1
- package/dist/is-big-int.js.map +1 -1
- package/dist/is-boolean.cjs.map +1 -1
- package/dist/is-boolean.js.map +1 -1
- package/dist/is-date.cjs.map +1 -1
- package/dist/is-date.js.map +1 -1
- package/dist/is-deep-equal.cjs +1 -1
- package/dist/is-deep-equal.cjs.map +1 -1
- package/dist/is-deep-equal.js +1 -1
- package/dist/is-deep-equal.js.map +1 -1
- package/dist/is-defined.cjs.map +1 -1
- package/dist/is-defined.js.map +1 -1
- package/dist/is-empty.cjs.map +1 -1
- package/dist/is-empty.js.map +1 -1
- package/dist/is-emptyish.cjs.map +1 -1
- package/dist/is-emptyish.js.map +1 -1
- package/dist/is-error.cjs.map +1 -1
- package/dist/is-error.js.map +1 -1
- package/dist/is-function.cjs.map +1 -1
- package/dist/is-function.js.map +1 -1
- package/dist/is-included-in.cjs.map +1 -1
- package/dist/is-included-in.js.map +1 -1
- package/dist/is-non-null.cjs.map +1 -1
- package/dist/is-non-null.js.map +1 -1
- package/dist/is-non-nullish.cjs.map +1 -1
- package/dist/is-non-nullish.js.map +1 -1
- package/dist/is-not.cjs.map +1 -1
- package/dist/is-not.js.map +1 -1
- package/dist/is-nullish.cjs.map +1 -1
- package/dist/is-nullish.js.map +1 -1
- package/dist/is-number.cjs.map +1 -1
- package/dist/is-number.js.map +1 -1
- package/dist/is-object-type.cjs.map +1 -1
- package/dist/is-object-type.js.map +1 -1
- package/dist/is-plain-object.cjs.map +1 -1
- package/dist/is-plain-object.js.map +1 -1
- package/dist/is-promise.cjs.map +1 -1
- package/dist/is-promise.js.map +1 -1
- package/dist/is-shallow-equal.cjs +1 -1
- package/dist/is-shallow-equal.cjs.map +1 -1
- package/dist/is-shallow-equal.js.map +1 -1
- package/dist/is-strict-equal.cjs +1 -1
- package/dist/is-strict-equal.cjs.map +1 -1
- package/dist/is-strict-equal.js.map +1 -1
- package/dist/is-string.cjs.map +1 -1
- package/dist/is-string.js.map +1 -1
- package/dist/is-symbol.cjs.map +1 -1
- package/dist/is-symbol.js.map +1 -1
- package/dist/is-truthy.cjs.map +1 -1
- package/dist/is-truthy.js.map +1 -1
- package/dist/join.cjs +1 -1
- package/dist/join.cjs.map +1 -1
- package/dist/join.js.map +1 -1
- package/dist/key-codes.cjs.map +1 -1
- package/dist/key-codes.js.map +1 -1
- package/dist/keys.cjs +1 -1
- package/dist/keys.cjs.map +1 -1
- package/dist/keys.js.map +1 -1
- package/dist/last.cjs +1 -1
- package/dist/last.cjs.map +1 -1
- package/dist/last.js.map +1 -1
- package/dist/{lazy-data-last-impl-Vt_M0l7X.js → lazy-data-last-impl--3B10z3s.js} +1 -1
- package/dist/{lazy-data-last-impl-Vt_M0l7X.js.map → lazy-data-last-impl--3B10z3s.js.map} +1 -1
- package/dist/lazy-data-last-impl-Dd5zjCfU.cjs +2 -0
- package/dist/{lazy-data-last-impl-B05ZpguF.cjs.map → lazy-data-last-impl-Dd5zjCfU.cjs.map} +1 -1
- package/dist/length.cjs +1 -1
- package/dist/length.cjs.map +1 -1
- package/dist/length.js.map +1 -1
- package/dist/map-keys.cjs +1 -1
- package/dist/map-keys.cjs.map +1 -1
- package/dist/map-keys.js.map +1 -1
- package/dist/map-to-obj.cjs +1 -1
- package/dist/map-to-obj.cjs.map +1 -1
- package/dist/map-to-obj.js.map +1 -1
- package/dist/map-values.cjs +1 -1
- package/dist/map-values.cjs.map +1 -1
- package/dist/map-values.js.map +1 -1
- package/dist/map-with-feedback.cjs +1 -1
- package/dist/map-with-feedback.cjs.map +1 -1
- package/dist/map-with-feedback.js +1 -1
- package/dist/map-with-feedback.js.map +1 -1
- package/dist/map.cjs +1 -1
- package/dist/map.cjs.map +1 -1
- package/dist/map.js.map +1 -1
- package/dist/mean-by.cjs +1 -1
- package/dist/mean-by.cjs.map +1 -1
- package/dist/mean-by.js.map +1 -1
- package/dist/mean.cjs +1 -1
- package/dist/mean.cjs.map +1 -1
- package/dist/mean.js.map +1 -1
- package/dist/median.cjs +1 -1
- package/dist/median.cjs.map +1 -1
- package/dist/median.js.map +1 -1
- package/dist/merge-all.cjs.map +1 -1
- package/dist/merge-all.js.map +1 -1
- package/dist/merge-deep.cjs +1 -1
- package/dist/merge-deep.cjs.map +1 -1
- package/dist/merge-deep.js.map +1 -1
- package/dist/merge.cjs +1 -1
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.js.map +1 -1
- package/dist/multiply.cjs +1 -1
- package/dist/multiply.cjs.map +1 -1
- package/dist/multiply.js.map +1 -1
- package/dist/{nth-by-zZ3RM-mR.cjs → nth-by-BrkoqeV2.cjs} +2 -2
- package/dist/{nth-by-zZ3RM-mR.cjs.map → nth-by-BrkoqeV2.cjs.map} +1 -1
- package/dist/{nth-by-DhfNV5xd.js → nth-by-DGcGGvJX.js} +2 -2
- package/dist/{nth-by-DhfNV5xd.js.map → nth-by-DGcGGvJX.js.map} +1 -1
- package/dist/nth-by.cjs +1 -1
- package/dist/nth-by.js +1 -1
- package/dist/obj-of.cjs +1 -1
- package/dist/obj-of.cjs.map +1 -1
- package/dist/obj-of.js.map +1 -1
- package/dist/omit-by.cjs +1 -1
- package/dist/omit-by.cjs.map +1 -1
- package/dist/omit-by.js.map +1 -1
- package/dist/omit.cjs +1 -1
- package/dist/omit.cjs.map +1 -1
- package/dist/omit.js.map +1 -1
- package/dist/once.cjs.map +1 -1
- package/dist/once.js.map +1 -1
- package/dist/only.cjs +1 -1
- package/dist/only.cjs.map +1 -1
- package/dist/only.js.map +1 -1
- package/dist/partial-bind.cjs.map +1 -1
- package/dist/partial-bind.js.map +1 -1
- package/dist/partial-last-bind.cjs.map +1 -1
- package/dist/partial-last-bind.js.map +1 -1
- package/dist/partition.cjs +1 -1
- package/dist/partition.cjs.map +1 -1
- package/dist/partition.js.map +1 -1
- package/dist/path-or.cjs +1 -1
- package/dist/path-or.cjs.map +1 -1
- package/dist/path-or.js.map +1 -1
- package/dist/pick-by.cjs +1 -1
- package/dist/pick-by.cjs.map +1 -1
- package/dist/pick-by.js.map +1 -1
- package/dist/pick.cjs +1 -1
- package/dist/pick.cjs.map +1 -1
- package/dist/pick.js.map +1 -1
- package/dist/pipe.cjs +1 -1
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.js +1 -1
- package/dist/pipe.js.map +1 -1
- package/dist/piped.cjs +1 -1
- package/dist/piped.cjs.map +1 -1
- package/dist/piped.js.map +1 -1
- package/dist/product.cjs +1 -1
- package/dist/product.cjs.map +1 -1
- package/dist/product.js.map +1 -1
- package/dist/prop.cjs.map +1 -1
- package/dist/prop.js.map +1 -1
- package/dist/pull-object.cjs +1 -1
- package/dist/pull-object.cjs.map +1 -1
- package/dist/pull-object.js.map +1 -1
- package/dist/random-big-int.cjs.map +1 -1
- package/dist/random-big-int.js.map +1 -1
- package/dist/random-integer.cjs.map +1 -1
- package/dist/random-integer.js.map +1 -1
- package/dist/random-string.cjs +1 -1
- package/dist/random-string.cjs.map +1 -1
- package/dist/random-string.js.map +1 -1
- package/dist/range.cjs +1 -1
- package/dist/range.cjs.map +1 -1
- package/dist/range.js.map +1 -1
- package/dist/rank-by.cjs +1 -1
- package/dist/rank-by.cjs.map +1 -1
- package/dist/rank-by.js +1 -1
- package/dist/rank-by.js.map +1 -1
- package/dist/reduce.cjs +1 -1
- package/dist/reduce.cjs.map +1 -1
- package/dist/reduce.js.map +1 -1
- package/dist/reverse.cjs +1 -1
- package/dist/reverse.cjs.map +1 -1
- package/dist/reverse.js.map +1 -1
- package/dist/round.cjs +1 -1
- package/dist/round.cjs.map +1 -1
- package/dist/round.js +1 -1
- package/dist/round.js.map +1 -1
- package/dist/sample.cjs +1 -1
- package/dist/sample.cjs.map +1 -1
- package/dist/sample.js.map +1 -1
- package/dist/set-path.cjs +1 -1
- package/dist/set-path.cjs.map +1 -1
- package/dist/set-path.js.map +1 -1
- package/dist/set.cjs +1 -1
- package/dist/set.cjs.map +1 -1
- package/dist/set.js.map +1 -1
- package/dist/shuffle.cjs +1 -1
- package/dist/shuffle.cjs.map +1 -1
- package/dist/shuffle.js.map +1 -1
- package/dist/sleep.cjs.map +1 -1
- package/dist/sleep.js.map +1 -1
- package/dist/slice-string.cjs.map +1 -1
- package/dist/slice-string.js.map +1 -1
- package/dist/slugify.cjs.map +1 -1
- package/dist/slugify.js.map +1 -1
- package/dist/sort-by.cjs +1 -1
- package/dist/sort-by.cjs.map +1 -1
- package/dist/sort-by.js +1 -1
- package/dist/sort-by.js.map +1 -1
- package/dist/sort.cjs +1 -1
- package/dist/sort.cjs.map +1 -1
- package/dist/sort.js.map +1 -1
- package/dist/sorted-index-by.cjs +1 -1
- package/dist/sorted-index-by.cjs.map +1 -1
- package/dist/sorted-index-by.js +1 -1
- package/dist/sorted-index-by.js.map +1 -1
- package/dist/sorted-index-with.cjs +1 -1
- package/dist/sorted-index-with.cjs.map +1 -1
- package/dist/sorted-index-with.js +1 -1
- package/dist/sorted-index-with.js.map +1 -1
- package/dist/sorted-index.cjs +1 -1
- package/dist/sorted-index.cjs.map +1 -1
- package/dist/sorted-index.js +1 -1
- package/dist/sorted-index.js.map +1 -1
- package/dist/sorted-last-index-by.cjs +1 -1
- package/dist/sorted-last-index-by.cjs.map +1 -1
- package/dist/sorted-last-index-by.js +1 -1
- package/dist/sorted-last-index-by.js.map +1 -1
- package/dist/sorted-last-index.cjs +1 -1
- package/dist/sorted-last-index.cjs.map +1 -1
- package/dist/sorted-last-index.js +1 -1
- package/dist/sorted-last-index.js.map +1 -1
- package/dist/splice.cjs +1 -1
- package/dist/splice.cjs.map +1 -1
- package/dist/splice.js +1 -1
- package/dist/splice.js.map +1 -1
- package/dist/split-at.cjs +1 -1
- package/dist/split-at.cjs.map +1 -1
- package/dist/split-at.js.map +1 -1
- package/dist/split-when.cjs +1 -1
- package/dist/split-when.cjs.map +1 -1
- package/dist/split-when.js.map +1 -1
- package/dist/split.cjs.map +1 -1
- package/dist/split.js.map +1 -1
- package/dist/starts-with.cjs +1 -1
- package/dist/starts-with.cjs.map +1 -1
- package/dist/starts-with.js.map +1 -1
- package/dist/string-to-path.cjs.map +1 -1
- package/dist/string-to-path.js.map +1 -1
- package/dist/subtract.cjs +1 -1
- package/dist/subtract.cjs.map +1 -1
- package/dist/subtract.js.map +1 -1
- package/dist/sum-by.cjs +1 -1
- package/dist/sum-by.cjs.map +1 -1
- package/dist/sum-by.js.map +1 -1
- package/dist/sum.cjs +1 -1
- package/dist/sum.cjs.map +1 -1
- package/dist/sum.js.map +1 -1
- package/dist/swap-in-place-CllcD0HG.cjs +2 -0
- package/dist/{swap-in-place-D1vasegg.cjs.map → swap-in-place-CllcD0HG.cjs.map} +1 -1
- package/dist/{swap-in-place-BzNaxwB3.js → swap-in-place-ubtnp8en.js} +1 -1
- package/dist/{swap-in-place-BzNaxwB3.js.map → swap-in-place-ubtnp8en.js.map} +1 -1
- package/dist/swap-indices.cjs +1 -1
- package/dist/swap-indices.cjs.map +1 -1
- package/dist/swap-indices.js.map +1 -1
- package/dist/swap-props.cjs +1 -1
- package/dist/swap-props.cjs.map +1 -1
- package/dist/swap-props.js.map +1 -1
- package/dist/take-first-by.cjs +1 -1
- package/dist/take-first-by.cjs.map +1 -1
- package/dist/take-first-by.js +1 -1
- package/dist/take-first-by.js.map +1 -1
- package/dist/take-last-while.cjs +1 -1
- package/dist/take-last-while.cjs.map +1 -1
- package/dist/take-last-while.js.map +1 -1
- package/dist/take-last.cjs +1 -1
- package/dist/take-last.cjs.map +1 -1
- package/dist/take-last.js.map +1 -1
- package/dist/take-while.cjs +1 -1
- package/dist/take-while.cjs.map +1 -1
- package/dist/take-while.js.map +1 -1
- package/dist/take.cjs +1 -1
- package/dist/take.cjs.map +1 -1
- package/dist/take.js +1 -1
- package/dist/take.js.map +1 -1
- package/dist/tap.cjs +1 -1
- package/dist/tap.cjs.map +1 -1
- package/dist/tap.js.map +1 -1
- package/dist/times.cjs +1 -1
- package/dist/times.cjs.map +1 -1
- package/dist/times.js.map +1 -1
- package/dist/to-camel-case.cjs +1 -1
- package/dist/to-camel-case.cjs.map +1 -1
- package/dist/to-camel-case.js +1 -1
- package/dist/to-camel-case.js.map +1 -1
- package/dist/to-kebab-case.cjs +1 -1
- package/dist/to-kebab-case.cjs.map +1 -1
- package/dist/to-kebab-case.js +1 -1
- package/dist/to-kebab-case.js.map +1 -1
- package/dist/to-lower-case.cjs +1 -1
- package/dist/to-lower-case.cjs.map +1 -1
- package/dist/to-lower-case.js.map +1 -1
- package/dist/to-single-BOkjnmkm.cjs +2 -0
- package/dist/{to-single-BunGuk7o.cjs.map → to-single-BOkjnmkm.cjs.map} +1 -1
- package/dist/{to-single-XEXXW73e.js → to-single-D6t2BxVq.js} +1 -1
- package/dist/{to-single-XEXXW73e.js.map → to-single-D6t2BxVq.js.map} +1 -1
- package/dist/to-snake-case.cjs +1 -1
- package/dist/to-snake-case.cjs.map +1 -1
- package/dist/to-snake-case.js +1 -1
- package/dist/to-snake-case.js.map +1 -1
- package/dist/to-title-case.cjs +1 -1
- package/dist/to-title-case.cjs.map +1 -1
- package/dist/to-title-case.js +1 -1
- package/dist/to-title-case.js.map +1 -1
- package/dist/to-upper-case.cjs +1 -1
- package/dist/to-upper-case.cjs.map +1 -1
- package/dist/to-upper-case.js.map +1 -1
- package/dist/truncate.cjs.map +1 -1
- package/dist/truncate.js.map +1 -1
- package/dist/uncapitalize.cjs +1 -1
- package/dist/uncapitalize.cjs.map +1 -1
- package/dist/uncapitalize.js.map +1 -1
- package/dist/unique-by.cjs +1 -1
- package/dist/unique-by.cjs.map +1 -1
- package/dist/unique-by.js +1 -1
- package/dist/unique-by.js.map +1 -1
- package/dist/unique-with.cjs +1 -1
- package/dist/unique-with.cjs.map +1 -1
- package/dist/unique-with.js +1 -1
- package/dist/unique-with.js.map +1 -1
- package/dist/unique.cjs +1 -1
- package/dist/unique.cjs.map +1 -1
- package/dist/unique.js +1 -1
- package/dist/unique.js.map +1 -1
- package/dist/utility-evaluators-BGM19SpK.cjs +2 -0
- package/dist/{utility-evaluators-C8koSp9T.cjs.map → utility-evaluators-BGM19SpK.cjs.map} +1 -1
- package/dist/{utility-evaluators-ZAaUtL2Z.js → utility-evaluators-DDW55xeL.js} +1 -1
- package/dist/{utility-evaluators-ZAaUtL2Z.js.map → utility-evaluators-DDW55xeL.js.map} +1 -1
- package/dist/values.cjs +1 -1
- package/dist/values.cjs.map +1 -1
- package/dist/values.js.map +1 -1
- package/dist/when.cjs.map +1 -1
- package/dist/when.js.map +1 -1
- package/dist/{with-precision-CgRuf7Wl.js → with-precision-D-84B_By.js} +1 -1
- package/dist/{with-precision-CgRuf7Wl.js.map → with-precision-D-84B_By.js.map} +1 -1
- package/dist/{with-precision-DVi9325n.cjs → with-precision-Dy5W6bdk.cjs} +2 -2
- package/dist/{with-precision-DVi9325n.cjs.map → with-precision-Dy5W6bdk.cjs.map} +1 -1
- package/dist/{words-_h74qi45.cjs → words-B-9EXtsW.cjs} +2 -2
- package/dist/{words-_h74qi45.cjs.map → words-B-9EXtsW.cjs.map} +1 -1
- package/dist/{words-B9lX8euz.js → words-CN1Qil5U.js} +1 -1
- package/dist/{words-B9lX8euz.js.map → words-CN1Qil5U.js.map} +1 -1
- package/dist/zip-with.cjs +1 -1
- package/dist/zip-with.cjs.map +1 -1
- package/dist/zip-with.js +1 -1
- package/dist/zip-with.js.map +1 -1
- package/dist/zip.cjs +1 -1
- package/dist/zip.cjs.map +1 -1
- package/dist/zip.js.map +1 -1
- package/package.json +11 -11
- package/dist/binary-search-cutoff-index-CLFtXYPc.cjs +0 -2
- package/dist/conditional-3wcaMG9k.cjs +0 -2
- package/dist/conditional-3wcaMG9k.cjs.map +0 -1
- package/dist/conditional-CTEJD5TX.js +0 -2
- package/dist/conditional-CTEJD5TX.js.map +0 -1
- package/dist/heap-C0zPQGC0.cjs +0 -2
- package/dist/lazy-data-last-impl-B05ZpguF.cjs +0 -2
- package/dist/swap-in-place-D1vasegg.cjs +0 -2
- package/dist/to-single-BunGuk7o.cjs +0 -2
- package/dist/utility-evaluators-C8koSp9T.cjs +0 -2
package/dist/merge-deep.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-deep.cjs","names":["curry","isPlainObject"],"sources":["../src/merge-deep.ts"],"sourcesContent":["import type { MergeDeep } from 'type-fest';\nimport { curry } from './curry';\nimport { isPlainObject } from './is-plain-object';\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param destination - The object to merge into. In general, this object would have it's values overridden.\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(destination, source)\n * @example\n * mergeDeep({ foo: 'bar', x: 1 }, { foo: 'baz', y: 2 }) // => { foo: 'baz', x: 1, y: 2 }\n * @dataFirst\n * @category Object\n */\nexport function mergeDeep<Destination extends object, Source extends object>(\n destination: Destination,\n source: Source,\n): MergeDeep<Destination, Source>;\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(source)(destination)\n * @example\n * pipe(\n * { foo: 'bar', x: 1 },\n * mergeDeep({ foo: 'baz', y: 2 }),\n * ); // => { foo: 'baz', x: 1, y: 2 }\n * @dataLast\n * @category Object\n */\nexport function mergeDeep<Source extends object>(\n source: Source,\n): <Destination extends object>(\n target: Destination,\n) => MergeDeep<Destination, Source>;\n\nexport function mergeDeep(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeDeepImplementation, args);\n}\n\nfunction mergeDeepImplementation<\n Destination extends object,\n Source extends object,\n>(destination: Destination, source: Source): MergeDeep<Destination, Source> {\n // At this point the output is already merged, simply not deeply merged.\n const output = { ...destination, ...source } as Record<\n keyof Destination | keyof Source,\n unknown\n >;\n\n // now just scan the output and look for values that should have been deep-merged\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (!(key in destination)) {\n // They don't share this key.\n continue;\n }\n\n const { [key]: destinationValue } = destination;\n if (!isPlainObject(destinationValue)) {\n // The value in destination is not a mergeable object so the value from\n // source (which was already copied in the shallow merge) would be used\n // as-is.\n continue;\n }\n\n const { [key]: sourceValue } = source;\n if (!isPlainObject(sourceValue)) {\n // The value in source is not a mergeable object either, so it will\n // override the object in destination.\n continue;\n }\n\n // Both destination and source have a mergeable object for this key, so we\n // recursively merge them.\n // @ts-expect-error [ts2590] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n output[key] = mergeDeepImplementation(destinationValue, sourceValue);\n }\n\n // @ts-expect-error [ts2322] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n return output;\n}\n"],"mappings":"qIA2CA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAOA,EAAAA,MAAM,EAAyB,
|
|
1
|
+
{"version":3,"file":"merge-deep.cjs","names":["curry","isPlainObject"],"sources":["../src/merge-deep.ts"],"sourcesContent":["import type { MergeDeep } from 'type-fest';\nimport { curry } from './curry';\nimport { isPlainObject } from './is-plain-object';\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param destination - The object to merge into. In general, this object would have it's values overridden.\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(destination, source)\n * @example\n * mergeDeep({ foo: 'bar', x: 1 }, { foo: 'baz', y: 2 }) // => { foo: 'baz', x: 1, y: 2 }\n * @dataFirst\n * @category Object\n */\nexport function mergeDeep<Destination extends object, Source extends object>(\n destination: Destination,\n source: Source,\n): MergeDeep<Destination, Source>;\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(source)(destination)\n * @example\n * pipe(\n * { foo: 'bar', x: 1 },\n * mergeDeep({ foo: 'baz', y: 2 }),\n * ); // => { foo: 'baz', x: 1, y: 2 }\n * @dataLast\n * @category Object\n */\nexport function mergeDeep<Source extends object>(\n source: Source,\n): <Destination extends object>(\n target: Destination,\n) => MergeDeep<Destination, Source>;\n\nexport function mergeDeep(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeDeepImplementation, args);\n}\n\nfunction mergeDeepImplementation<\n Destination extends object,\n Source extends object,\n>(destination: Destination, source: Source): MergeDeep<Destination, Source> {\n // At this point the output is already merged, simply not deeply merged.\n const output = { ...destination, ...source } as Record<\n keyof Destination | keyof Source,\n unknown\n >;\n\n // now just scan the output and look for values that should have been deep-merged\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (!(key in destination)) {\n // They don't share this key.\n continue;\n }\n\n const { [key]: destinationValue } = destination;\n if (!isPlainObject(destinationValue)) {\n // The value in destination is not a mergeable object so the value from\n // source (which was already copied in the shallow merge) would be used\n // as-is.\n continue;\n }\n\n const { [key]: sourceValue } = source;\n if (!isPlainObject(sourceValue)) {\n // The value in source is not a mergeable object either, so it will\n // override the object in destination.\n continue;\n }\n\n // Both destination and source have a mergeable object for this key, so we\n // recursively merge them.\n // @ts-expect-error [ts2590] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n output[key] = mergeDeepImplementation(destinationValue, sourceValue);\n }\n\n // @ts-expect-error [ts2322] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n return output;\n}\n"],"mappings":"qIA2CA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAOA,EAAAA,MAAM,EAAyB,CAAI,CAC5C,CAEA,SAAS,EAGP,EAA0B,EAAgD,CAE1E,IAAM,EAAS,CAAE,GAAG,EAAa,GAAG,CAAO,EAO3C,IAAK,IAAM,KAAO,EAAQ,CACxB,GAAI,EAAE,KAAO,GAEX,SAGF,GAAM,EAAG,GAAM,GAAqB,EACpC,GAAI,CAACC,EAAAA,cAAc,CAAgB,EAIjC,SAGF,GAAM,EAAG,GAAM,GAAgB,EAC1BA,EAAAA,cAAc,CAAW,IAS9B,EAAO,GAAO,EAAwB,EAAkB,CAAW,EACrE,CAGA,OAAO,CACT"}
|
package/dist/merge-deep.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-deep.js","names":[],"sources":["../src/merge-deep.ts"],"sourcesContent":["import type { MergeDeep } from 'type-fest';\nimport { curry } from './curry';\nimport { isPlainObject } from './is-plain-object';\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param destination - The object to merge into. In general, this object would have it's values overridden.\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(destination, source)\n * @example\n * mergeDeep({ foo: 'bar', x: 1 }, { foo: 'baz', y: 2 }) // => { foo: 'baz', x: 1, y: 2 }\n * @dataFirst\n * @category Object\n */\nexport function mergeDeep<Destination extends object, Source extends object>(\n destination: Destination,\n source: Source,\n): MergeDeep<Destination, Source>;\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(source)(destination)\n * @example\n * pipe(\n * { foo: 'bar', x: 1 },\n * mergeDeep({ foo: 'baz', y: 2 }),\n * ); // => { foo: 'baz', x: 1, y: 2 }\n * @dataLast\n * @category Object\n */\nexport function mergeDeep<Source extends object>(\n source: Source,\n): <Destination extends object>(\n target: Destination,\n) => MergeDeep<Destination, Source>;\n\nexport function mergeDeep(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeDeepImplementation, args);\n}\n\nfunction mergeDeepImplementation<\n Destination extends object,\n Source extends object,\n>(destination: Destination, source: Source): MergeDeep<Destination, Source> {\n // At this point the output is already merged, simply not deeply merged.\n const output = { ...destination, ...source } as Record<\n keyof Destination | keyof Source,\n unknown\n >;\n\n // now just scan the output and look for values that should have been deep-merged\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (!(key in destination)) {\n // They don't share this key.\n continue;\n }\n\n const { [key]: destinationValue } = destination;\n if (!isPlainObject(destinationValue)) {\n // The value in destination is not a mergeable object so the value from\n // source (which was already copied in the shallow merge) would be used\n // as-is.\n continue;\n }\n\n const { [key]: sourceValue } = source;\n if (!isPlainObject(sourceValue)) {\n // The value in source is not a mergeable object either, so it will\n // override the object in destination.\n continue;\n }\n\n // Both destination and source have a mergeable object for this key, so we\n // recursively merge them.\n // @ts-expect-error [ts2590] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n output[key] = mergeDeepImplementation(destinationValue, sourceValue);\n }\n\n // @ts-expect-error [ts2322] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n return output;\n}\n"],"mappings":"wFA2CA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAO,EAAM,EAAyB,
|
|
1
|
+
{"version":3,"file":"merge-deep.js","names":[],"sources":["../src/merge-deep.ts"],"sourcesContent":["import type { MergeDeep } from 'type-fest';\nimport { curry } from './curry';\nimport { isPlainObject } from './is-plain-object';\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param destination - The object to merge into. In general, this object would have it's values overridden.\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(destination, source)\n * @example\n * mergeDeep({ foo: 'bar', x: 1 }, { foo: 'baz', y: 2 }) // => { foo: 'baz', x: 1, y: 2 }\n * @dataFirst\n * @category Object\n */\nexport function mergeDeep<Destination extends object, Source extends object>(\n destination: Destination,\n source: Source,\n): MergeDeep<Destination, Source>;\n\n/**\n * Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).\n *\n * @param source - The object to merge from. In general, shared keys would be taken from this object.\n * @returns The merged object.\n * @signature\n * mergeDeep(source)(destination)\n * @example\n * pipe(\n * { foo: 'bar', x: 1 },\n * mergeDeep({ foo: 'baz', y: 2 }),\n * ); // => { foo: 'baz', x: 1, y: 2 }\n * @dataLast\n * @category Object\n */\nexport function mergeDeep<Source extends object>(\n source: Source,\n): <Destination extends object>(\n target: Destination,\n) => MergeDeep<Destination, Source>;\n\nexport function mergeDeep(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeDeepImplementation, args);\n}\n\nfunction mergeDeepImplementation<\n Destination extends object,\n Source extends object,\n>(destination: Destination, source: Source): MergeDeep<Destination, Source> {\n // At this point the output is already merged, simply not deeply merged.\n const output = { ...destination, ...source } as Record<\n keyof Destination | keyof Source,\n unknown\n >;\n\n // now just scan the output and look for values that should have been deep-merged\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (!(key in destination)) {\n // They don't share this key.\n continue;\n }\n\n const { [key]: destinationValue } = destination;\n if (!isPlainObject(destinationValue)) {\n // The value in destination is not a mergeable object so the value from\n // source (which was already copied in the shallow merge) would be used\n // as-is.\n continue;\n }\n\n const { [key]: sourceValue } = source;\n if (!isPlainObject(sourceValue)) {\n // The value in source is not a mergeable object either, so it will\n // override the object in destination.\n continue;\n }\n\n // Both destination and source have a mergeable object for this key, so we\n // recursively merge them.\n // @ts-expect-error [ts2590] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n output[key] = mergeDeepImplementation(destinationValue, sourceValue);\n }\n\n // @ts-expect-error [ts2322] - We build the output object iteratively, I don't think it's possible to improve the types here so that typescript infers this correctly.\n return output;\n}\n"],"mappings":"wFA2CA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAO,EAAM,EAAyB,CAAI,CAC5C,CAEA,SAAS,EAGP,EAA0B,EAAgD,CAE1E,IAAM,EAAS,CAAE,GAAG,EAAa,GAAG,CAAO,EAO3C,IAAK,IAAM,KAAO,EAAQ,CACxB,GAAI,EAAE,KAAO,GAEX,SAGF,GAAM,EAAG,GAAM,GAAqB,EACpC,GAAI,CAAC,EAAc,CAAgB,EAIjC,SAGF,GAAM,EAAG,GAAM,GAAgB,EAC1B,EAAc,CAAW,IAS9B,EAAO,GAAO,EAAwB,EAAkB,CAAW,EACrE,CAGA,OAAO,CACT"}
|
package/dist/merge.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e,t){return{...e,...t}}exports.merge=t;
|
|
2
2
|
//# sourceMappingURL=merge.cjs.map
|
package/dist/merge.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.cjs","names":["curry"],"sources":["../src/merge.ts"],"sourcesContent":["import type { Merge } from 'type-fest';\nimport { curry } from './curry';\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param data - The destination object, serving as the basis for the merge.\n * Properties from this object are included in the new object, but will be\n * overwritten by properties from the source object with matching keys.\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(data, source)\n * @example\n * merge({ x: 1, y: 2 }, { y: 10, z: 2 }) // => { x: 1, y: 10, z: 2 }\n * @dataFirst\n * @category Object\n */\nexport function merge<T, Source>(data: T, source: Source): Merge<T, Source>;\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(source)(data)\n * @example\n * pipe(\n * { x: 1, y: 2 },\n * merge({ y: 10, z: 2 }),\n * ); // => { x: 1, y: 10, z: 2 }\n * @dataLast\n * @category Object\n */\nexport function merge<Source>(source: Source): <T>(data: T) => Merge<T, Source>;\n\nexport function merge(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeImplementation, args);\n}\n\nfunction mergeImplementation<T, Source>(data: T, source: Source): Merge<T, Source> {\n return { ...data, ...source };\n}\n"],"mappings":"kGAuDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAM,EAAqB,
|
|
1
|
+
{"version":3,"file":"merge.cjs","names":["curry"],"sources":["../src/merge.ts"],"sourcesContent":["import type { Merge } from 'type-fest';\nimport { curry } from './curry';\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param data - The destination object, serving as the basis for the merge.\n * Properties from this object are included in the new object, but will be\n * overwritten by properties from the source object with matching keys.\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(data, source)\n * @example\n * merge({ x: 1, y: 2 }, { y: 10, z: 2 }) // => { x: 1, y: 10, z: 2 }\n * @dataFirst\n * @category Object\n */\nexport function merge<T, Source>(data: T, source: Source): Merge<T, Source>;\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(source)(data)\n * @example\n * pipe(\n * { x: 1, y: 2 },\n * merge({ y: 10, z: 2 }),\n * ); // => { x: 1, y: 10, z: 2 }\n * @dataLast\n * @category Object\n */\nexport function merge<Source>(source: Source): <T>(data: T) => Merge<T, Source>;\n\nexport function merge(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeImplementation, args);\n}\n\nfunction mergeImplementation<T, Source>(data: T, source: Source): Merge<T, Source> {\n return { ...data, ...source };\n}\n"],"mappings":"kGAuDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EAA+B,EAAS,EAAkC,CACjF,MAAO,CAAE,GAAG,EAAM,GAAG,CAAO,CAC9B"}
|
package/dist/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","names":[],"sources":["../src/merge.ts"],"sourcesContent":["import type { Merge } from 'type-fest';\nimport { curry } from './curry';\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param data - The destination object, serving as the basis for the merge.\n * Properties from this object are included in the new object, but will be\n * overwritten by properties from the source object with matching keys.\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(data, source)\n * @example\n * merge({ x: 1, y: 2 }, { y: 10, z: 2 }) // => { x: 1, y: 10, z: 2 }\n * @dataFirst\n * @category Object\n */\nexport function merge<T, Source>(data: T, source: Source): Merge<T, Source>;\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(source)(data)\n * @example\n * pipe(\n * { x: 1, y: 2 },\n * merge({ y: 10, z: 2 }),\n * ); // => { x: 1, y: 10, z: 2 }\n * @dataLast\n * @category Object\n */\nexport function merge<Source>(source: Source): <T>(data: T) => Merge<T, Source>;\n\nexport function merge(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeImplementation, args);\n}\n\nfunction mergeImplementation<T, Source>(data: T, source: Source): Merge<T, Source> {\n return { ...data, ...source };\n}\n"],"mappings":"mCAuDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAqB,
|
|
1
|
+
{"version":3,"file":"merge.js","names":[],"sources":["../src/merge.ts"],"sourcesContent":["import type { Merge } from 'type-fest';\nimport { curry } from './curry';\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param data - The destination object, serving as the basis for the merge.\n * Properties from this object are included in the new object, but will be\n * overwritten by properties from the source object with matching keys.\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(data, source)\n * @example\n * merge({ x: 1, y: 2 }, { y: 10, z: 2 }) // => { x: 1, y: 10, z: 2 }\n * @dataFirst\n * @category Object\n */\nexport function merge<T, Source>(data: T, source: Source): Merge<T, Source>;\n\n/**\n * Merges two objects into one by combining their properties, effectively\n * creating a new object that incorporates elements from both. The merge\n * operation prioritizes the second object's properties, allowing them to\n * overwrite those from the first object with the same names.\n *\n * Equivalent to `{ ...data, ...source }`.\n *\n * @param source - The source object, whose properties will be included in the\n * new object. If properties in this object share keys with properties in the\n * destination object, the values from the source object will be used in the\n * new object.\n * @returns An object fully containing `source`, and any properties from `data`\n * that don't share a name with any property in `source`.\n * @signature\n * merge(source)(data)\n * @example\n * pipe(\n * { x: 1, y: 2 },\n * merge({ y: 10, z: 2 }),\n * ); // => { x: 1, y: 10, z: 2 }\n * @dataLast\n * @category Object\n */\nexport function merge<Source>(source: Source): <T>(data: T) => Merge<T, Source>;\n\nexport function merge(...args: ReadonlyArray<unknown>): unknown {\n return curry(mergeImplementation, args);\n}\n\nfunction mergeImplementation<T, Source>(data: T, source: Source): Merge<T, Source> {\n return { ...data, ...source };\n}\n"],"mappings":"mCAuDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EAA+B,EAAS,EAAkC,CACjF,MAAO,CAAE,GAAG,EAAM,GAAG,CAAO,CAC9B"}
|
package/dist/multiply.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e,t){return e*t}exports.multiply=t;
|
|
2
2
|
//# sourceMappingURL=multiply.cjs.map
|
package/dist/multiply.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiply.cjs","names":["curry"],"sources":["../src/multiply.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Multiplies two numbers.\n *\n * @param value - The number.\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(value, multiplicand);\n * @example\n * multiply(3, 4) // => 12\n * reduce([1, 2, 3, 4], multiply, 1) // => 24\n * @dataFirst\n * @category Number\n */\nexport function multiply(value: bigint, multiplicand: bigint): bigint;\nexport function multiply(value: number, multiplicand: number): number;\n\n/**\n * Multiplies two numbers.\n *\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(multiplicand)(value);\n * @example\n * multiply(4)(3) // => 12\n * map([1, 2, 3, 4], multiply(2)) // => [2, 4, 6, 8]\n * @dataLast\n * @category Number\n */\nexport function multiply(multiplicand: bigint): (value: bigint) => bigint;\nexport function multiply(multiplicand: number): (value: number) => number;\n\nexport function multiply(...args: ReadonlyArray<unknown>): unknown {\n return curry(multiplyImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and multiplicand would be of the same\n// type.\nfunction multiplyImplementation(value: number, multiplicand: number): number {\n return value * multiplicand;\n}\n"],"mappings":"kGAiCA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAOA,EAAAA,MAAM,EAAwB,
|
|
1
|
+
{"version":3,"file":"multiply.cjs","names":["curry"],"sources":["../src/multiply.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Multiplies two numbers.\n *\n * @param value - The number.\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(value, multiplicand);\n * @example\n * multiply(3, 4) // => 12\n * reduce([1, 2, 3, 4], multiply, 1) // => 24\n * @dataFirst\n * @category Number\n */\nexport function multiply(value: bigint, multiplicand: bigint): bigint;\nexport function multiply(value: number, multiplicand: number): number;\n\n/**\n * Multiplies two numbers.\n *\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(multiplicand)(value);\n * @example\n * multiply(4)(3) // => 12\n * map([1, 2, 3, 4], multiply(2)) // => [2, 4, 6, 8]\n * @dataLast\n * @category Number\n */\nexport function multiply(multiplicand: bigint): (value: bigint) => bigint;\nexport function multiply(multiplicand: number): (value: number) => number;\n\nexport function multiply(...args: ReadonlyArray<unknown>): unknown {\n return curry(multiplyImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and multiplicand would be of the same\n// type.\nfunction multiplyImplementation(value: number, multiplicand: number): number {\n return value * multiplicand;\n}\n"],"mappings":"kGAiCA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAOA,EAAAA,MAAM,EAAwB,CAAI,CAC3C,CAKA,SAAS,EAAuB,EAAe,EAA8B,CAC3E,OAAO,EAAQ,CACjB"}
|
package/dist/multiply.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiply.js","names":[],"sources":["../src/multiply.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Multiplies two numbers.\n *\n * @param value - The number.\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(value, multiplicand);\n * @example\n * multiply(3, 4) // => 12\n * reduce([1, 2, 3, 4], multiply, 1) // => 24\n * @dataFirst\n * @category Number\n */\nexport function multiply(value: bigint, multiplicand: bigint): bigint;\nexport function multiply(value: number, multiplicand: number): number;\n\n/**\n * Multiplies two numbers.\n *\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(multiplicand)(value);\n * @example\n * multiply(4)(3) // => 12\n * map([1, 2, 3, 4], multiply(2)) // => [2, 4, 6, 8]\n * @dataLast\n * @category Number\n */\nexport function multiply(multiplicand: bigint): (value: bigint) => bigint;\nexport function multiply(multiplicand: number): (value: number) => number;\n\nexport function multiply(...args: ReadonlyArray<unknown>): unknown {\n return curry(multiplyImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and multiplicand would be of the same\n// type.\nfunction multiplyImplementation(value: number, multiplicand: number): number {\n return value * multiplicand;\n}\n"],"mappings":"mCAiCA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAO,EAAM,EAAwB,
|
|
1
|
+
{"version":3,"file":"multiply.js","names":[],"sources":["../src/multiply.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Multiplies two numbers.\n *\n * @param value - The number.\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(value, multiplicand);\n * @example\n * multiply(3, 4) // => 12\n * reduce([1, 2, 3, 4], multiply, 1) // => 24\n * @dataFirst\n * @category Number\n */\nexport function multiply(value: bigint, multiplicand: bigint): bigint;\nexport function multiply(value: number, multiplicand: number): number;\n\n/**\n * Multiplies two numbers.\n *\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * multiply(multiplicand)(value);\n * @example\n * multiply(4)(3) // => 12\n * map([1, 2, 3, 4], multiply(2)) // => [2, 4, 6, 8]\n * @dataLast\n * @category Number\n */\nexport function multiply(multiplicand: bigint): (value: bigint) => bigint;\nexport function multiply(multiplicand: number): (value: number) => number;\n\nexport function multiply(...args: ReadonlyArray<unknown>): unknown {\n return curry(multiplyImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and multiplicand would be of the same\n// type.\nfunction multiplyImplementation(value: number, multiplicand: number): number {\n return value * multiplicand;\n}\n"],"mappings":"mCAiCA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAO,EAAM,EAAwB,CAAI,CAC3C,CAKA,SAAS,EAAuB,EAAe,EAA8B,CAC3E,OAAO,EAAQ,CACjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(
|
|
2
|
-
//# sourceMappingURL=nth-by-
|
|
1
|
+
const e=require("./curry-order-rules-CacOTzfW.cjs"),t=require("./swap-in-place-CllcD0HG.cjs");function n(e,t,n){return t<0||t>=e.length?void 0:r([...e],0,e.length-1,t,n)}function r(e,t,n,a,o){if(t===n)return e[t];let s=i(e,t,n,o);return a===s?e[a]:r(e,a<s?t:s+1,a<s?s-1:n,a,o)}function i(e,n,r,i){let a=e[r],o=n;for(let s=n;s<r;s++)i(e[s],a)<0&&(t.t(e,o,s),o+=1);return t.t(e,o,r),o}function a(...t){return e.n(o,t)}function o(e,t,r){return n(e,r>=0?r:e.length+r,t)}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
2
|
+
//# sourceMappingURL=nth-by-BrkoqeV2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nth-by-
|
|
1
|
+
{"version":3,"file":"nth-by-BrkoqeV2.cjs","names":["curryOrderRulesWithArgument"],"sources":["../src/internal/quick-select.ts","../src/nth-by.ts"],"sourcesContent":["/**\n * A simple implementation of the *QuickSelect* algorithm.\n *\n * @see https://en.wikipedia.org/wiki/Quickselect\n */\n\nimport type { CompareFunction } from './types/compare-function';\nimport { swapInPlace } from './swap-in-place';\n\n/**\n * Perform QuickSelect on the given data. Notice that the data would be cloned\n * shallowly so that it could be mutated in-place, and then discarded once the\n * algorithm is done. This means that running this function multiple times on\n * the same array might be slower then sorting the array before.\n *\n * @param data - The data to perform the selection on.\n * @param index - The index of the item we are looking for.\n * @param compareFn - The compare function to use for sorting.\n * @returns The item at the given index, or `undefined` if the index is out-of-\n * bounds.\n */\nexport function quickSelect<T>(data: ReadonlyArray<T>, index: number, compareFn: CompareFunction<T>): T | undefined {\n return index < 0 || index >= data.length\n ? // Quickselect doesn't work with out-of-bound indices\n undefined\n : quickSelectImplementation(\n // We need to clone the array because quickSelect mutates it in-place.\n [...data],\n 0 /* left */,\n data.length - 1 /* right */,\n index,\n compareFn,\n );\n}\n\n/**\n * The actual implementation, called recursively.\n */\nfunction quickSelectImplementation<T>(\n data: Array<T>,\n left: number,\n right: number,\n index: number,\n compareFn: CompareFunction<T>,\n): T {\n if (left === right) {\n return data[left]!;\n }\n\n const pivotIndex = partition(data, left, right, compareFn);\n\n return index === pivotIndex\n ? // Once a pivot is chosen it's location is final, so if it matches the\n // index we found out item!\n data[index]!\n : quickSelectImplementation(\n data,\n // We continue by recursing into the partition where index would be\n index < pivotIndex ? left : pivotIndex + 1,\n index < pivotIndex ? pivotIndex - 1 : right,\n index,\n compareFn,\n );\n}\n\nfunction partition<T>(\n data: Array<T>,\n left: number,\n right: number,\n compareFn: CompareFunction<T>,\n): number {\n const pivot = data[right]!;\n\n let i = left;\n for (let j = left; j < right; j++) {\n if (compareFn(data[j]!, pivot) < 0) {\n // Move items smaller then the pivot to the start of the array.\n swapInPlace(data, i, j);\n i += 1;\n }\n }\n\n swapInPlace(data, i, right);\n\n // The location of the pivot by the end of the partition function.\n return i;\n}\n","import type { OrderRule } from './internal/curry-order-rules';\nimport type { CompareFunction } from './internal/types/compare-function';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { NonEmptyArray } from './internal/types/non-empty-array';\nimport {\n curryOrderRulesWithArgument,\n\n} from './internal/curry-order-rules';\nimport { quickSelect } from './internal/quick-select';\n\n/**\n * Retrieves the element that would be at the given index if the array were sorted according to specified rules. This function uses the *QuickSelect* algorithm running at an average complexity of *O(n)*. Semantically it is equivalent to `sortBy(data, ...rules).at(index)` which would run at *O(nlogn)*.\n *\n * See also `firstBy` which provides an even more efficient algorithm and a stricter return type, but only for `index === 0`. See `takeFirstBy` to get all the elements up to and including `index`.\n *\n * @param data - The input array.\n * @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.\n * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, \"desc\"]` for descending order.\n * @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.\n * @signature\n * nthBy(data, index, ...rules);\n * @example\n * nthBy([2,1,4,5,3,], 2, identity()); // => 3\n * @dataFirst\n * @category Array\n */\nexport function nthBy<T extends IterableContainer>(\n data: T,\n index: number,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): T[number] | undefined;\n\n/**\n * Retrieves the element that would be at the given index if the array were sorted according to specified rules. This function uses the *QuickSelect* algorithm running at an average complexity of *O(n)*. Semantically it is equivalent to `sortBy(data, ...rules)[index]` which would run at *O(nlogn)*.\n *\n * See also `firstBy` which provides an even more efficient algorithm and a stricter return type, but only for `index === 0`. See `takeFirstBy` to get all the elements up to and including `index`.\n *\n * @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.\n * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, \"desc\"]` for descending order.\n * @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.\n * @signature\n * nthBy(index, ...rules)(data);\n * @example\n * pipe([2,1,4,5,3,], nthBy(2, identity())); // => 3\n * @dataLast\n * @category Array\n */\nexport function nthBy<T extends IterableContainer>(\n index: number,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): (data: T) => T[number] | undefined;\n\nexport function nthBy(...args: ReadonlyArray<unknown>): unknown {\n return curryOrderRulesWithArgument(nthByImplementation, args);\n}\n\nfunction nthByImplementation<T>(data: ReadonlyArray<T>, compareFn: CompareFunction<T>, index: number): T | undefined {\n return quickSelect(\n data,\n // Allow negative indices gracefully\n index >= 0 ? index : data.length + index,\n compareFn,\n );\n}\n"],"mappings":"8FAqBA,SAAgB,EAAe,EAAwB,EAAe,EAA8C,CAClH,OAAO,EAAQ,GAAK,GAAS,EAAK,OAEhC,IAAA,GACE,EAEE,CAAC,GAAG,CAAI,EACR,EACA,EAAK,OAAS,EACd,EACA,CACF,CACN,CAKA,SAAS,EACP,EACA,EACA,EACA,EACA,EACG,CACH,GAAI,IAAS,EACX,OAAO,EAAK,GAGd,IAAM,EAAa,EAAU,EAAM,EAAM,EAAO,CAAS,EAEzD,OAAO,IAAU,EAGf,EAAK,GACH,EACE,EAEA,EAAQ,EAAa,EAAO,EAAa,EACzC,EAAQ,EAAa,EAAa,EAAI,EACtC,EACA,CACF,CACN,CAEA,SAAS,EACP,EACA,EACA,EACA,EACQ,CACR,IAAM,EAAQ,EAAK,GAEf,EAAI,EACR,IAAK,IAAI,EAAI,EAAM,EAAI,EAAO,IACxB,EAAU,EAAK,GAAK,CAAK,EAAI,IAE/B,EAAA,EAAY,EAAM,EAAG,CAAC,EACtB,GAAK,GAOT,OAHA,EAAA,EAAY,EAAM,EAAG,CAAK,EAGnB,CACT,CClCA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,EAA4B,EAAqB,CAAI,CAC9D,CAEA,SAAS,EAAuB,EAAwB,EAA+B,EAA8B,CACnH,OAAO,EACL,EAEA,GAAS,EAAI,EAAQ,EAAK,OAAS,EACnC,CACF,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./curry-order-rules-
|
|
2
|
-
//# sourceMappingURL=nth-by-
|
|
1
|
+
import{n as e}from"./curry-order-rules-Dage-BeC.js";import{t}from"./swap-in-place-ubtnp8en.js";function n(e,t,n){return t<0||t>=e.length?void 0:r([...e],0,e.length-1,t,n)}function r(e,t,n,a,o){if(t===n)return e[t];let s=i(e,t,n,o);return a===s?e[a]:r(e,a<s?t:s+1,a<s?s-1:n,a,o)}function i(e,n,r,i){let a=e[r],o=n;for(let s=n;s<r;s++)i(e[s],a)<0&&(t(e,o,s),o+=1);return t(e,o,r),o}function a(...t){return e(o,t)}function o(e,t,r){return n(e,r>=0?r:e.length+r,t)}export{a as t};
|
|
2
|
+
//# sourceMappingURL=nth-by-DGcGGvJX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nth-by-
|
|
1
|
+
{"version":3,"file":"nth-by-DGcGGvJX.js","names":[],"sources":["../src/internal/quick-select.ts","../src/nth-by.ts"],"sourcesContent":["/**\n * A simple implementation of the *QuickSelect* algorithm.\n *\n * @see https://en.wikipedia.org/wiki/Quickselect\n */\n\nimport type { CompareFunction } from './types/compare-function';\nimport { swapInPlace } from './swap-in-place';\n\n/**\n * Perform QuickSelect on the given data. Notice that the data would be cloned\n * shallowly so that it could be mutated in-place, and then discarded once the\n * algorithm is done. This means that running this function multiple times on\n * the same array might be slower then sorting the array before.\n *\n * @param data - The data to perform the selection on.\n * @param index - The index of the item we are looking for.\n * @param compareFn - The compare function to use for sorting.\n * @returns The item at the given index, or `undefined` if the index is out-of-\n * bounds.\n */\nexport function quickSelect<T>(data: ReadonlyArray<T>, index: number, compareFn: CompareFunction<T>): T | undefined {\n return index < 0 || index >= data.length\n ? // Quickselect doesn't work with out-of-bound indices\n undefined\n : quickSelectImplementation(\n // We need to clone the array because quickSelect mutates it in-place.\n [...data],\n 0 /* left */,\n data.length - 1 /* right */,\n index,\n compareFn,\n );\n}\n\n/**\n * The actual implementation, called recursively.\n */\nfunction quickSelectImplementation<T>(\n data: Array<T>,\n left: number,\n right: number,\n index: number,\n compareFn: CompareFunction<T>,\n): T {\n if (left === right) {\n return data[left]!;\n }\n\n const pivotIndex = partition(data, left, right, compareFn);\n\n return index === pivotIndex\n ? // Once a pivot is chosen it's location is final, so if it matches the\n // index we found out item!\n data[index]!\n : quickSelectImplementation(\n data,\n // We continue by recursing into the partition where index would be\n index < pivotIndex ? left : pivotIndex + 1,\n index < pivotIndex ? pivotIndex - 1 : right,\n index,\n compareFn,\n );\n}\n\nfunction partition<T>(\n data: Array<T>,\n left: number,\n right: number,\n compareFn: CompareFunction<T>,\n): number {\n const pivot = data[right]!;\n\n let i = left;\n for (let j = left; j < right; j++) {\n if (compareFn(data[j]!, pivot) < 0) {\n // Move items smaller then the pivot to the start of the array.\n swapInPlace(data, i, j);\n i += 1;\n }\n }\n\n swapInPlace(data, i, right);\n\n // The location of the pivot by the end of the partition function.\n return i;\n}\n","import type { OrderRule } from './internal/curry-order-rules';\nimport type { CompareFunction } from './internal/types/compare-function';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { NonEmptyArray } from './internal/types/non-empty-array';\nimport {\n curryOrderRulesWithArgument,\n\n} from './internal/curry-order-rules';\nimport { quickSelect } from './internal/quick-select';\n\n/**\n * Retrieves the element that would be at the given index if the array were sorted according to specified rules. This function uses the *QuickSelect* algorithm running at an average complexity of *O(n)*. Semantically it is equivalent to `sortBy(data, ...rules).at(index)` which would run at *O(nlogn)*.\n *\n * See also `firstBy` which provides an even more efficient algorithm and a stricter return type, but only for `index === 0`. See `takeFirstBy` to get all the elements up to and including `index`.\n *\n * @param data - The input array.\n * @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.\n * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, \"desc\"]` for descending order.\n * @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.\n * @signature\n * nthBy(data, index, ...rules);\n * @example\n * nthBy([2,1,4,5,3,], 2, identity()); // => 3\n * @dataFirst\n * @category Array\n */\nexport function nthBy<T extends IterableContainer>(\n data: T,\n index: number,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): T[number] | undefined;\n\n/**\n * Retrieves the element that would be at the given index if the array were sorted according to specified rules. This function uses the *QuickSelect* algorithm running at an average complexity of *O(n)*. Semantically it is equivalent to `sortBy(data, ...rules)[index]` which would run at *O(nlogn)*.\n *\n * See also `firstBy` which provides an even more efficient algorithm and a stricter return type, but only for `index === 0`. See `takeFirstBy` to get all the elements up to and including `index`.\n *\n * @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.\n * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, \"desc\"]` for descending order.\n * @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.\n * @signature\n * nthBy(index, ...rules)(data);\n * @example\n * pipe([2,1,4,5,3,], nthBy(2, identity())); // => 3\n * @dataLast\n * @category Array\n */\nexport function nthBy<T extends IterableContainer>(\n index: number,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): (data: T) => T[number] | undefined;\n\nexport function nthBy(...args: ReadonlyArray<unknown>): unknown {\n return curryOrderRulesWithArgument(nthByImplementation, args);\n}\n\nfunction nthByImplementation<T>(data: ReadonlyArray<T>, compareFn: CompareFunction<T>, index: number): T | undefined {\n return quickSelect(\n data,\n // Allow negative indices gracefully\n index >= 0 ? index : data.length + index,\n compareFn,\n );\n}\n"],"mappings":"+FAqBA,SAAgB,EAAe,EAAwB,EAAe,EAA8C,CAClH,OAAO,EAAQ,GAAK,GAAS,EAAK,OAEhC,IAAA,GACE,EAEE,CAAC,GAAG,CAAI,EACR,EACA,EAAK,OAAS,EACd,EACA,CACF,CACN,CAKA,SAAS,EACP,EACA,EACA,EACA,EACA,EACG,CACH,GAAI,IAAS,EACX,OAAO,EAAK,GAGd,IAAM,EAAa,EAAU,EAAM,EAAM,EAAO,CAAS,EAEzD,OAAO,IAAU,EAGf,EAAK,GACH,EACE,EAEA,EAAQ,EAAa,EAAO,EAAa,EACzC,EAAQ,EAAa,EAAa,EAAI,EACtC,EACA,CACF,CACN,CAEA,SAAS,EACP,EACA,EACA,EACA,EACQ,CACR,IAAM,EAAQ,EAAK,GAEf,EAAI,EACR,IAAK,IAAI,EAAI,EAAM,EAAI,EAAO,IACxB,EAAU,EAAK,GAAK,CAAK,EAAI,IAE/B,EAAY,EAAM,EAAG,CAAC,EACtB,GAAK,GAOT,OAHA,EAAY,EAAM,EAAG,CAAK,EAGnB,CACT,CClCA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAA4B,EAAqB,CAAI,CAC9D,CAEA,SAAS,EAAuB,EAAwB,EAA+B,EAA8B,CACnH,OAAO,EACL,EAEA,GAAS,EAAI,EAAQ,EAAK,OAAS,EACnC,CACF,CACF"}
|
package/dist/nth-by.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./nth-by-BrkoqeV2.cjs");exports.nthBy=e.t;
|
package/dist/nth-by.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./nth-by-
|
|
1
|
+
import{t as e}from"./nth-by-DGcGGvJX.js";export{e as nthBy};
|
package/dist/obj-of.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e,t){return{[t]:e}}exports.objOf=t;
|
|
2
2
|
//# sourceMappingURL=obj-of.cjs.map
|
package/dist/obj-of.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obj-of.cjs","names":["curry"],"sources":["../src/obj-of.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param value - The object value.\n * @param key - The property name.\n * @signature\n * objOf(value, key)\n * @example\n * objOf(10, 'a') // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(value: T, key: K): Record<K, T>;\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param key - The property name.\n * @signature\n * objOf(key)(value)\n * @example\n * pipe(10, objOf('a')) // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(key: K): (value: T) => Record<K, T>;\n\nexport function objOf(...args: ReadonlyArray<unknown>): unknown {\n return curry(objOfImplementation, args);\n}\n\nfunction objOfImplementation<T, K extends string>(value: T, key: K): Record<K, T> {\n return { [key]: value };\n}\n"],"mappings":"kGA2BA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAM,EAAqB,
|
|
1
|
+
{"version":3,"file":"obj-of.cjs","names":["curry"],"sources":["../src/obj-of.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param value - The object value.\n * @param key - The property name.\n * @signature\n * objOf(value, key)\n * @example\n * objOf(10, 'a') // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(value: T, key: K): Record<K, T>;\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param key - The property name.\n * @signature\n * objOf(key)(value)\n * @example\n * pipe(10, objOf('a')) // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(key: K): (value: T) => Record<K, T>;\n\nexport function objOf(...args: ReadonlyArray<unknown>): unknown {\n return curry(objOfImplementation, args);\n}\n\nfunction objOfImplementation<T, K extends string>(value: T, key: K): Record<K, T> {\n return { [key]: value };\n}\n"],"mappings":"kGA2BA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EAAyC,EAAU,EAAsB,CAChF,MAAO,EAAG,GAAM,CAAM,CACxB"}
|
package/dist/obj-of.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obj-of.js","names":[],"sources":["../src/obj-of.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param value - The object value.\n * @param key - The property name.\n * @signature\n * objOf(value, key)\n * @example\n * objOf(10, 'a') // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(value: T, key: K): Record<K, T>;\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param key - The property name.\n * @signature\n * objOf(key)(value)\n * @example\n * pipe(10, objOf('a')) // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(key: K): (value: T) => Record<K, T>;\n\nexport function objOf(...args: ReadonlyArray<unknown>): unknown {\n return curry(objOfImplementation, args);\n}\n\nfunction objOfImplementation<T, K extends string>(value: T, key: K): Record<K, T> {\n return { [key]: value };\n}\n"],"mappings":"mCA2BA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAqB,
|
|
1
|
+
{"version":3,"file":"obj-of.js","names":[],"sources":["../src/obj-of.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param value - The object value.\n * @param key - The property name.\n * @signature\n * objOf(value, key)\n * @example\n * objOf(10, 'a') // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(value: T, key: K): Record<K, T>;\n\n/**\n * Creates an object containing a single `key:value` pair.\n *\n * @param key - The property name.\n * @signature\n * objOf(key)(value)\n * @example\n * pipe(10, objOf('a')) // => { a: 10 }\n * @category Object\n */\nexport function objOf<T, K extends string>(key: K): (value: T) => Record<K, T>;\n\nexport function objOf(...args: ReadonlyArray<unknown>): unknown {\n return curry(objOfImplementation, args);\n}\n\nfunction objOfImplementation<T, K extends string>(value: T, key: K): Record<K, T> {\n return { [key]: value };\n}\n"],"mappings":"mCA2BA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EAAyC,EAAU,EAAsB,CAChF,MAAO,EAAG,GAAM,CAAM,CACxB"}
|
package/dist/omit-by.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}exports.omitBy=t;
|
|
2
2
|
//# sourceMappingURL=omit-by.cjs.map
|
package/dist/omit-by.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit-by.cjs","names":["curry"],"sources":["../src/omit-by.ts"],"sourcesContent":["import type { IsNever,
|
|
1
|
+
{"version":3,"file":"omit-by.cjs","names":["curry"],"sources":["../src/omit-by.ts"],"sourcesContent":["import type { IsNever, Simplify } from 'type-fest';\nimport type { EnumerableStringKeyOf } from './internal/types/enumerable-string-key-of';\nimport type { EnumerableStringKeyedValueOf } from './internal/types/enumerable-string-keyed-value-of';\nimport type { IsBoundedRecord } from './internal/types/is-bounded-record';\nimport { curry } from './curry';\n\n// Symbols are not passed to the predicate (because they can't be enumerated\n// with the `Object.entries` function) and the output object is built from a\n// shallow copy of the input; meaning symbols would just be passed through as-\n// is.\ntype PickSymbolKeys<T extends object> = {\n -readonly [P in keyof T as P extends symbol ? P : never]: T[P];\n};\n\n// When we don't use a type-predicate we can't say anything about what props\n// would be omitted from the output, so we need to assume any of them could be\n// filtered out. This means that we effectively make all (enumerable) keys\n// optional.\ntype PartialEnumerableKeys<T extends object>\n // `extends unknown` is always going to be the case and is used to convert any\n // union into a [distributive conditional type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).\n = T extends unknown\n ? Simplify<\n IsBoundedRecord<T> extends true ? PickSymbolKeys<T> & {\n -readonly [P in keyof T as P extends symbol\n ? never\n : P]?: Required<T>[P];\n }\n : // This is the type you'd get from doing:\n // `Object.fromEntries(Object.entries(x))`.\n Record<EnumerableStringKeyOf<T>, EnumerableStringKeyedValueOf<T>>\n >\n : never;\n\n// When the predicate is a type-guard we have more information to work with when\n// constructing the type of the output object. We can safely remove any property\n// which value would always be true for the predicate, AND we can also\n// assume that properties that are rejected by the predicate perfectly would\n// **always** show up in the output object. Hence to build the output object we\n// need to build and merge 2 output objects: One for the properties which have a\n// value of at type that would always yield a `false` result from the predicate,\n// these are the \"matches\", which would not change the \"optionality\" of the\n// input object's props, and one for partial matches which would also make the\n// props optional (as they could have a value that would be filtered out).\ntype PartialEnumerableKeysNarrowed<T extends object, S> = Simplify<\n ExactProps<T, S> & PartialProps<T, S> & PickSymbolKeys<T>\n>;\n\n// The exact case, props here would always be part of the output object\ntype ExactProps<T, S> = {\n -readonly [P in keyof T as IsExactProp<T, P, S> extends true\n ? P\n : never]: Exclude<T[P], S>;\n};\n\n// The partial case, props here might be part of the output object, but might\n// not be, hence they are optional.\ntype PartialProps<T, S> = {\n -readonly [P in keyof T as IsPartialProp<T, P, S> extends true\n ? P\n : never]?: Exclude<T[P], S>;\n};\n\n// If the input object's value type extends itself when the type-guard is\n// excluded from it we can safely assume that the predicate would always return\n// `false` for any value of that property.\ntype IsExactProp<T, P extends keyof T, S> = P extends symbol\n ? // Symbols are passed through via the PickSymbolKeys type\n false\n : T[P] extends Exclude<T[P], S>\n ? S extends T[P]\n ? // If S extends the T[P] it means the type the predicate is narrowing to\n // can't narrow the rejected value any further, so we can't say what\n // would happen for a concrete value in runtime (e.g. if T[P] is\n // `number` and S is `1`: `Exclude<number, 1> === number`.\n false\n : true\n : false;\n\n// ...and if the input object's value type isn't an exact match, but still has\n// some partial match (i.g. the extracted type-guard isn't completely disjoint)\n// then we can assume that the property can sometimes return true, and sometimes\n// false when passed to the predicate, hence it should be optional in the\n// output.\ntype IsPartialProp<T, P extends keyof T, S> = P extends symbol\n ? // Symbols are passed through via the PickSymbolKeys type\n false\n : IsExactProp<T, P, S> extends true\n ? false\n : IsNever<Exclude<Required<T>[P], S>> extends true\n ? false\n : true;\n\n/**\n * Creates a shallow copy of the data, and then removes any keys that the\n * predicate rejects. Symbol keys are not passed to the predicate and would be\n * passed through to the output as-is.\n *\n * See `pickBy` for a complementary function which starts with an empty object\n * and adds the entries that the predicate accepts. Because it is additive,\n * symbol keys will not be passed through to the output object.\n *\n * @param data - The target object.\n * @param predicate - A function that takes the value, key, and the data itself\n * and returns `true` if the entry shouldn't be part of the output object, or\n * `false` to keep it. If the function is a type-guard on the value the output\n * type would be narrowed accordingly.\n * @returns A shallow copy of the input object with the rejected entries\n * removed.\n * @signature omitBy(data, predicate)\n * @example\n * omitBy({a: 1, b: 2, A: 3, B: 4}, (val, key) => key.toUpperCase() === key) // => {a: 1, b: 2}\n * @dataFirst\n * @category Object\n */\nexport function omitBy<\n T extends object,\n S extends EnumerableStringKeyedValueOf<T>,\n>(\n data: T,\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => value is S,\n): PartialEnumerableKeysNarrowed<T, S>;\nexport function omitBy<T extends object>(\n data: T,\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => boolean,\n): PartialEnumerableKeys<T>;\n\n/**\n * Returns a partial copy of an object omitting the keys matching predicate.\n *\n * @param predicate - The predicate.\n * @signature omitBy(fn)(object)\n * @example\n * omitBy((val, key) => key.toUpperCase() === key)({a: 1, b: 2, A: 3, B: 4}) // => {a: 1, b: 2}\n * @dataLast\n * @category Object\n */\nexport function omitBy<\n T extends object,\n S extends EnumerableStringKeyedValueOf<T>,\n>(\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => value is S,\n): (data: T) => PartialEnumerableKeysNarrowed<T, S>;\nexport function omitBy<T extends object>(\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => boolean,\n): (data: T) => PartialEnumerableKeys<T>;\n\nexport function omitBy(...args: ReadonlyArray<unknown>): unknown {\n return curry(omitByImplementation, args);\n}\n\nfunction omitByImplementation<T extends object>(\n data: T,\n predicate: (value: unknown, key: string, data: T) => boolean,\n): Record<string, unknown> {\n const out: Partial<Record<string, unknown>> = { ...data };\n\n for (const [key, value] of Object.entries(out)) {\n if (predicate(value, key, data)) {\n // eslint-disable-next-line ts/no-dynamic-delete -- This is the best way to do it!\n delete out[key];\n }\n }\n\n return out;\n}\n"],"mappings":"kGAmKA,SAAgB,EAAO,GAAG,EAAuC,CAC/D,OAAOA,EAAAA,MAAM,EAAsB,CAAI,CACzC,CAEA,SAAS,EACP,EACA,EACyB,CACzB,IAAM,EAAwC,CAAE,GAAG,CAAK,EAExD,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAG,EACvC,EAAU,EAAO,EAAK,CAAI,GAE5B,OAAO,EAAI,GAIf,OAAO,CACT"}
|
package/dist/omit-by.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit-by.js","names":[],"sources":["../src/omit-by.ts"],"sourcesContent":["import type { IsNever,
|
|
1
|
+
{"version":3,"file":"omit-by.js","names":[],"sources":["../src/omit-by.ts"],"sourcesContent":["import type { IsNever, Simplify } from 'type-fest';\nimport type { EnumerableStringKeyOf } from './internal/types/enumerable-string-key-of';\nimport type { EnumerableStringKeyedValueOf } from './internal/types/enumerable-string-keyed-value-of';\nimport type { IsBoundedRecord } from './internal/types/is-bounded-record';\nimport { curry } from './curry';\n\n// Symbols are not passed to the predicate (because they can't be enumerated\n// with the `Object.entries` function) and the output object is built from a\n// shallow copy of the input; meaning symbols would just be passed through as-\n// is.\ntype PickSymbolKeys<T extends object> = {\n -readonly [P in keyof T as P extends symbol ? P : never]: T[P];\n};\n\n// When we don't use a type-predicate we can't say anything about what props\n// would be omitted from the output, so we need to assume any of them could be\n// filtered out. This means that we effectively make all (enumerable) keys\n// optional.\ntype PartialEnumerableKeys<T extends object>\n // `extends unknown` is always going to be the case and is used to convert any\n // union into a [distributive conditional type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).\n = T extends unknown\n ? Simplify<\n IsBoundedRecord<T> extends true ? PickSymbolKeys<T> & {\n -readonly [P in keyof T as P extends symbol\n ? never\n : P]?: Required<T>[P];\n }\n : // This is the type you'd get from doing:\n // `Object.fromEntries(Object.entries(x))`.\n Record<EnumerableStringKeyOf<T>, EnumerableStringKeyedValueOf<T>>\n >\n : never;\n\n// When the predicate is a type-guard we have more information to work with when\n// constructing the type of the output object. We can safely remove any property\n// which value would always be true for the predicate, AND we can also\n// assume that properties that are rejected by the predicate perfectly would\n// **always** show up in the output object. Hence to build the output object we\n// need to build and merge 2 output objects: One for the properties which have a\n// value of at type that would always yield a `false` result from the predicate,\n// these are the \"matches\", which would not change the \"optionality\" of the\n// input object's props, and one for partial matches which would also make the\n// props optional (as they could have a value that would be filtered out).\ntype PartialEnumerableKeysNarrowed<T extends object, S> = Simplify<\n ExactProps<T, S> & PartialProps<T, S> & PickSymbolKeys<T>\n>;\n\n// The exact case, props here would always be part of the output object\ntype ExactProps<T, S> = {\n -readonly [P in keyof T as IsExactProp<T, P, S> extends true\n ? P\n : never]: Exclude<T[P], S>;\n};\n\n// The partial case, props here might be part of the output object, but might\n// not be, hence they are optional.\ntype PartialProps<T, S> = {\n -readonly [P in keyof T as IsPartialProp<T, P, S> extends true\n ? P\n : never]?: Exclude<T[P], S>;\n};\n\n// If the input object's value type extends itself when the type-guard is\n// excluded from it we can safely assume that the predicate would always return\n// `false` for any value of that property.\ntype IsExactProp<T, P extends keyof T, S> = P extends symbol\n ? // Symbols are passed through via the PickSymbolKeys type\n false\n : T[P] extends Exclude<T[P], S>\n ? S extends T[P]\n ? // If S extends the T[P] it means the type the predicate is narrowing to\n // can't narrow the rejected value any further, so we can't say what\n // would happen for a concrete value in runtime (e.g. if T[P] is\n // `number` and S is `1`: `Exclude<number, 1> === number`.\n false\n : true\n : false;\n\n// ...and if the input object's value type isn't an exact match, but still has\n// some partial match (i.g. the extracted type-guard isn't completely disjoint)\n// then we can assume that the property can sometimes return true, and sometimes\n// false when passed to the predicate, hence it should be optional in the\n// output.\ntype IsPartialProp<T, P extends keyof T, S> = P extends symbol\n ? // Symbols are passed through via the PickSymbolKeys type\n false\n : IsExactProp<T, P, S> extends true\n ? false\n : IsNever<Exclude<Required<T>[P], S>> extends true\n ? false\n : true;\n\n/**\n * Creates a shallow copy of the data, and then removes any keys that the\n * predicate rejects. Symbol keys are not passed to the predicate and would be\n * passed through to the output as-is.\n *\n * See `pickBy` for a complementary function which starts with an empty object\n * and adds the entries that the predicate accepts. Because it is additive,\n * symbol keys will not be passed through to the output object.\n *\n * @param data - The target object.\n * @param predicate - A function that takes the value, key, and the data itself\n * and returns `true` if the entry shouldn't be part of the output object, or\n * `false` to keep it. If the function is a type-guard on the value the output\n * type would be narrowed accordingly.\n * @returns A shallow copy of the input object with the rejected entries\n * removed.\n * @signature omitBy(data, predicate)\n * @example\n * omitBy({a: 1, b: 2, A: 3, B: 4}, (val, key) => key.toUpperCase() === key) // => {a: 1, b: 2}\n * @dataFirst\n * @category Object\n */\nexport function omitBy<\n T extends object,\n S extends EnumerableStringKeyedValueOf<T>,\n>(\n data: T,\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => value is S,\n): PartialEnumerableKeysNarrowed<T, S>;\nexport function omitBy<T extends object>(\n data: T,\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => boolean,\n): PartialEnumerableKeys<T>;\n\n/**\n * Returns a partial copy of an object omitting the keys matching predicate.\n *\n * @param predicate - The predicate.\n * @signature omitBy(fn)(object)\n * @example\n * omitBy((val, key) => key.toUpperCase() === key)({a: 1, b: 2, A: 3, B: 4}) // => {a: 1, b: 2}\n * @dataLast\n * @category Object\n */\nexport function omitBy<\n T extends object,\n S extends EnumerableStringKeyedValueOf<T>,\n>(\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => value is S,\n): (data: T) => PartialEnumerableKeysNarrowed<T, S>;\nexport function omitBy<T extends object>(\n predicate: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n data: T,\n ) => boolean,\n): (data: T) => PartialEnumerableKeys<T>;\n\nexport function omitBy(...args: ReadonlyArray<unknown>): unknown {\n return curry(omitByImplementation, args);\n}\n\nfunction omitByImplementation<T extends object>(\n data: T,\n predicate: (value: unknown, key: string, data: T) => boolean,\n): Record<string, unknown> {\n const out: Partial<Record<string, unknown>> = { ...data };\n\n for (const [key, value] of Object.entries(out)) {\n if (predicate(value, key, data)) {\n // eslint-disable-next-line ts/no-dynamic-delete -- This is the best way to do it!\n delete out[key];\n }\n }\n\n return out;\n}\n"],"mappings":"mCAmKA,SAAgB,EAAO,GAAG,EAAuC,CAC/D,OAAO,EAAM,EAAsB,CAAI,CACzC,CAEA,SAAS,EACP,EACA,EACyB,CACzB,IAAM,EAAwC,CAAE,GAAG,CAAK,EAExD,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAG,EACvC,EAAU,EAAO,EAAK,CAAI,GAE5B,OAAO,EAAI,GAIf,OAAO,CACT"}
|
package/dist/omit.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs"),t=require("./has-at-least.cjs");function n(...t){return e.curry(r,t)}function r(e,n){if(!t.hasAtLeast(n,1))return{...e};if(!t.hasAtLeast(n,2)){let{[n[0]]:t,...r}=e;return r}let r={...e};for(let e of n)delete r[e];return r}exports.omit=n;
|
|
2
2
|
//# sourceMappingURL=omit.cjs.map
|
package/dist/omit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.cjs","names":["curry","hasAtLeast"],"sources":["../src/omit.ts"],"sourcesContent":["import type { EmptyObject, IsNever, KeysOfUnion } from 'type-fest';\nimport type { IsBounded } from './internal/types/is-bounded';\nimport type { IsBoundedRecord } from './internal/types/is-bounded-record';\nimport type { PartitionByUnion } from './internal/types/partition-by-union';\nimport type { SimplifiedWritable } from './internal/types/simplified-writable';\nimport type { TupleParts } from './internal/types/tuple-parts';\nimport { curry } from './curry';\nimport { hasAtLeast } from './has-at-least';\n\ntype OmitFromArray<T, Keys extends ReadonlyArray<PropertyKey>>\n // Distribute unions for both object types and key arrays.\n = T extends unknown\n ? Keys extends unknown\n ? // The output is always writable because we always create a new object!\n SimplifiedWritable<\n IsNever<Extract<Keys[number], keyof T>> extends true\n ? // When none of the keys belong to T we can short-circuit and\n // simply return T as-is because `omit` would do nothing.\n T\n : IsBoundedRecord<T> extends true\n ? OmitBounded<T, Keys>\n : OmitUnbounded<T, Keys>\n >\n : never\n : never;\n\ntype OmitBounded<T, Keys extends ReadonlyArray<PropertyKey>>\n // We build our output by first considering any key present in the keys array\n // as being omitted. This object would contain all keys that are unaffected at\n // all by this omit operation.\n = FixEmpty<Omit<T, Keys[number]>>\n // But we might be missing keys that are optional in the keys tuple (and\n // thus might not be removed). Because these keys are optional, their props\n // in the output also need to be optional.\n & Partial<\n Pick<\n T,\n Exclude<\n // Find all keys that can either be omitted or not, these are all keys\n // in unions in the required parts of the keys tuple (the prefix and\n // the suffix), as well as all keys in the optional parts and the rest\n // item.\n | PartitionByUnion<TupleParts<Keys>['required']>['union']\n | TupleParts<Keys>['optional'][number]\n | TupleParts<Keys>['item']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['union'],\n // We then need to remove from these any items which *also* are\n // ensured to always exist in the keys tuple, these are the elements\n // of the required parts of the tuple which are singular (not unions).\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >\n >\n >;\n\n/**\n * The built-in `Omit` type doesn't handle unbounded records correctly! When\n * omitting an unbounded key the result should be untouched as we can't tell\n * what got removed, and can't represent an object that had \"something\" removed\n * from it, but instead it returns `{}`(?!) The same thing applies when a key\n * is only optionally omitted for the same reasons. This is why we don't use\n * `Omit` at all for the unbounded case.\n *\n * @see https://www.typescriptlang.org/play/?#code/C4TwDgpgBAqgdgIwPYFc4BMLqgXigeQFsBLYAHgCUIBjJAJ3TIGdg7i4BzAGigCIALCABshSXgD4eLNp3EBuAFAB6JVDUA9APxA\n */\ntype OmitUnbounded<T, Keys extends ReadonlyArray<PropertyKey>> = T\n // Any key we know for sure is being omitted needs to become \"impossible\" to\n // access; for an unbounded record this means merging it with a bounded record\n // with `never` value for these keys.\n & Record<\n Bounded<\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >,\n never\n >;\n\n/**\n * When `Omit` omits **all** keys from a bounded record it results in `{}` which\n * doesn't match what we'd expect to be returned in terms of a useful type as\n * the output of `Omit`.\n */\ntype FixEmpty<T> = IsNever<keyof T> extends true ? EmptyObject : T;\n\n/**\n * Filter a union of types, leaving only those that are bounded. e.g.,\n * `Bounded<\"a\" | number>` results in `\"a\"`.\n */\ntype Bounded<T> = T extends unknown\n ? IsBounded<T> extends true\n ? T\n : never\n : never;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param keys - The property names.\n * @signature\n * omit(keys)(obj);\n * @example\n * pipe({ a: 1, b: 2, c: 3, d: 4 }, omit(['a', 'd'])) // => { b: 2, c: 3 }\n * @dataLast\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n keys: Keys,\n): (data: T) => OmitFromArray<T, Keys>;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param data - The object.\n * @param keys - The property names.\n * @signature\n * omit(obj, keys);\n * @example\n * omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }\n * @dataFirst\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n data: T,\n keys: Keys,\n): OmitFromArray<T, Keys>;\n\nexport function omit(...args: ReadonlyArray<unknown>): unknown {\n return curry(omitImplementation, args);\n}\n\nfunction omitImplementation<\n T extends object,\n Keys extends ReadonlyArray<keyof T>,\n>(data: T, keys: Keys): OmitFromArray<T, Keys> {\n if (!hasAtLeast(keys, 1)) {\n // No props to omit at all!\n // @ts-expect-error [ts2322] - TypeScript can't connect the fact that the\n // keys array is empty and infer the expected output, and then infer that we\n // return it correctly here.\n return { ...data };\n }\n\n if (!hasAtLeast(keys, 2)) {\n // Only one prop to omit so we can let the runtime engine deal with\n // removing it efficiently.\n const { [keys[0]]: _omitted, ...remaining } = data;\n\n // @ts-expect-error [ts2322] - TypeScript can't compute the expected output\n // correctly and then infer that we return it correctly here.\n return remaining;\n }\n\n // Multiple props to omit so we have to use a loop to omit all of them.\n const out = { ...data };\n for (const key of keys) {\n // eslint-disable-next-line ts/no-dynamic-delete -- This is intentional! It is the most effective way to allow the runtime engine to optimize the object without creating excessive copies for every omitted key.\n delete out[key];\n }\n\n // @ts-expect-error [ts2322] - The type is too complex and TypeScript can't\n // \"follow\" the iterative algorithm to ensure the output makes sense.\n return out;\n}\n"],"mappings":"kIA8HA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAOA,EAAAA,MAAM,EAAoB,
|
|
1
|
+
{"version":3,"file":"omit.cjs","names":["curry","hasAtLeast"],"sources":["../src/omit.ts"],"sourcesContent":["import type { EmptyObject, IsNever, KeysOfUnion } from 'type-fest';\nimport type { IsBounded } from './internal/types/is-bounded';\nimport type { IsBoundedRecord } from './internal/types/is-bounded-record';\nimport type { PartitionByUnion } from './internal/types/partition-by-union';\nimport type { SimplifiedWritable } from './internal/types/simplified-writable';\nimport type { TupleParts } from './internal/types/tuple-parts';\nimport { curry } from './curry';\nimport { hasAtLeast } from './has-at-least';\n\ntype OmitFromArray<T, Keys extends ReadonlyArray<PropertyKey>>\n // Distribute unions for both object types and key arrays.\n = T extends unknown\n ? Keys extends unknown\n ? // The output is always writable because we always create a new object!\n SimplifiedWritable<\n IsNever<Extract<Keys[number], keyof T>> extends true\n ? // When none of the keys belong to T we can short-circuit and\n // simply return T as-is because `omit` would do nothing.\n T\n : IsBoundedRecord<T> extends true\n ? OmitBounded<T, Keys>\n : OmitUnbounded<T, Keys>\n >\n : never\n : never;\n\ntype OmitBounded<T, Keys extends ReadonlyArray<PropertyKey>>\n // We build our output by first considering any key present in the keys array\n // as being omitted. This object would contain all keys that are unaffected at\n // all by this omit operation.\n = FixEmpty<Omit<T, Keys[number]>>\n // But we might be missing keys that are optional in the keys tuple (and\n // thus might not be removed). Because these keys are optional, their props\n // in the output also need to be optional.\n & Partial<\n Pick<\n T,\n Exclude<\n // Find all keys that can either be omitted or not, these are all keys\n // in unions in the required parts of the keys tuple (the prefix and\n // the suffix), as well as all keys in the optional parts and the rest\n // item.\n | PartitionByUnion<TupleParts<Keys>['required']>['union']\n | TupleParts<Keys>['optional'][number]\n | TupleParts<Keys>['item']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['union'],\n // We then need to remove from these any items which *also* are\n // ensured to always exist in the keys tuple, these are the elements\n // of the required parts of the tuple which are singular (not unions).\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >\n >\n >;\n\n/**\n * The built-in `Omit` type doesn't handle unbounded records correctly! When\n * omitting an unbounded key the result should be untouched as we can't tell\n * what got removed, and can't represent an object that had \"something\" removed\n * from it, but instead it returns `{}`(?!) The same thing applies when a key\n * is only optionally omitted for the same reasons. This is why we don't use\n * `Omit` at all for the unbounded case.\n *\n * @see https://www.typescriptlang.org/play/?#code/C4TwDgpgBAqgdgIwPYFc4BMLqgXigeQFsBLYAHgCUIBjJAJ3TIGdg7i4BzAGigCIALCABshSXgD4eLNp3EBuAFAB6JVDUA9APxA\n */\ntype OmitUnbounded<T, Keys extends ReadonlyArray<PropertyKey>> = T\n // Any key we know for sure is being omitted needs to become \"impossible\" to\n // access; for an unbounded record this means merging it with a bounded record\n // with `never` value for these keys.\n & Record<\n Bounded<\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >,\n never\n >;\n\n/**\n * When `Omit` omits **all** keys from a bounded record it results in `{}` which\n * doesn't match what we'd expect to be returned in terms of a useful type as\n * the output of `Omit`.\n */\ntype FixEmpty<T> = IsNever<keyof T> extends true ? EmptyObject : T;\n\n/**\n * Filter a union of types, leaving only those that are bounded. e.g.,\n * `Bounded<\"a\" | number>` results in `\"a\"`.\n */\ntype Bounded<T> = T extends unknown\n ? IsBounded<T> extends true\n ? T\n : never\n : never;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param keys - The property names.\n * @signature\n * omit(keys)(obj);\n * @example\n * pipe({ a: 1, b: 2, c: 3, d: 4 }, omit(['a', 'd'])) // => { b: 2, c: 3 }\n * @dataLast\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n keys: Keys,\n): (data: T) => OmitFromArray<T, Keys>;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param data - The object.\n * @param keys - The property names.\n * @signature\n * omit(obj, keys);\n * @example\n * omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }\n * @dataFirst\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n data: T,\n keys: Keys,\n): OmitFromArray<T, Keys>;\n\nexport function omit(...args: ReadonlyArray<unknown>): unknown {\n return curry(omitImplementation, args);\n}\n\nfunction omitImplementation<\n T extends object,\n Keys extends ReadonlyArray<keyof T>,\n>(data: T, keys: Keys): OmitFromArray<T, Keys> {\n if (!hasAtLeast(keys, 1)) {\n // No props to omit at all!\n // @ts-expect-error [ts2322] - TypeScript can't connect the fact that the\n // keys array is empty and infer the expected output, and then infer that we\n // return it correctly here.\n return { ...data };\n }\n\n if (!hasAtLeast(keys, 2)) {\n // Only one prop to omit so we can let the runtime engine deal with\n // removing it efficiently.\n const { [keys[0]]: _omitted, ...remaining } = data;\n\n // @ts-expect-error [ts2322] - TypeScript can't compute the expected output\n // correctly and then infer that we return it correctly here.\n return remaining;\n }\n\n // Multiple props to omit so we have to use a loop to omit all of them.\n const out = { ...data };\n for (const key of keys) {\n // eslint-disable-next-line ts/no-dynamic-delete -- This is intentional! It is the most effective way to allow the runtime engine to optimize the object without creating excessive copies for every omitted key.\n delete out[key];\n }\n\n // @ts-expect-error [ts2322] - The type is too complex and TypeScript can't\n // \"follow\" the iterative algorithm to ensure the output makes sense.\n return out;\n}\n"],"mappings":"kIA8HA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAOA,EAAAA,MAAM,EAAoB,CAAI,CACvC,CAEA,SAAS,EAGP,EAAS,EAAoC,CAC7C,GAAI,CAACC,EAAAA,WAAW,EAAM,CAAC,EAKrB,MAAO,CAAE,GAAG,CAAK,EAGnB,GAAI,CAACA,EAAAA,WAAW,EAAM,CAAC,EAAG,CAGxB,GAAM,EAAG,EAAK,IAAK,EAAU,GAAG,GAAc,EAI9C,OAAO,CACT,CAGA,IAAM,EAAM,CAAE,GAAG,CAAK,EACtB,IAAK,IAAM,KAAO,EAEhB,OAAO,EAAI,GAKb,OAAO,CACT"}
|
package/dist/omit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","names":[],"sources":["../src/omit.ts"],"sourcesContent":["import type { EmptyObject, IsNever, KeysOfUnion } from 'type-fest';\nimport type { IsBounded } from './internal/types/is-bounded';\nimport type { IsBoundedRecord } from './internal/types/is-bounded-record';\nimport type { PartitionByUnion } from './internal/types/partition-by-union';\nimport type { SimplifiedWritable } from './internal/types/simplified-writable';\nimport type { TupleParts } from './internal/types/tuple-parts';\nimport { curry } from './curry';\nimport { hasAtLeast } from './has-at-least';\n\ntype OmitFromArray<T, Keys extends ReadonlyArray<PropertyKey>>\n // Distribute unions for both object types and key arrays.\n = T extends unknown\n ? Keys extends unknown\n ? // The output is always writable because we always create a new object!\n SimplifiedWritable<\n IsNever<Extract<Keys[number], keyof T>> extends true\n ? // When none of the keys belong to T we can short-circuit and\n // simply return T as-is because `omit` would do nothing.\n T\n : IsBoundedRecord<T> extends true\n ? OmitBounded<T, Keys>\n : OmitUnbounded<T, Keys>\n >\n : never\n : never;\n\ntype OmitBounded<T, Keys extends ReadonlyArray<PropertyKey>>\n // We build our output by first considering any key present in the keys array\n // as being omitted. This object would contain all keys that are unaffected at\n // all by this omit operation.\n = FixEmpty<Omit<T, Keys[number]>>\n // But we might be missing keys that are optional in the keys tuple (and\n // thus might not be removed). Because these keys are optional, their props\n // in the output also need to be optional.\n & Partial<\n Pick<\n T,\n Exclude<\n // Find all keys that can either be omitted or not, these are all keys\n // in unions in the required parts of the keys tuple (the prefix and\n // the suffix), as well as all keys in the optional parts and the rest\n // item.\n | PartitionByUnion<TupleParts<Keys>['required']>['union']\n | TupleParts<Keys>['optional'][number]\n | TupleParts<Keys>['item']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['union'],\n // We then need to remove from these any items which *also* are\n // ensured to always exist in the keys tuple, these are the elements\n // of the required parts of the tuple which are singular (not unions).\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >\n >\n >;\n\n/**\n * The built-in `Omit` type doesn't handle unbounded records correctly! When\n * omitting an unbounded key the result should be untouched as we can't tell\n * what got removed, and can't represent an object that had \"something\" removed\n * from it, but instead it returns `{}`(?!) The same thing applies when a key\n * is only optionally omitted for the same reasons. This is why we don't use\n * `Omit` at all for the unbounded case.\n *\n * @see https://www.typescriptlang.org/play/?#code/C4TwDgpgBAqgdgIwPYFc4BMLqgXigeQFsBLYAHgCUIBjJAJ3TIGdg7i4BzAGigCIALCABshSXgD4eLNp3EBuAFAB6JVDUA9APxA\n */\ntype OmitUnbounded<T, Keys extends ReadonlyArray<PropertyKey>> = T\n // Any key we know for sure is being omitted needs to become \"impossible\" to\n // access; for an unbounded record this means merging it with a bounded record\n // with `never` value for these keys.\n & Record<\n Bounded<\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >,\n never\n >;\n\n/**\n * When `Omit` omits **all** keys from a bounded record it results in `{}` which\n * doesn't match what we'd expect to be returned in terms of a useful type as\n * the output of `Omit`.\n */\ntype FixEmpty<T> = IsNever<keyof T> extends true ? EmptyObject : T;\n\n/**\n * Filter a union of types, leaving only those that are bounded. e.g.,\n * `Bounded<\"a\" | number>` results in `\"a\"`.\n */\ntype Bounded<T> = T extends unknown\n ? IsBounded<T> extends true\n ? T\n : never\n : never;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param keys - The property names.\n * @signature\n * omit(keys)(obj);\n * @example\n * pipe({ a: 1, b: 2, c: 3, d: 4 }, omit(['a', 'd'])) // => { b: 2, c: 3 }\n * @dataLast\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n keys: Keys,\n): (data: T) => OmitFromArray<T, Keys>;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param data - The object.\n * @param keys - The property names.\n * @signature\n * omit(obj, keys);\n * @example\n * omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }\n * @dataFirst\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n data: T,\n keys: Keys,\n): OmitFromArray<T, Keys>;\n\nexport function omit(...args: ReadonlyArray<unknown>): unknown {\n return curry(omitImplementation, args);\n}\n\nfunction omitImplementation<\n T extends object,\n Keys extends ReadonlyArray<keyof T>,\n>(data: T, keys: Keys): OmitFromArray<T, Keys> {\n if (!hasAtLeast(keys, 1)) {\n // No props to omit at all!\n // @ts-expect-error [ts2322] - TypeScript can't connect the fact that the\n // keys array is empty and infer the expected output, and then infer that we\n // return it correctly here.\n return { ...data };\n }\n\n if (!hasAtLeast(keys, 2)) {\n // Only one prop to omit so we can let the runtime engine deal with\n // removing it efficiently.\n const { [keys[0]]: _omitted, ...remaining } = data;\n\n // @ts-expect-error [ts2322] - TypeScript can't compute the expected output\n // correctly and then infer that we return it correctly here.\n return remaining;\n }\n\n // Multiple props to omit so we have to use a loop to omit all of them.\n const out = { ...data };\n for (const key of keys) {\n // eslint-disable-next-line ts/no-dynamic-delete -- This is intentional! It is the most effective way to allow the runtime engine to optimize the object without creating excessive copies for every omitted key.\n delete out[key];\n }\n\n // @ts-expect-error [ts2322] - The type is too complex and TypeScript can't\n // \"follow\" the iterative algorithm to ensure the output makes sense.\n return out;\n}\n"],"mappings":"kFA8HA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAO,EAAM,EAAoB,
|
|
1
|
+
{"version":3,"file":"omit.js","names":[],"sources":["../src/omit.ts"],"sourcesContent":["import type { EmptyObject, IsNever, KeysOfUnion } from 'type-fest';\nimport type { IsBounded } from './internal/types/is-bounded';\nimport type { IsBoundedRecord } from './internal/types/is-bounded-record';\nimport type { PartitionByUnion } from './internal/types/partition-by-union';\nimport type { SimplifiedWritable } from './internal/types/simplified-writable';\nimport type { TupleParts } from './internal/types/tuple-parts';\nimport { curry } from './curry';\nimport { hasAtLeast } from './has-at-least';\n\ntype OmitFromArray<T, Keys extends ReadonlyArray<PropertyKey>>\n // Distribute unions for both object types and key arrays.\n = T extends unknown\n ? Keys extends unknown\n ? // The output is always writable because we always create a new object!\n SimplifiedWritable<\n IsNever<Extract<Keys[number], keyof T>> extends true\n ? // When none of the keys belong to T we can short-circuit and\n // simply return T as-is because `omit` would do nothing.\n T\n : IsBoundedRecord<T> extends true\n ? OmitBounded<T, Keys>\n : OmitUnbounded<T, Keys>\n >\n : never\n : never;\n\ntype OmitBounded<T, Keys extends ReadonlyArray<PropertyKey>>\n // We build our output by first considering any key present in the keys array\n // as being omitted. This object would contain all keys that are unaffected at\n // all by this omit operation.\n = FixEmpty<Omit<T, Keys[number]>>\n // But we might be missing keys that are optional in the keys tuple (and\n // thus might not be removed). Because these keys are optional, their props\n // in the output also need to be optional.\n & Partial<\n Pick<\n T,\n Exclude<\n // Find all keys that can either be omitted or not, these are all keys\n // in unions in the required parts of the keys tuple (the prefix and\n // the suffix), as well as all keys in the optional parts and the rest\n // item.\n | PartitionByUnion<TupleParts<Keys>['required']>['union']\n | TupleParts<Keys>['optional'][number]\n | TupleParts<Keys>['item']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['union'],\n // We then need to remove from these any items which *also* are\n // ensured to always exist in the keys tuple, these are the elements\n // of the required parts of the tuple which are singular (not unions).\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >\n >\n >;\n\n/**\n * The built-in `Omit` type doesn't handle unbounded records correctly! When\n * omitting an unbounded key the result should be untouched as we can't tell\n * what got removed, and can't represent an object that had \"something\" removed\n * from it, but instead it returns `{}`(?!) The same thing applies when a key\n * is only optionally omitted for the same reasons. This is why we don't use\n * `Omit` at all for the unbounded case.\n *\n * @see https://www.typescriptlang.org/play/?#code/C4TwDgpgBAqgdgIwPYFc4BMLqgXigeQFsBLYAHgCUIBjJAJ3TIGdg7i4BzAGigCIALCABshSXgD4eLNp3EBuAFAB6JVDUA9APxA\n */\ntype OmitUnbounded<T, Keys extends ReadonlyArray<PropertyKey>> = T\n // Any key we know for sure is being omitted needs to become \"impossible\" to\n // access; for an unbounded record this means merging it with a bounded record\n // with `never` value for these keys.\n & Record<\n Bounded<\n | PartitionByUnion<TupleParts<Keys>['required']>['singular']\n | PartitionByUnion<TupleParts<Keys>['suffix']>['singular']\n >,\n never\n >;\n\n/**\n * When `Omit` omits **all** keys from a bounded record it results in `{}` which\n * doesn't match what we'd expect to be returned in terms of a useful type as\n * the output of `Omit`.\n */\ntype FixEmpty<T> = IsNever<keyof T> extends true ? EmptyObject : T;\n\n/**\n * Filter a union of types, leaving only those that are bounded. e.g.,\n * `Bounded<\"a\" | number>` results in `\"a\"`.\n */\ntype Bounded<T> = T extends unknown\n ? IsBounded<T> extends true\n ? T\n : never\n : never;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param keys - The property names.\n * @signature\n * omit(keys)(obj);\n * @example\n * pipe({ a: 1, b: 2, c: 3, d: 4 }, omit(['a', 'd'])) // => { b: 2, c: 3 }\n * @dataLast\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n keys: Keys,\n): (data: T) => OmitFromArray<T, Keys>;\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @param data - The object.\n * @param keys - The property names.\n * @signature\n * omit(obj, keys);\n * @example\n * omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }\n * @dataFirst\n * @category Object\n */\nexport function omit<T, const Keys extends ReadonlyArray<KeysOfUnion<T>>>(\n data: T,\n keys: Keys,\n): OmitFromArray<T, Keys>;\n\nexport function omit(...args: ReadonlyArray<unknown>): unknown {\n return curry(omitImplementation, args);\n}\n\nfunction omitImplementation<\n T extends object,\n Keys extends ReadonlyArray<keyof T>,\n>(data: T, keys: Keys): OmitFromArray<T, Keys> {\n if (!hasAtLeast(keys, 1)) {\n // No props to omit at all!\n // @ts-expect-error [ts2322] - TypeScript can't connect the fact that the\n // keys array is empty and infer the expected output, and then infer that we\n // return it correctly here.\n return { ...data };\n }\n\n if (!hasAtLeast(keys, 2)) {\n // Only one prop to omit so we can let the runtime engine deal with\n // removing it efficiently.\n const { [keys[0]]: _omitted, ...remaining } = data;\n\n // @ts-expect-error [ts2322] - TypeScript can't compute the expected output\n // correctly and then infer that we return it correctly here.\n return remaining;\n }\n\n // Multiple props to omit so we have to use a loop to omit all of them.\n const out = { ...data };\n for (const key of keys) {\n // eslint-disable-next-line ts/no-dynamic-delete -- This is intentional! It is the most effective way to allow the runtime engine to optimize the object without creating excessive copies for every omitted key.\n delete out[key];\n }\n\n // @ts-expect-error [ts2322] - The type is too complex and TypeScript can't\n // \"follow\" the iterative algorithm to ensure the output makes sense.\n return out;\n}\n"],"mappings":"kFA8HA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAO,EAAM,EAAoB,CAAI,CACvC,CAEA,SAAS,EAGP,EAAS,EAAoC,CAC7C,GAAI,CAAC,EAAW,EAAM,CAAC,EAKrB,MAAO,CAAE,GAAG,CAAK,EAGnB,GAAI,CAAC,EAAW,EAAM,CAAC,EAAG,CAGxB,GAAM,EAAG,EAAK,IAAK,EAAU,GAAG,GAAc,EAI9C,OAAO,CACT,CAGA,IAAM,EAAM,CAAE,GAAG,CAAK,EACtB,IAAK,IAAM,KAAO,EAEhB,OAAO,EAAI,GAKb,OAAO,CACT"}
|
package/dist/once.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"once.cjs","names":[],"sources":["../src/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first invocation.\n *\n * @param fn - The function to wrap.\n * @signature once(fn)\n * @example\n * const initialize = once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n * @category Function\n */\nexport function once<T>(fn: () => T): () => T {\n let called = false;\n let ret: T;\n return () => {\n if (!called) {\n ret = fn();\n called = true;\n }\n return ret;\n };\n}\n"],"mappings":"mEAYA,SAAgB,EAAQ,EAAsB,CAC5C,IAAI,EAAS,GACT,EACJ,WACE,AAEE,KADA,EAAM,
|
|
1
|
+
{"version":3,"file":"once.cjs","names":[],"sources":["../src/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first invocation.\n *\n * @param fn - The function to wrap.\n * @signature once(fn)\n * @example\n * const initialize = once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n * @category Function\n */\nexport function once<T>(fn: () => T): () => T {\n let called = false;\n let ret: T;\n return () => {\n if (!called) {\n ret = fn();\n called = true;\n }\n return ret;\n };\n}\n"],"mappings":"mEAYA,SAAgB,EAAQ,EAAsB,CAC5C,IAAI,EAAS,GACT,EACJ,WACE,AAEE,KADA,EAAM,EAAG,EACA,IAEJ,EAEX"}
|
package/dist/once.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"once.js","names":[],"sources":["../src/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first invocation.\n *\n * @param fn - The function to wrap.\n * @signature once(fn)\n * @example\n * const initialize = once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n * @category Function\n */\nexport function once<T>(fn: () => T): () => T {\n let called = false;\n let ret: T;\n return () => {\n if (!called) {\n ret = fn();\n called = true;\n }\n return ret;\n };\n}\n"],"mappings":"AAYA,SAAgB,EAAQ,EAAsB,CAC5C,IAAI,EAAS,GACT,EACJ,WACE,AAEE,KADA,EAAM,
|
|
1
|
+
{"version":3,"file":"once.js","names":[],"sources":["../src/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first invocation.\n *\n * @param fn - The function to wrap.\n * @signature once(fn)\n * @example\n * const initialize = once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n * @category Function\n */\nexport function once<T>(fn: () => T): () => T {\n let called = false;\n let ret: T;\n return () => {\n if (!called) {\n ret = fn();\n called = true;\n }\n return ret;\n };\n}\n"],"mappings":"AAYA,SAAgB,EAAQ,EAAsB,CAC5C,IAAI,EAAS,GACT,EACJ,WACE,AAEE,KADA,EAAM,EAAG,EACA,IAEJ,EAEX"}
|
package/dist/only.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e){return e.length===1?e[0]:void 0}exports.only=t;
|
|
2
2
|
//# sourceMappingURL=only.cjs.map
|
package/dist/only.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"only.cjs","names":["curry"],"sources":["../src/only.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport { curry } from './curry';\n\ntype Only<T extends IterableContainer> = T extends\n | readonly [...Array<unknown>, unknown, unknown]\n | readonly []\n | readonly [unknown, ...Array<unknown>, unknown]\n | readonly [unknown, unknown, ...Array<unknown>]\n ? undefined\n : T extends readonly [unknown]\n ? T[number]\n : T[number] | undefined;\n\n/**\n * Returns the first and only element of `
|
|
1
|
+
{"version":3,"file":"only.cjs","names":["curry"],"sources":["../src/only.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport { curry } from './curry';\n\ntype Only<T extends IterableContainer> = T extends\n | readonly [...Array<unknown>, unknown, unknown]\n | readonly []\n | readonly [unknown, ...Array<unknown>, unknown]\n | readonly [unknown, unknown, ...Array<unknown>]\n ? undefined\n : T extends readonly [unknown]\n ? T[number]\n : T[number] | undefined;\n\n/**\n * Returns the first and only element of `data`, or undefined otherwise.\n *\n * @param data - The target array.\n * @signature\n * only(data)\n * @example\n * only([]) // => undefined\n * only([1]) // => 1\n * only([1, 2]) // => undefined\n * @dataFirst\n * @category Array\n */\nexport function only<T extends IterableContainer>(data: T): Only<T>;\n\n/**\n * Returns the first and only element of `data`, or undefined otherwise.\n *\n * @signature\n * only()(data)\n * @example\n * pipe([], only()); // => undefined\n * pipe([1], only()); // => 1\n * pipe([1, 2], only()); // => undefined\n * @dataLast\n * @category Array\n */\nexport function only<T extends IterableContainer>(): (data: T) => Only<T>;\n\nexport function only(...args: ReadonlyArray<unknown>): unknown {\n return curry(onlyImplementation, args);\n}\n\nfunction onlyImplementation<T>(data: ReadonlyArray<T>): T | undefined {\n return data.length === 1 ? data[0] : undefined;\n}\n"],"mappings":"kGA0CA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAOA,EAAAA,MAAM,EAAoB,CAAI,CACvC,CAEA,SAAS,EAAsB,EAAuC,CACpE,OAAO,EAAK,SAAW,EAAI,EAAK,GAAK,IAAA,EACvC"}
|
package/dist/only.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"only.js","names":[],"sources":["../src/only.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport { curry } from './curry';\n\ntype Only<T extends IterableContainer> = T extends\n | readonly [...Array<unknown>, unknown, unknown]\n | readonly []\n | readonly [unknown, ...Array<unknown>, unknown]\n | readonly [unknown, unknown, ...Array<unknown>]\n ? undefined\n : T extends readonly [unknown]\n ? T[number]\n : T[number] | undefined;\n\n/**\n * Returns the first and only element of `
|
|
1
|
+
{"version":3,"file":"only.js","names":[],"sources":["../src/only.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport { curry } from './curry';\n\ntype Only<T extends IterableContainer> = T extends\n | readonly [...Array<unknown>, unknown, unknown]\n | readonly []\n | readonly [unknown, ...Array<unknown>, unknown]\n | readonly [unknown, unknown, ...Array<unknown>]\n ? undefined\n : T extends readonly [unknown]\n ? T[number]\n : T[number] | undefined;\n\n/**\n * Returns the first and only element of `data`, or undefined otherwise.\n *\n * @param data - The target array.\n * @signature\n * only(data)\n * @example\n * only([]) // => undefined\n * only([1]) // => 1\n * only([1, 2]) // => undefined\n * @dataFirst\n * @category Array\n */\nexport function only<T extends IterableContainer>(data: T): Only<T>;\n\n/**\n * Returns the first and only element of `data`, or undefined otherwise.\n *\n * @signature\n * only()(data)\n * @example\n * pipe([], only()); // => undefined\n * pipe([1], only()); // => 1\n * pipe([1, 2], only()); // => undefined\n * @dataLast\n * @category Array\n */\nexport function only<T extends IterableContainer>(): (data: T) => Only<T>;\n\nexport function only(...args: ReadonlyArray<unknown>): unknown {\n return curry(onlyImplementation, args);\n}\n\nfunction onlyImplementation<T>(data: ReadonlyArray<T>): T | undefined {\n return data.length === 1 ? data[0] : undefined;\n}\n"],"mappings":"mCA0CA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAO,EAAM,EAAoB,CAAI,CACvC,CAEA,SAAS,EAAsB,EAAuC,CACpE,OAAO,EAAK,SAAW,EAAI,EAAK,GAAK,IAAA,EACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial-bind.cjs","names":[],"sources":["../src/partial-bind.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { PerkakasTypeError } from './internal/types/perkakas-type-error';\nimport type { StrictFunction } from './internal/types/strict-function';\nimport type { TupleSplits } from './internal/types/tuple-splits';\n\ntype PartialBindError<\n Message extends string,\n Metadata = never,\n> = PerkakasTypeError<'partialBind', Message, { metadata: Metadata }>;\n\ntype TuplePrefix<T extends IterableContainer> = TupleSplits<T>['left'];\n\ntype RemovePrefix<\n T extends IterableContainer,\n Prefix extends TuplePrefix<T>,\n> = Prefix extends readonly []\n ? T\n : T extends readonly [infer THead, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends readonly THead[].\n // Prefix could possibly be empty, so this has to be THead?.\n [THead?, ...RemovePrefix<TRest, Prefix>]\n : // T has an optional or rest parameter last. If T is a parameter list,\n // this can only happen if we have optional arguments or a rest param;\n // both cases are similar.\n T extends readonly [(infer _THead)?, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends [THead?, ...TRest].\n TRest\n : // We got passed a parameter list that isn't what we expected; this is\n // an internal error.\n PartialBindError<'Function parameter list has unexpected shape', T>;\n\n/**\n * Creates a function that calls `func` with `partial` put before the arguments\n * it receives.\n *\n * Can be thought of as \"freezing\" some portion of a function's arguments,\n * resulting in a new function with a simplified signature.\n *\n * @param func - The function to wrap.\n * @param partial - The arguments to put before.\n * @returns A partially bound function.\n * @signature\n * partialBind(func, ...partial);\n * @example\n * const fn = (x: number, y: number, z: number) => x * 100 + y * 10 + z;\n * const partialFn = partialBind(fn, 1, 2);\n * partialFn(3); //=> 123\n *\n * const logWithPrefix = partialBind(console.log, \"[prefix]\");\n * logWithPrefix(\"hello\"); //=> \"[prefix] hello\"\n * @dataFirst\n * @category Function\n * @see partialLastBind\n */\nexport function partialBind<\n F extends StrictFunction,\n PrefixArgs extends TuplePrefix<Parameters<F>>,\n RemovedPrefix extends RemovePrefix<Parameters<F>, PrefixArgs>,\n>(\n func: F,\n ...partial: PrefixArgs\n): (\n ...rest: RemovedPrefix extends IterableContainer ? RemovedPrefix : never\n) => ReturnType<F> {\n // @ts-expect-error [ts2345, ts2322] -- TypeScript infers the generic sub-\n // types too eagerly, making itself blind to the fact that the types match\n // here.\n return (...rest) => func(...partial, ...rest);\n}\n"],"mappings":"mEA4DA,SAAgB,EAKd,EACA,GAAG,EAGc,CAIjB,OAAQ,GAAG,IAAS,EAAK,GAAG,EAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"partial-bind.cjs","names":[],"sources":["../src/partial-bind.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { PerkakasTypeError } from './internal/types/perkakas-type-error';\nimport type { StrictFunction } from './internal/types/strict-function';\nimport type { TupleSplits } from './internal/types/tuple-splits';\n\ntype PartialBindError<\n Message extends string,\n Metadata = never,\n> = PerkakasTypeError<'partialBind', Message, { metadata: Metadata }>;\n\ntype TuplePrefix<T extends IterableContainer> = TupleSplits<T>['left'];\n\ntype RemovePrefix<\n T extends IterableContainer,\n Prefix extends TuplePrefix<T>,\n> = Prefix extends readonly []\n ? T\n : T extends readonly [infer THead, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends readonly THead[].\n // Prefix could possibly be empty, so this has to be THead?.\n [THead?, ...RemovePrefix<TRest, Prefix>]\n : // T has an optional or rest parameter last. If T is a parameter list,\n // this can only happen if we have optional arguments or a rest param;\n // both cases are similar.\n T extends readonly [(infer _THead)?, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends [THead?, ...TRest].\n TRest\n : // We got passed a parameter list that isn't what we expected; this is\n // an internal error.\n PartialBindError<'Function parameter list has unexpected shape', T>;\n\n/**\n * Creates a function that calls `func` with `partial` put before the arguments\n * it receives.\n *\n * Can be thought of as \"freezing\" some portion of a function's arguments,\n * resulting in a new function with a simplified signature.\n *\n * @param func - The function to wrap.\n * @param partial - The arguments to put before.\n * @returns A partially bound function.\n * @signature\n * partialBind(func, ...partial);\n * @example\n * const fn = (x: number, y: number, z: number) => x * 100 + y * 10 + z;\n * const partialFn = partialBind(fn, 1, 2);\n * partialFn(3); //=> 123\n *\n * const logWithPrefix = partialBind(console.log, \"[prefix]\");\n * logWithPrefix(\"hello\"); //=> \"[prefix] hello\"\n * @dataFirst\n * @category Function\n * @see partialLastBind\n */\nexport function partialBind<\n F extends StrictFunction,\n PrefixArgs extends TuplePrefix<Parameters<F>>,\n RemovedPrefix extends RemovePrefix<Parameters<F>, PrefixArgs>,\n>(\n func: F,\n ...partial: PrefixArgs\n): (\n ...rest: RemovedPrefix extends IterableContainer ? RemovedPrefix : never\n) => ReturnType<F> {\n // @ts-expect-error [ts2345, ts2322] -- TypeScript infers the generic sub-\n // types too eagerly, making itself blind to the fact that the types match\n // here.\n return (...rest) => func(...partial, ...rest);\n}\n"],"mappings":"mEA4DA,SAAgB,EAKd,EACA,GAAG,EAGc,CAIjB,OAAQ,GAAG,IAAS,EAAK,GAAG,EAAS,GAAG,CAAI,CAC9C"}
|
package/dist/partial-bind.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial-bind.js","names":[],"sources":["../src/partial-bind.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { PerkakasTypeError } from './internal/types/perkakas-type-error';\nimport type { StrictFunction } from './internal/types/strict-function';\nimport type { TupleSplits } from './internal/types/tuple-splits';\n\ntype PartialBindError<\n Message extends string,\n Metadata = never,\n> = PerkakasTypeError<'partialBind', Message, { metadata: Metadata }>;\n\ntype TuplePrefix<T extends IterableContainer> = TupleSplits<T>['left'];\n\ntype RemovePrefix<\n T extends IterableContainer,\n Prefix extends TuplePrefix<T>,\n> = Prefix extends readonly []\n ? T\n : T extends readonly [infer THead, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends readonly THead[].\n // Prefix could possibly be empty, so this has to be THead?.\n [THead?, ...RemovePrefix<TRest, Prefix>]\n : // T has an optional or rest parameter last. If T is a parameter list,\n // this can only happen if we have optional arguments or a rest param;\n // both cases are similar.\n T extends readonly [(infer _THead)?, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends [THead?, ...TRest].\n TRest\n : // We got passed a parameter list that isn't what we expected; this is\n // an internal error.\n PartialBindError<'Function parameter list has unexpected shape', T>;\n\n/**\n * Creates a function that calls `func` with `partial` put before the arguments\n * it receives.\n *\n * Can be thought of as \"freezing\" some portion of a function's arguments,\n * resulting in a new function with a simplified signature.\n *\n * @param func - The function to wrap.\n * @param partial - The arguments to put before.\n * @returns A partially bound function.\n * @signature\n * partialBind(func, ...partial);\n * @example\n * const fn = (x: number, y: number, z: number) => x * 100 + y * 10 + z;\n * const partialFn = partialBind(fn, 1, 2);\n * partialFn(3); //=> 123\n *\n * const logWithPrefix = partialBind(console.log, \"[prefix]\");\n * logWithPrefix(\"hello\"); //=> \"[prefix] hello\"\n * @dataFirst\n * @category Function\n * @see partialLastBind\n */\nexport function partialBind<\n F extends StrictFunction,\n PrefixArgs extends TuplePrefix<Parameters<F>>,\n RemovedPrefix extends RemovePrefix<Parameters<F>, PrefixArgs>,\n>(\n func: F,\n ...partial: PrefixArgs\n): (\n ...rest: RemovedPrefix extends IterableContainer ? RemovedPrefix : never\n) => ReturnType<F> {\n // @ts-expect-error [ts2345, ts2322] -- TypeScript infers the generic sub-\n // types too eagerly, making itself blind to the fact that the types match\n // here.\n return (...rest) => func(...partial, ...rest);\n}\n"],"mappings":"AA4DA,SAAgB,EAKd,EACA,GAAG,EAGc,CAIjB,OAAQ,GAAG,IAAS,EAAK,GAAG,EAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"partial-bind.js","names":[],"sources":["../src/partial-bind.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { PerkakasTypeError } from './internal/types/perkakas-type-error';\nimport type { StrictFunction } from './internal/types/strict-function';\nimport type { TupleSplits } from './internal/types/tuple-splits';\n\ntype PartialBindError<\n Message extends string,\n Metadata = never,\n> = PerkakasTypeError<'partialBind', Message, { metadata: Metadata }>;\n\ntype TuplePrefix<T extends IterableContainer> = TupleSplits<T>['left'];\n\ntype RemovePrefix<\n T extends IterableContainer,\n Prefix extends TuplePrefix<T>,\n> = Prefix extends readonly []\n ? T\n : T extends readonly [infer THead, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends readonly THead[].\n // Prefix could possibly be empty, so this has to be THead?.\n [THead?, ...RemovePrefix<TRest, Prefix>]\n : // T has an optional or rest parameter last. If T is a parameter list,\n // this can only happen if we have optional arguments or a rest param;\n // both cases are similar.\n T extends readonly [(infer _THead)?, ...infer TRest]\n ? Prefix extends readonly [infer _PrefixHead, ...infer PrefixRest]\n ? // PrefixHead extends THead.\n RemovePrefix<TRest, PrefixRest>\n : // Prefix (as a whole) extends [THead?, ...TRest].\n TRest\n : // We got passed a parameter list that isn't what we expected; this is\n // an internal error.\n PartialBindError<'Function parameter list has unexpected shape', T>;\n\n/**\n * Creates a function that calls `func` with `partial` put before the arguments\n * it receives.\n *\n * Can be thought of as \"freezing\" some portion of a function's arguments,\n * resulting in a new function with a simplified signature.\n *\n * @param func - The function to wrap.\n * @param partial - The arguments to put before.\n * @returns A partially bound function.\n * @signature\n * partialBind(func, ...partial);\n * @example\n * const fn = (x: number, y: number, z: number) => x * 100 + y * 10 + z;\n * const partialFn = partialBind(fn, 1, 2);\n * partialFn(3); //=> 123\n *\n * const logWithPrefix = partialBind(console.log, \"[prefix]\");\n * logWithPrefix(\"hello\"); //=> \"[prefix] hello\"\n * @dataFirst\n * @category Function\n * @see partialLastBind\n */\nexport function partialBind<\n F extends StrictFunction,\n PrefixArgs extends TuplePrefix<Parameters<F>>,\n RemovedPrefix extends RemovePrefix<Parameters<F>, PrefixArgs>,\n>(\n func: F,\n ...partial: PrefixArgs\n): (\n ...rest: RemovedPrefix extends IterableContainer ? RemovedPrefix : never\n) => ReturnType<F> {\n // @ts-expect-error [ts2345, ts2322] -- TypeScript infers the generic sub-\n // types too eagerly, making itself blind to the fact that the types match\n // here.\n return (...rest) => func(...partial, ...rest);\n}\n"],"mappings":"AA4DA,SAAgB,EAKd,EACA,GAAG,EAGc,CAIjB,OAAQ,GAAG,IAAS,EAAK,GAAG,EAAS,GAAG,CAAI,CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial-last-bind.cjs","names":[],"sources":["../src/partial-last-bind.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { PerkakasTypeError } from './internal/types/perkakas-type-error';\nimport type { StrictFunction } from './internal/types/strict-function';\nimport type { TupleSplits } from './internal/types/tuple-splits';\n\ntype PartialLastBindError<\n Message extends string,\n Metadata = never,\n> = PerkakasTypeError<'partialLastBind', Message, { metadata: Metadata }>;\n\ntype TupleSuffix<T extends IterableContainer> = TupleSplits<T>['right'];\n\ntype RemoveSuffix<\n T extends IterableContainer,\n Suffix extends TupleSuffix<T>,\n> = Suffix extends readonly []\n ? T\n : T extends readonly [...infer TRest, infer TLast]\n ? Suffix extends readonly [...infer SuffixRest, infer _SuffixLast]\n ? // SuffixLast extends TLast.\n RemoveSuffix<TRest, SuffixRest>\n : // Suffix (as a whole) extends readonly TLast[].\n // Suffix could possibly be empty, so this has to be TLast?.\n [...RemoveSuffix<TRest, Suffix>, TLast?]\n : // T has an optional or rest parameter last. If T is a parameter list,\n // this can only happen if we have optional arguments or a rest param;\n // both cases are similar.\n T extends readonly [...infer TRest, (infer _TLast)?]\n ? Suffix extends readonly [...infer SuffixRest, infer _SuffixLast]\n ? // SuffixLast extends TLast.\n RemoveSuffix<TRest, SuffixRest>\n : // Suffix (as a whole) extends [...TRest, TLast?].\n TRest\n : // We got passed a parameter list that isn't what we expected; this\n // is an internal error.\n PartialLastBindError<'Function parameter list has unexpected shape', T>;\n\n/**\n * Creates a function that calls `func` with `partial` put after the arguments\n * it receives. Note that this doesn't support functions with both optional\n * and rest parameters.\n *\n * Can be thought of as \"freezing\" some portion of a function's arguments,\n * resulting in a new function with a simplified signature.\n *\n * Useful for converting a data-first function to a data-last one.\n *\n * @param func - The function to wrap.\n * @param partial - The arguments to put after.\n * @returns A partially bound function.\n * @signature\n * partialLastBind(func, ...partial);\n * @example\n * const fn = (x: number, y: number, z: number) => x * 100 + y * 10 + z;\n * const partialFn = partialLastBind(fn, 2, 3);\n * partialFn(1); //=> 123\n *\n * const parseBinary = partialLastBind(parseInt, \"2\");\n * parseBinary(\"101\"); //=> 5\n *\n * pipe(\n * { a: 1 },\n * // instead of (arg) => JSON.stringify(arg, null, 2)\n * partialLastBind(JSON.stringify, null, 2),\n * ); //=> '{\\n \"a\": 1\\n}'\n * @dataFirst\n * @category Function\n * @see partialBind\n */\nexport function partialLastBind<\n F extends StrictFunction,\n SuffixArgs extends TupleSuffix<Parameters<F>>,\n RemovedSuffix extends RemoveSuffix<Parameters<F>, SuffixArgs>,\n>(\n func: F,\n ...partial: SuffixArgs\n): (\n ...rest: RemovedSuffix extends IterableContainer ? RemovedSuffix : never\n) => ReturnType<F> {\n // @ts-expect-error [ts2345, ts2322] -- TypeScript infers the generic sub-\n // types too eagerly, making itself blind to the fact that the types match\n // here.\n return (...rest) => func(...rest, ...partial);\n}\n"],"mappings":"mEAqEA,SAAgB,EAKd,EACA,GAAG,EAGc,CAIjB,OAAQ,GAAG,IAAS,EAAK,GAAG,EAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"partial-last-bind.cjs","names":[],"sources":["../src/partial-last-bind.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { PerkakasTypeError } from './internal/types/perkakas-type-error';\nimport type { StrictFunction } from './internal/types/strict-function';\nimport type { TupleSplits } from './internal/types/tuple-splits';\n\ntype PartialLastBindError<\n Message extends string,\n Metadata = never,\n> = PerkakasTypeError<'partialLastBind', Message, { metadata: Metadata }>;\n\ntype TupleSuffix<T extends IterableContainer> = TupleSplits<T>['right'];\n\ntype RemoveSuffix<\n T extends IterableContainer,\n Suffix extends TupleSuffix<T>,\n> = Suffix extends readonly []\n ? T\n : T extends readonly [...infer TRest, infer TLast]\n ? Suffix extends readonly [...infer SuffixRest, infer _SuffixLast]\n ? // SuffixLast extends TLast.\n RemoveSuffix<TRest, SuffixRest>\n : // Suffix (as a whole) extends readonly TLast[].\n // Suffix could possibly be empty, so this has to be TLast?.\n [...RemoveSuffix<TRest, Suffix>, TLast?]\n : // T has an optional or rest parameter last. If T is a parameter list,\n // this can only happen if we have optional arguments or a rest param;\n // both cases are similar.\n T extends readonly [...infer TRest, (infer _TLast)?]\n ? Suffix extends readonly [...infer SuffixRest, infer _SuffixLast]\n ? // SuffixLast extends TLast.\n RemoveSuffix<TRest, SuffixRest>\n : // Suffix (as a whole) extends [...TRest, TLast?].\n TRest\n : // We got passed a parameter list that isn't what we expected; this\n // is an internal error.\n PartialLastBindError<'Function parameter list has unexpected shape', T>;\n\n/**\n * Creates a function that calls `func` with `partial` put after the arguments\n * it receives. Note that this doesn't support functions with both optional\n * and rest parameters.\n *\n * Can be thought of as \"freezing\" some portion of a function's arguments,\n * resulting in a new function with a simplified signature.\n *\n * Useful for converting a data-first function to a data-last one.\n *\n * @param func - The function to wrap.\n * @param partial - The arguments to put after.\n * @returns A partially bound function.\n * @signature\n * partialLastBind(func, ...partial);\n * @example\n * const fn = (x: number, y: number, z: number) => x * 100 + y * 10 + z;\n * const partialFn = partialLastBind(fn, 2, 3);\n * partialFn(1); //=> 123\n *\n * const parseBinary = partialLastBind(parseInt, \"2\");\n * parseBinary(\"101\"); //=> 5\n *\n * pipe(\n * { a: 1 },\n * // instead of (arg) => JSON.stringify(arg, null, 2)\n * partialLastBind(JSON.stringify, null, 2),\n * ); //=> '{\\n \"a\": 1\\n}'\n * @dataFirst\n * @category Function\n * @see partialBind\n */\nexport function partialLastBind<\n F extends StrictFunction,\n SuffixArgs extends TupleSuffix<Parameters<F>>,\n RemovedSuffix extends RemoveSuffix<Parameters<F>, SuffixArgs>,\n>(\n func: F,\n ...partial: SuffixArgs\n): (\n ...rest: RemovedSuffix extends IterableContainer ? RemovedSuffix : never\n) => ReturnType<F> {\n // @ts-expect-error [ts2345, ts2322] -- TypeScript infers the generic sub-\n // types too eagerly, making itself blind to the fact that the types match\n // here.\n return (...rest) => func(...rest, ...partial);\n}\n"],"mappings":"mEAqEA,SAAgB,EAKd,EACA,GAAG,EAGc,CAIjB,OAAQ,GAAG,IAAS,EAAK,GAAG,EAAM,GAAG,CAAO,CAC9C"}
|