@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/filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","names":[],"sources":["../src/filter.ts"],"sourcesContent":["import type { Writable } from 'type-fest';\nimport type { FilteredArray } from './internal/types/filtered-array';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n// When the predicate used for filter isn't refining (like a type-predicate) we\n// can narrow the result slightly if it's also trivial (it returns the same\n// result for all items). This is uncommon, but can be useful to \"short-circuit\"\n// the filter.\ntype NonRefinedFilteredArray<\n T extends IterableContainer,\n IsItemIncluded extends boolean,\n> = boolean extends IsItemIncluded\n ? // We don't know which items of the array the predicate would allow in the\n// output so we can only safely say that the result is an array with items\n// from the input array.\n// TODO: Theoretically we could build an output shape that would take into account the **order** of elements in the input array by reconstructing it with every single element in it either included or not, but this type can grow to a union of as much as 2^n options which might not be usable in practice.\n Array<T[number]>\n : IsItemIncluded extends true\n ? // If the predicate is always true we return a shallow copy of the array.\n // If it was originally readonly we need to strip that away.\n Writable<T>\n : // If the predicate is always false we will always return an empty\n // array.\n [];\n\n/**\n * Creates a shallow copy of a portion of a given array, filtered down to just\n * the elements from the given array that pass the test implemented by the\n * provided function. Equivalent to `Array.prototype.filter`.\n *\n * @param data - The array to filter.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to keep the element in the resulting array, and `false`\n * otherwise. A type-predicate can also be used to narrow the result.\n * @returns A shallow copy of the given array containing just the elements that\n * pass the test. If no elements pass the test, an empty array is returned.\n * @signature\n * filter(data, predicate)\n * @example\n * filter([1, 2, 3], x => x % 2 === 1) // => [1, 3]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function filter<\n T extends IterableContainer,\n Condition extends T[number],\n>(\n data: T,\n predicate: (value: T[number], index: number, data: T) => value is Condition,\n): FilteredArray<T, Condition>;\nexport function filter<\n T extends IterableContainer,\n IsItemIncluded extends boolean,\n>(\n data: T,\n predicate: (value: T[number], index: number, data: T) => IsItemIncluded,\n): NonRefinedFilteredArray<T, IsItemIncluded>;\n\n/**\n * Creates a shallow copy of a portion of a given array, filtered down to just\n * the elements from the given array that pass the test implemented by the\n * provided function. Equivalent to `Array.prototype.filter`.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to keep the element in the resulting array, and `false`\n * otherwise.\n * @returns A shallow copy of the given array containing just the elements that\n * pass the test. If no elements pass the test, an empty array is returned.\n * @signature\n * filter(predicate)(data)\n * @example\n * pipe([1, 2, 3], filter(x => x % 2 === 1)) // => [1, 3]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function filter<\n T extends IterableContainer,\n Condition extends T[number],\n>(\n predicate: (value: T[number], index: number, data: T) => value is Condition,\n): (data: T) => FilteredArray<T, Condition>;\nexport function filter<\n T extends IterableContainer,\n IsItemIncluded extends boolean,\n>(\n predicate: (value: T[number], index: number, data: T) => IsItemIncluded,\n): (data: T) => NonRefinedFilteredArray<T, IsItemIncluded>;\n\nexport function filter(...args: ReadonlyArray<unknown>): unknown {\n return curry(filterImplementation, args, lazyImplementation);\n}\n\nfunction filterImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, array: ReadonlyArray<T>) => boolean): Array<T> {\n return data.filter(predicate);\n}\n\nfunction lazyImplementation<T>(predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean): LazyEvaluator<T> {\n return (value, index, data) =>\n predicate(value, index, data)\n ? { done: false, hasNext: true, next: value }\n : SKIP_ITEM;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.js","names":[],"sources":["../src/filter.ts"],"sourcesContent":["import type { Writable } from 'type-fest';\nimport type { FilteredArray } from './internal/types/filtered-array';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n// When the predicate used for filter isn't refining (like a type-predicate) we\n// can narrow the result slightly if it's also trivial (it returns the same\n// result for all items). This is uncommon, but can be useful to \"short-circuit\"\n// the filter.\ntype NonRefinedFilteredArray<\n T extends IterableContainer,\n IsItemIncluded extends boolean,\n> = boolean extends IsItemIncluded\n ? // We don't know which items of the array the predicate would allow in the\n// output so we can only safely say that the result is an array with items\n// from the input array.\n// TODO: Theoretically we could build an output shape that would take into account the **order** of elements in the input array by reconstructing it with every single element in it either included or not, but this type can grow to a union of as much as 2^n options which might not be usable in practice.\n Array<T[number]>\n : IsItemIncluded extends true\n ? // If the predicate is always true we return a shallow copy of the array.\n // If it was originally readonly we need to strip that away.\n Writable<T>\n : // If the predicate is always false we will always return an empty\n // array.\n [];\n\n/**\n * Creates a shallow copy of a portion of a given array, filtered down to just\n * the elements from the given array that pass the test implemented by the\n * provided function. Equivalent to `Array.prototype.filter`.\n *\n * Related operations:\n * - `splice` - to shape the array by *position* rather than by *value*.\n *\n * @param data - The array to filter.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to keep the element in the resulting array, and `false`\n * otherwise. A type-predicate can also be used to narrow the result.\n * @returns A shallow copy of the given array containing just the elements that\n * pass the test. If no elements pass the test, an empty array is returned.\n * @signature\n * filter(data, predicate)\n * @example\n * filter([1, 2, 3], x => x % 2 === 1) // => [1, 3]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function filter<\n T extends IterableContainer,\n Condition extends T[number],\n>(\n data: T,\n predicate: (value: T[number], index: number, data: T) => value is Condition,\n): FilteredArray<T, Condition>;\nexport function filter<\n T extends IterableContainer,\n IsItemIncluded extends boolean,\n>(\n data: T,\n predicate: (value: T[number], index: number, data: T) => IsItemIncluded,\n): NonRefinedFilteredArray<T, IsItemIncluded>;\n\n/**\n * Creates a shallow copy of a portion of a given array, filtered down to just\n * the elements from the given array that pass the test implemented by the\n * provided function. Equivalent to `Array.prototype.filter`.\n *\n * Related operations:\n * - `splice` - to shape the array by *position* rather than by *value*.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to keep the element in the resulting array, and `false`\n * otherwise.\n * @returns A shallow copy of the given array containing just the elements that\n * pass the test. If no elements pass the test, an empty array is returned.\n * @signature\n * filter(predicate)(data)\n * @example\n * pipe([1, 2, 3], filter(x => x % 2 === 1)) // => [1, 3]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function filter<\n T extends IterableContainer,\n Condition extends T[number],\n>(\n predicate: (value: T[number], index: number, data: T) => value is Condition,\n): (data: T) => FilteredArray<T, Condition>;\nexport function filter<\n T extends IterableContainer,\n IsItemIncluded extends boolean,\n>(\n predicate: (value: T[number], index: number, data: T) => IsItemIncluded,\n): (data: T) => NonRefinedFilteredArray<T, IsItemIncluded>;\n\nexport function filter(...args: ReadonlyArray<unknown>): unknown {\n return curry(filterImplementation, args, lazyImplementation);\n}\n\nfunction filterImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, array: ReadonlyArray<T>) => boolean): Array<T> {\n return data.filter(predicate);\n}\n\nfunction lazyImplementation<T>(predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean): LazyEvaluator<T> {\n return (value, index, data) =>\n predicate(value, index, data)\n ? { done: false, hasNext: true, next: value }\n : SKIP_ITEM;\n}\n"],"mappings":"mFAmGA,SAAgB,EAAO,GAAG,EAAuC,CAC/D,OAAO,EAAM,EAAsB,EAAM,CAAkB,CAC7D,CAEA,SAAS,EAAwB,EAAwB,EAAoF,CAC3I,OAAO,EAAK,OAAO,CAAS,CAC9B,CAEA,SAAS,EAAsB,EAA2F,CACxH,OAAQ,EAAO,EAAO,IACpB,EAAU,EAAO,EAAO,CAAI,EACxB,CAAE,KAAM,GAAO,QAAS,GAAM,KAAM,CAAM,EAC1C,CACR"}
|
package/dist/find-index.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.findIndex(t)}exports.findIndex=t;
|
|
2
2
|
//# sourceMappingURL=find-index.cjs.map
|
package/dist/find-index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-index.cjs","names":["curry"],"sources":["../src/find-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(data, predicate)\n * @example\n * findIndex([1, 3, 4, 6], n => n % 2 === 0) // => 2\n * @dataFirst\n * @category Array\n */\nexport function findIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findIndex(n => n % 2 === 0)\n * ); // => 2\n * @dataLast\n * @category Array\n */\nexport function findIndex<T>(\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => number;\n\nexport function findIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findIndexImplementation, args);\n}\n\nfunction findIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean): number {\n return data.findIndex(predicate);\n}\n"],"mappings":"kGAuDA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAOA,EAAAA,MAAM,EAAyB,
|
|
1
|
+
{"version":3,"file":"find-index.cjs","names":["curry"],"sources":["../src/find-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(data, predicate)\n * @example\n * findIndex([1, 3, 4, 6], n => n % 2 === 0) // => 2\n * @dataFirst\n * @category Array\n */\nexport function findIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findIndex(n => n % 2 === 0)\n * ); // => 2\n * @dataLast\n * @category Array\n */\nexport function findIndex<T>(\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => number;\n\nexport function findIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findIndexImplementation, args);\n}\n\nfunction findIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean): number {\n return data.findIndex(predicate);\n}\n"],"mappings":"kGAuDA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAOA,EAAAA,MAAM,EAAyB,CAAI,CAC5C,CAEA,SAAS,EAA2B,EAAwB,EAAgF,CAC1I,OAAO,EAAK,UAAU,CAAS,CACjC"}
|
package/dist/find-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-index.js","names":[],"sources":["../src/find-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(data, predicate)\n * @example\n * findIndex([1, 3, 4, 6], n => n % 2 === 0) // => 2\n * @dataFirst\n * @category Array\n */\nexport function findIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findIndex(n => n % 2 === 0)\n * ); // => 2\n * @dataLast\n * @category Array\n */\nexport function findIndex<T>(\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => number;\n\nexport function findIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findIndexImplementation, args);\n}\n\nfunction findIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean): number {\n return data.findIndex(predicate);\n}\n"],"mappings":"mCAuDA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAO,EAAM,EAAyB,
|
|
1
|
+
{"version":3,"file":"find-index.js","names":[],"sources":["../src/find-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(data, predicate)\n * @example\n * findIndex([1, 3, 4, 6], n => n % 2 === 0) // => 2\n * @dataFirst\n * @category Array\n */\nexport function findIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Returns the index of the first element in an array that satisfies the\n * provided testing function. If no elements satisfy the testing function, -1 is\n * returned.\n *\n * See also the `find` method, which returns the first element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return a `true` to indicate a matching element has been found, and a\n * `false` otherwise.\n * @returns The index of the first element in the array that passes the test.\n * Otherwise, -1.\n * @signature\n * findIndex(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findIndex(n => n % 2 === 0)\n * ); // => 2\n * @dataLast\n * @category Array\n */\nexport function findIndex<T>(\n predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => number;\n\nexport function findIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findIndexImplementation, args);\n}\n\nfunction findIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean): number {\n return data.findIndex(predicate);\n}\n"],"mappings":"mCAuDA,SAAgB,EAAU,GAAG,EAAuC,CAClE,OAAO,EAAM,EAAyB,CAAI,CAC5C,CAEA,SAAS,EAA2B,EAAwB,EAAgF,CAC1I,OAAO,EAAK,UAAU,CAAS,CACjC"}
|
package/dist/find-last-index.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){for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1}exports.findLastIndex=t;
|
|
2
2
|
//# sourceMappingURL=find-last-index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-last-index.cjs","names":["curry"],"sources":["../src/find-last-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(data, predicate)\n * @example\n * findLastIndex([1, 3, 4, 6], n => n % 2 === 1) // => 1\n * @dataFirst\n * @category Array\n */\nexport function findLastIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(fn)(items)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLastIndex(n => n % 2 === 1)\n * ) // => 1\n * @dataLast\n * @category Array\n */\nexport function findLastIndex<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (array: ReadonlyArray<T>) => number;\n\nexport function findLastIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastIndexImplementation, args);\n}\n\nfunction findLastIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean): number {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLastIndex` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n if (predicate(data[i]!, i, data)) {\n return i;\n }\n }\n\n return -1;\n}\n"],"mappings":"kGAuDA,SAAgB,EAAc,GAAG,EAAuC,CACtE,OAAOA,EAAAA,MAAM,EAA6B,
|
|
1
|
+
{"version":3,"file":"find-last-index.cjs","names":["curry"],"sources":["../src/find-last-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(data, predicate)\n * @example\n * findLastIndex([1, 3, 4, 6], n => n % 2 === 1) // => 1\n * @dataFirst\n * @category Array\n */\nexport function findLastIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(fn)(items)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLastIndex(n => n % 2 === 1)\n * ) // => 1\n * @dataLast\n * @category Array\n */\nexport function findLastIndex<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (array: ReadonlyArray<T>) => number;\n\nexport function findLastIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastIndexImplementation, args);\n}\n\nfunction findLastIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean): number {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLastIndex` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n if (predicate(data[i]!, i, data)) {\n return i;\n }\n }\n\n return -1;\n}\n"],"mappings":"kGAuDA,SAAgB,EAAc,GAAG,EAAuC,CACtE,OAAOA,EAAAA,MAAM,EAA6B,CAAI,CAChD,CAEA,SAAS,EAA+B,EAAwB,EAAiF,CAG/I,IAAK,IAAI,EAAI,EAAK,OAAS,EAAG,GAAK,EAAG,IACpC,GAAI,EAAU,EAAK,GAAK,EAAG,CAAI,EAC7B,OAAO,EAIX,MAAO,EACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-last-index.js","names":[],"sources":["../src/find-last-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(data, predicate)\n * @example\n * findLastIndex([1, 3, 4, 6], n => n % 2 === 1) // => 1\n * @dataFirst\n * @category Array\n */\nexport function findLastIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(fn)(items)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLastIndex(n => n % 2 === 1)\n * ) // => 1\n * @dataLast\n * @category Array\n */\nexport function findLastIndex<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (array: ReadonlyArray<T>) => number;\n\nexport function findLastIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastIndexImplementation, args);\n}\n\nfunction findLastIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean): number {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLastIndex` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n if (predicate(data[i]!, i, data)) {\n return i;\n }\n }\n\n return -1;\n}\n"],"mappings":"mCAuDA,SAAgB,EAAc,GAAG,EAAuC,CACtE,OAAO,EAAM,EAA6B,
|
|
1
|
+
{"version":3,"file":"find-last-index.js","names":[],"sources":["../src/find-last-index.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(data, predicate)\n * @example\n * findLastIndex([1, 3, 4, 6], n => n % 2 === 1) // => 1\n * @dataFirst\n * @category Array\n */\nexport function findLastIndex<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): number;\n\n/**\n * Iterates the array in reverse order and returns the index of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, -1 is returned.\n *\n * See also `findLast` which returns the value of last element that satisfies\n * the testing function (rather than its index).\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise.\n * @returns The index of the last (highest-index) element in the array that\n * passes the test. Otherwise -1 if no matching element is found.\n * @signature\n * findLastIndex(fn)(items)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLastIndex(n => n % 2 === 1)\n * ) // => 1\n * @dataLast\n * @category Array\n */\nexport function findLastIndex<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (array: ReadonlyArray<T>) => number;\n\nexport function findLastIndex(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastIndexImplementation, args);\n}\n\nfunction findLastIndexImplementation<T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean): number {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLastIndex` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n if (predicate(data[i]!, i, data)) {\n return i;\n }\n }\n\n return -1;\n}\n"],"mappings":"mCAuDA,SAAgB,EAAc,GAAG,EAAuC,CACtE,OAAO,EAAM,EAA6B,CAAI,CAChD,CAEA,SAAS,EAA+B,EAAwB,EAAiF,CAG/I,IAAK,IAAI,EAAI,EAAK,OAAS,EAAG,GAAK,EAAG,IACpC,GAAI,EAAU,EAAK,GAAK,EAAG,CAAI,EAC7B,OAAO,EAIX,MAAO,EACT"}
|
package/dist/find-last.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){for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}}exports.findLast=t;
|
|
2
2
|
//# sourceMappingURL=find-last.cjs.map
|
package/dist/find-last.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-last.cjs","names":["curry"],"sources":["../src/find-last.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(data, predicate)\n * @example\n * findLast([1, 3, 4, 6], n => n % 2 === 1) // => 3\n * @dataFirst\n * @category Array\n */\nexport function findLast<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function findLast<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLast(n => n % 2 === 1)\n * ) // => 3\n * @dataLast\n * @category Array\n */\nexport function findLast<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function findLast<T = never>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function findLast(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastImplementation, args);\n}\n\nfunction findLastImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLast` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n const item = data[i]!;\n if (predicate(item, i, data)) {\n return item;\n }\n }\n\n return undefined;\n}\n"],"mappings":"kGAwEA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAOA,EAAAA,MAAM,EAAwB,
|
|
1
|
+
{"version":3,"file":"find-last.cjs","names":["curry"],"sources":["../src/find-last.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(data, predicate)\n * @example\n * findLast([1, 3, 4, 6], n => n % 2 === 1) // => 3\n * @dataFirst\n * @category Array\n */\nexport function findLast<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function findLast<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLast(n => n % 2 === 1)\n * ) // => 3\n * @dataLast\n * @category Array\n */\nexport function findLast<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function findLast<T = never>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function findLast(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastImplementation, args);\n}\n\nfunction findLastImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLast` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n const item = data[i]!;\n if (predicate(item, i, data)) {\n return item;\n }\n }\n\n return undefined;\n}\n"],"mappings":"kGAwEA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAOA,EAAAA,MAAM,EAAwB,CAAI,CAC3C,CAEA,SAAS,EAAuC,EAAwB,EAA2F,CAGjK,IAAK,IAAI,EAAI,EAAK,OAAS,EAAG,GAAK,EAAG,IAAK,CACzC,IAAM,EAAO,EAAK,GAClB,GAAI,EAAU,EAAM,EAAG,CAAI,EACzB,OAAO,CAEX,CAGF"}
|
package/dist/find-last.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-last.js","names":[],"sources":["../src/find-last.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(data, predicate)\n * @example\n * findLast([1, 3, 4, 6], n => n % 2 === 1) // => 3\n * @dataFirst\n * @category Array\n */\nexport function findLast<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function findLast<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLast(n => n % 2 === 1)\n * ) // => 3\n * @dataLast\n * @category Array\n */\nexport function findLast<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function findLast<T = never>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function findLast(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastImplementation, args);\n}\n\nfunction findLastImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLast` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n const item = data[i]!;\n if (predicate(item, i, data)) {\n return item;\n }\n }\n\n return undefined;\n}\n"],"mappings":"mCAwEA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAO,EAAM,EAAwB,
|
|
1
|
+
{"version":3,"file":"find-last.js","names":[],"sources":["../src/find-last.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(data, predicate)\n * @example\n * findLast([1, 3, 4, 6], n => n % 2 === 1) // => 3\n * @dataFirst\n * @category Array\n */\nexport function findLast<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function findLast<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Iterates the array in reverse order and returns the value of the first\n * element that satisfies the provided testing function. If no elements satisfy\n * the testing function, undefined is returned.\n *\n * Similar functions:\n * `find` - If you need the first element that satisfies the provided testing function.\n * `findLastIndex` - If you need the index of the found element in the array.\n * `lastIndexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The last (highest-index) element in the array that satisfies the\n * provided testing function; undefined if no matching element is found.\n * @signature\n * findLast(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * findLast(n => n % 2 === 1)\n * ) // => 3\n * @dataLast\n * @category Array\n */\nexport function findLast<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function findLast<T = never>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function findLast(...args: ReadonlyArray<unknown>): unknown {\n return curry(findLastImplementation, args);\n}\n\nfunction findLastImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n // TODO [>2]: When node 18 reaches end-of-life bump target lib to ES2023+ and use `Array.prototype.findLast` here.\n\n for (let i = data.length - 1; i >= 0; i--) {\n const item = data[i]!;\n if (predicate(item, i, data)) {\n return item;\n }\n }\n\n return undefined;\n}\n"],"mappings":"mCAwEA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAO,EAAM,EAAwB,CAAI,CAC3C,CAEA,SAAS,EAAuC,EAAwB,EAA2F,CAGjK,IAAK,IAAI,EAAI,EAAK,OAAS,EAAG,GAAK,EAAG,IAAK,CACzC,IAAM,EAAO,EAAK,GAClB,GAAI,EAAU,EAAM,EAAG,CAAI,EACzB,OAAO,CAEX,CAGF"}
|
package/dist/find.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("./utility-evaluators-BGM19SpK.cjs"),n=require("./to-single-BOkjnmkm.cjs");function r(...t){return e.curry(i,t,n.t(a))}function i(e,t){return e.find(t)}function a(e){return(n,r,i)=>e(n,r,i)?{done:!0,hasNext:!0,next:n}:t.t}exports.find=r;
|
|
2
2
|
//# sourceMappingURL=find.cjs.map
|
package/dist/find.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.cjs","names":["curry","toSingle","SKIP_ITEM"],"sources":["../src/find.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(data, predicate)\n * @example\n * find([1, 3, 4, 6], n => n % 2 === 0) // => 4\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function find<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * find(n => n % 2 === 0)\n * ) // => 4\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function find<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function find(...args: ReadonlyArray<unknown>): unknown {\n return curry(findImplementation, args, toSingle(lazyImplementation));\n}\n\nfunction findImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n return data.find(predicate);\n}\n\nfunction lazyImplementation<T, S extends T>(predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): LazyEvaluator<T, S> {\n return (value, index, data) =>\n predicate(value, index, data)\n ? { done: true, hasNext: true, next: value }\n : SKIP_ITEM;\n}\n"],"mappings":"uLA6EA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAOA,EAAAA,MAAM,EAAoB,EAAMC,EAAAA,EAAS,
|
|
1
|
+
{"version":3,"file":"find.cjs","names":["curry","toSingle","SKIP_ITEM"],"sources":["../src/find.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(data, predicate)\n * @example\n * find([1, 3, 4, 6], n => n % 2 === 0) // => 4\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function find<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * find(n => n % 2 === 0)\n * ) // => 4\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function find<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function find(...args: ReadonlyArray<unknown>): unknown {\n return curry(findImplementation, args, toSingle(lazyImplementation));\n}\n\nfunction findImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n return data.find(predicate);\n}\n\nfunction lazyImplementation<T, S extends T>(predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): LazyEvaluator<T, S> {\n return (value, index, data) =>\n predicate(value, index, data)\n ? { done: true, hasNext: true, next: value }\n : SKIP_ITEM;\n}\n"],"mappings":"uLA6EA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAOA,EAAAA,MAAM,EAAoB,EAAMC,EAAAA,EAAS,CAAkB,CAAC,CACrE,CAEA,SAAS,EAAmC,EAAwB,EAA2F,CAC7J,OAAO,EAAK,KAAK,CAAS,CAC5B,CAEA,SAAS,EAAmC,EAAiG,CAC3I,OAAQ,EAAO,EAAO,IACpB,EAAU,EAAO,EAAO,CAAI,EACxB,CAAE,KAAM,GAAM,QAAS,GAAM,KAAM,CAAM,EACzCC,EAAAA,CACR"}
|
package/dist/find.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{curry as e}from"./curry.js";import{t}from"./utility-evaluators-
|
|
1
|
+
import{curry as e}from"./curry.js";import{t}from"./utility-evaluators-DDW55xeL.js";import{t as n}from"./to-single-D6t2BxVq.js";function r(...t){return e(i,t,n(a))}function i(e,t){return e.find(t)}function a(e){return(n,r,i)=>e(n,r,i)?{done:!0,hasNext:!0,next:n}:t}export{r as find};
|
|
2
2
|
//# sourceMappingURL=find.js.map
|
package/dist/find.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","names":[],"sources":["../src/find.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(data, predicate)\n * @example\n * find([1, 3, 4, 6], n => n % 2 === 0) // => 4\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function find<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * find(n => n % 2 === 0)\n * ) // => 4\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function find<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function find(...args: ReadonlyArray<unknown>): unknown {\n return curry(findImplementation, args, toSingle(lazyImplementation));\n}\n\nfunction findImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n return data.find(predicate);\n}\n\nfunction lazyImplementation<T, S extends T>(predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): LazyEvaluator<T, S> {\n return (value, index, data) =>\n predicate(value, index, data)\n ? { done: true, hasNext: true, next: value }\n : SKIP_ITEM;\n}\n"],"mappings":"+HA6EA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAO,EAAM,EAAoB,EAAM,EAAS,
|
|
1
|
+
{"version":3,"file":"find.js","names":[],"sources":["../src/find.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param data - The items to search in.\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(data, predicate)\n * @example\n * find([1, 3, 4, 6], n => n % 2 === 0) // => 4\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): S | undefined;\nexport function find<T>(\n data: ReadonlyArray<T>,\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): T | undefined;\n\n/**\n * Returns the first element in the provided array that satisfies the provided\n * testing function. If no values satisfy the testing function, `undefined` is\n * returned.\n *\n * Similar functions:\n * `findLast` - If you need the last element that satisfies the provided testing function.\n * `findIndex` - If you need the index of the found element in the array.\n * `indexOf` - If you need to find the index of a value.\n * `includes` - If you need to find if a value exists in an array.\n * `some` - If you need to find if any element satisfies the provided testing function.\n * `filter` - If you need to find all elements that satisfy the provided testing function.\n *\n * @param predicate - A function to execute for each element in the array. It\n * should return `true` to indicate a matching element has been found, and\n * `false` otherwise. A type-predicate can also be used to narrow the result.\n * @returns The first element in the array that satisfies the provided testing\n * function. Otherwise, `undefined` is returned.\n * @signature\n * find(predicate)(data)\n * @example\n * pipe(\n * [1, 3, 4, 6],\n * find(n => n % 2 === 0)\n * ) // => 4\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function find<T, S extends T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,\n): (data: ReadonlyArray<T>) => S | undefined;\nexport function find<T>(\n predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,\n): (data: ReadonlyArray<T>) => T | undefined;\n\nexport function find(...args: ReadonlyArray<unknown>): unknown {\n return curry(findImplementation, args, toSingle(lazyImplementation));\n}\n\nfunction findImplementation<T, S extends T>(data: ReadonlyArray<T>, predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): S | undefined {\n return data.find(predicate);\n}\n\nfunction lazyImplementation<T, S extends T>(predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S): LazyEvaluator<T, S> {\n return (value, index, data) =>\n predicate(value, index, data)\n ? { done: true, hasNext: true, next: value }\n : SKIP_ITEM;\n}\n"],"mappings":"+HA6EA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAO,EAAM,EAAoB,EAAM,EAAS,CAAkB,CAAC,CACrE,CAEA,SAAS,EAAmC,EAAwB,EAA2F,CAC7J,OAAO,EAAK,KAAK,CAAS,CAC5B,CAEA,SAAS,EAAmC,EAAiG,CAC3I,OAAQ,EAAO,EAAO,IACpB,EAAU,EAAO,EAAO,CAAI,EACxB,CAAE,KAAM,GAAM,QAAS,GAAM,KAAM,CAAM,EACzC,CACR"}
|
package/dist/first-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-order-rules-CacOTzfW.cjs"),t=require("./has-at-least.cjs");function n(...t){return e.t(r,t)}function r(e,n){if(!t.hasAtLeast(e,2))return e[0];let[r]=e,[,...i]=e;for(let e of i)n(e,r)<0&&(r=e);return r}exports.firstBy=n;
|
|
2
2
|
//# sourceMappingURL=first-by.cjs.map
|
package/dist/first-by.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-by.cjs","names":["curryOrderRules","hasAtLeast"],"sources":["../src/first-by.ts"],"sourcesContent":["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 { hasAtLeast } from './has-at-least';\nimport { curryOrderRules } from './internal/curry-order-rules';\n\ntype FirstBy<T extends IterableContainer>\n = | T[number]\n | (T extends readonly [unknown, ...(ReadonlyArray<unknown>)]\n ? never\n : T extends readonly [...(ReadonlyArray<unknown>), unknown]\n ? never\n : undefined);\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(...rules)(data);\n * @example\n * const max = pipe([1,2,3], firstBy([identity(), \"desc\"])); // => 3;\n * const min = pipe([1,2,3], firstBy(identity())); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = pipe(data, firstBy([(item) => item.a.length, \"desc\"])); // => { a: \"aaa\" };\n * const minBy = pipe(data, firstBy((item) => item.a.length)); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = pipe(data, firstBy(prop('type'), [prop('size'), 'desc'])); // => {type: \"cat\", size: 2}\n * @dataLast\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): (data: T) => FirstBy<T>;\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\n * @param data - An array of items.\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(data, ...rules);\n * @example\n * const max = firstBy([1,2,3], [identity(), \"desc\"]); // => 3;\n * const min = firstBy([1,2,3], identity()); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = firstBy(data, [(item) => item.a.length, \"desc\"]); // => { a: \"aaa\" };\n * const minBy = firstBy(data, (item) => item.a.length); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = firstBy(data, prop('type'), [prop('size'), 'desc']); // => {type: \"cat\", size: 2}\n * @dataFirst\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n data: T,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): FirstBy<T>;\n\nexport function firstBy(...args: ReadonlyArray<unknown>): unknown {\n return curryOrderRules(firstByImplementation, args);\n}\n\nfunction firstByImplementation<T>(\n data: ReadonlyArray<T>,\n compareFn: CompareFunction<T>,\n): T | undefined {\n if (!hasAtLeast(data, 2)) {\n // If we have 0 or 1 item we simply return the trivial result.\n return data[0];\n }\n\n let [currentFirst] = data;\n\n // Remove the first item, we won't compare it with itself.\n const [, ...rest] = data;\n for (const item of rest) {\n if (compareFn(item, currentFirst) < 0) {\n // item comes before currentFirst in the order.\n currentFirst = item;\n }\n }\n\n return currentFirst;\n}\n"],"mappings":"uJAyEA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAOA,EAAAA,EAAgB,EAAuB,
|
|
1
|
+
{"version":3,"file":"first-by.cjs","names":["curryOrderRules","hasAtLeast"],"sources":["../src/first-by.ts"],"sourcesContent":["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 { hasAtLeast } from './has-at-least';\nimport { curryOrderRules } from './internal/curry-order-rules';\n\ntype FirstBy<T extends IterableContainer>\n = | T[number]\n | (T extends readonly [unknown, ...(ReadonlyArray<unknown>)]\n ? never\n : T extends readonly [...(ReadonlyArray<unknown>), unknown]\n ? never\n : undefined);\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(...rules)(data);\n * @example\n * const max = pipe([1,2,3], firstBy([identity(), \"desc\"])); // => 3;\n * const min = pipe([1,2,3], firstBy(identity())); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = pipe(data, firstBy([(item) => item.a.length, \"desc\"])); // => { a: \"aaa\" };\n * const minBy = pipe(data, firstBy((item) => item.a.length)); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = pipe(data, firstBy(prop('type'), [prop('size'), 'desc'])); // => {type: \"cat\", size: 2}\n * @dataLast\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): (data: T) => FirstBy<T>;\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\n * @param data - An array of items.\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(data, ...rules);\n * @example\n * const max = firstBy([1,2,3], [identity(), \"desc\"]); // => 3;\n * const min = firstBy([1,2,3], identity()); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = firstBy(data, [(item) => item.a.length, \"desc\"]); // => { a: \"aaa\" };\n * const minBy = firstBy(data, (item) => item.a.length); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = firstBy(data, prop('type'), [prop('size'), 'desc']); // => {type: \"cat\", size: 2}\n * @dataFirst\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n data: T,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): FirstBy<T>;\n\nexport function firstBy(...args: ReadonlyArray<unknown>): unknown {\n return curryOrderRules(firstByImplementation, args);\n}\n\nfunction firstByImplementation<T>(\n data: ReadonlyArray<T>,\n compareFn: CompareFunction<T>,\n): T | undefined {\n if (!hasAtLeast(data, 2)) {\n // If we have 0 or 1 item we simply return the trivial result.\n return data[0];\n }\n\n let [currentFirst] = data;\n\n // Remove the first item, we won't compare it with itself.\n const [, ...rest] = data;\n for (const item of rest) {\n if (compareFn(item, currentFirst) < 0) {\n // item comes before currentFirst in the order.\n currentFirst = item;\n }\n }\n\n return currentFirst;\n}\n"],"mappings":"uJAyEA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAOA,EAAAA,EAAgB,EAAuB,CAAI,CACpD,CAEA,SAAS,EACP,EACA,EACe,CACf,GAAI,CAACC,EAAAA,WAAW,EAAM,CAAC,EAErB,OAAO,EAAK,GAGd,GAAI,CAAC,GAAgB,EAGf,EAAG,GAAG,GAAQ,EACpB,IAAK,IAAM,KAAQ,EACb,EAAU,EAAM,CAAY,EAAI,IAElC,EAAe,GAInB,OAAO,CACT"}
|
package/dist/first-by.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./curry-order-rules-
|
|
1
|
+
import{t as e}from"./curry-order-rules-Dage-BeC.js";import{hasAtLeast as t}from"./has-at-least.js";function n(...t){return e(r,t)}function r(e,n){if(!t(e,2))return e[0];let[r]=e,[,...i]=e;for(let e of i)n(e,r)<0&&(r=e);return r}export{n as firstBy};
|
|
2
2
|
//# sourceMappingURL=first-by.js.map
|
package/dist/first-by.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-by.js","names":[],"sources":["../src/first-by.ts"],"sourcesContent":["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 { hasAtLeast } from './has-at-least';\nimport { curryOrderRules } from './internal/curry-order-rules';\n\ntype FirstBy<T extends IterableContainer>\n = | T[number]\n | (T extends readonly [unknown, ...(ReadonlyArray<unknown>)]\n ? never\n : T extends readonly [...(ReadonlyArray<unknown>), unknown]\n ? never\n : undefined);\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(...rules)(data);\n * @example\n * const max = pipe([1,2,3], firstBy([identity(), \"desc\"])); // => 3;\n * const min = pipe([1,2,3], firstBy(identity())); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = pipe(data, firstBy([(item) => item.a.length, \"desc\"])); // => { a: \"aaa\" };\n * const minBy = pipe(data, firstBy((item) => item.a.length)); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = pipe(data, firstBy(prop('type'), [prop('size'), 'desc'])); // => {type: \"cat\", size: 2}\n * @dataLast\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): (data: T) => FirstBy<T>;\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\n * @param data - An array of items.\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(data, ...rules);\n * @example\n * const max = firstBy([1,2,3], [identity(), \"desc\"]); // => 3;\n * const min = firstBy([1,2,3], identity()); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = firstBy(data, [(item) => item.a.length, \"desc\"]); // => { a: \"aaa\" };\n * const minBy = firstBy(data, (item) => item.a.length); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = firstBy(data, prop('type'), [prop('size'), 'desc']); // => {type: \"cat\", size: 2}\n * @dataFirst\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n data: T,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): FirstBy<T>;\n\nexport function firstBy(...args: ReadonlyArray<unknown>): unknown {\n return curryOrderRules(firstByImplementation, args);\n}\n\nfunction firstByImplementation<T>(\n data: ReadonlyArray<T>,\n compareFn: CompareFunction<T>,\n): T | undefined {\n if (!hasAtLeast(data, 2)) {\n // If we have 0 or 1 item we simply return the trivial result.\n return data[0];\n }\n\n let [currentFirst] = data;\n\n // Remove the first item, we won't compare it with itself.\n const [, ...rest] = data;\n for (const item of rest) {\n if (compareFn(item, currentFirst) < 0) {\n // item comes before currentFirst in the order.\n currentFirst = item;\n }\n }\n\n return currentFirst;\n}\n"],"mappings":"mGAyEA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAO,EAAgB,EAAuB,
|
|
1
|
+
{"version":3,"file":"first-by.js","names":[],"sources":["../src/first-by.ts"],"sourcesContent":["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 { hasAtLeast } from './has-at-least';\nimport { curryOrderRules } from './internal/curry-order-rules';\n\ntype FirstBy<T extends IterableContainer>\n = | T[number]\n | (T extends readonly [unknown, ...(ReadonlyArray<unknown>)]\n ? never\n : T extends readonly [...(ReadonlyArray<unknown>), unknown]\n ? never\n : undefined);\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(...rules)(data);\n * @example\n * const max = pipe([1,2,3], firstBy([identity(), \"desc\"])); // => 3;\n * const min = pipe([1,2,3], firstBy(identity())); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = pipe(data, firstBy([(item) => item.a.length, \"desc\"])); // => { a: \"aaa\" };\n * const minBy = pipe(data, firstBy((item) => item.a.length)); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = pipe(data, firstBy(prop('type'), [prop('size'), 'desc'])); // => {type: \"cat\", size: 2}\n * @dataLast\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): (data: T) => FirstBy<T>;\n\n/**\n * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining \"tie-breaker\" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `first(sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.\n *\n * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.\n *\n * @param data - An array of items.\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 first element by the order criteria, or `undefined` if the array\n * is empty. (The function provides strong typing if the input type assures the\n * array isn't empty).\n * @signature\n * firstBy(data, ...rules);\n * @example\n * const max = firstBy([1,2,3], [identity(), \"desc\"]); // => 3;\n * const min = firstBy([1,2,3], identity()); // => 1;\n *\n * const data = [{ a: \"a\" }, { a: \"aa\" }, { a: \"aaa\" }] as const;\n * const maxBy = firstBy(data, [(item) => item.a.length, \"desc\"]); // => { a: \"aaa\" };\n * const minBy = firstBy(data, (item) => item.a.length); // => { a: \"a\" };\n *\n * const data = [{type: \"cat\", size: 1}, {type: \"cat\", size: 2}, {type: \"dog\", size: 3}] as const;\n * const multi = firstBy(data, prop('type'), [prop('size'), 'desc']); // => {type: \"cat\", size: 2}\n * @dataFirst\n * @category Array\n */\nexport function firstBy<T extends IterableContainer>(\n data: T,\n ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>\n): FirstBy<T>;\n\nexport function firstBy(...args: ReadonlyArray<unknown>): unknown {\n return curryOrderRules(firstByImplementation, args);\n}\n\nfunction firstByImplementation<T>(\n data: ReadonlyArray<T>,\n compareFn: CompareFunction<T>,\n): T | undefined {\n if (!hasAtLeast(data, 2)) {\n // If we have 0 or 1 item we simply return the trivial result.\n return data[0];\n }\n\n let [currentFirst] = data;\n\n // Remove the first item, we won't compare it with itself.\n const [, ...rest] = data;\n for (const item of rest) {\n if (compareFn(item, currentFirst) < 0) {\n // item comes before currentFirst in the order.\n currentFirst = item;\n }\n }\n\n return currentFirst;\n}\n"],"mappings":"mGAyEA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAO,EAAgB,EAAuB,CAAI,CACpD,CAEA,SAAS,EACP,EACA,EACe,CACf,GAAI,CAAC,EAAW,EAAM,CAAC,EAErB,OAAO,EAAK,GAGd,GAAI,CAAC,GAAgB,EAGf,EAAG,GAAG,GAAQ,EACpB,IAAK,IAAM,KAAQ,EACb,EAAU,EAAM,CAAY,EAAI,IAElC,EAAe,GAInB,OAAO,CACT"}
|
package/dist/first.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("./to-single-BOkjnmkm.cjs");function n(...n){return e.curry(r,n,t.t(i))}const r=([e])=>e,i=()=>a;function a(e){return{hasNext:!0,next:e,done:!0}}exports.first=n;
|
|
2
2
|
//# sourceMappingURL=first.cjs.map
|
package/dist/first.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first.cjs","names":["curry","toSingle"],"sources":["../src/first.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\n\ntype First<T extends IterableContainer> = T extends []\n ? undefined\n : T extends readonly [unknown, ...Array<unknown>]\n ? T[0]\n : T extends readonly [...infer Pre, infer Last]\n ? Last | Pre[0]\n : T[0] | undefined;\n\n/**\n * Gets the first element of `array`.\n *\n * @param data - The array.\n * @returns The first element of the array.\n * @signature\n * first(array)\n * @example\n * first([1, 2, 3]) // => 1\n * first([]) // => undefined\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function first<T extends IterableContainer>(data: T): First<T>;\n\n/**\n * Gets the first element of `array`.\n *\n * @returns The first element of the array.\n * @signature\n * first()(array)\n * @example\n * pipe(\n * [1, 2, 4, 8, 16],\n * filter(x => x > 3),\n * first(),\n * x => x + 1\n * ); // => 5\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function first(): <T extends IterableContainer>(data: T) => First<T>;\n\nexport function first(...args: ReadonlyArray<unknown>): unknown {\n return curry(firstImplementation, args, toSingle(lazyImplementation));\n}\n\nconst firstImplementation = <T>([item]: ReadonlyArray<T>): T | undefined => item;\n\nconst lazyImplementation = (): LazyEvaluator => firstLazy;\n\nfunction firstLazy<T>(value: T) {\n return ({ hasNext: true, next: value, done: true }) as const;\n}\n"],"mappings":"wIAgDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAM,EAAqB,EAAMC,EAAAA,EAAS,
|
|
1
|
+
{"version":3,"file":"first.cjs","names":["curry","toSingle"],"sources":["../src/first.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\n\ntype First<T extends IterableContainer> = T extends []\n ? undefined\n : T extends readonly [unknown, ...Array<unknown>]\n ? T[0]\n : T extends readonly [...infer Pre, infer Last]\n ? Last | Pre[0]\n : T[0] | undefined;\n\n/**\n * Gets the first element of `array`.\n *\n * @param data - The array.\n * @returns The first element of the array.\n * @signature\n * first(array)\n * @example\n * first([1, 2, 3]) // => 1\n * first([]) // => undefined\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function first<T extends IterableContainer>(data: T): First<T>;\n\n/**\n * Gets the first element of `array`.\n *\n * @returns The first element of the array.\n * @signature\n * first()(array)\n * @example\n * pipe(\n * [1, 2, 4, 8, 16],\n * filter(x => x > 3),\n * first(),\n * x => x + 1\n * ); // => 5\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function first(): <T extends IterableContainer>(data: T) => First<T>;\n\nexport function first(...args: ReadonlyArray<unknown>): unknown {\n return curry(firstImplementation, args, toSingle(lazyImplementation));\n}\n\nconst firstImplementation = <T>([item]: ReadonlyArray<T>): T | undefined => item;\n\nconst lazyImplementation = (): LazyEvaluator => firstLazy;\n\nfunction firstLazy<T>(value: T) {\n return ({ hasNext: true, next: value, done: true }) as const;\n}\n"],"mappings":"wIAgDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAM,EAAqB,EAAMC,EAAAA,EAAS,CAAkB,CAAC,CACtE,CAEA,MAAM,GAA0B,CAAC,KAA2C,EAEtE,MAA0C,EAEhD,SAAS,EAAa,EAAU,CAC9B,MAAQ,CAAE,QAAS,GAAM,KAAM,EAAO,KAAM,EAAK,CACnD"}
|
package/dist/first.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{curry as e}from"./curry.js";import{t}from"./to-single-
|
|
1
|
+
import{curry as e}from"./curry.js";import{t}from"./to-single-D6t2BxVq.js";function n(...n){return e(r,n,t(i))}const r=([e])=>e,i=()=>a;function a(e){return{hasNext:!0,next:e,done:!0}}export{n as first};
|
|
2
2
|
//# sourceMappingURL=first.js.map
|
package/dist/first.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first.js","names":[],"sources":["../src/first.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\n\ntype First<T extends IterableContainer> = T extends []\n ? undefined\n : T extends readonly [unknown, ...Array<unknown>]\n ? T[0]\n : T extends readonly [...infer Pre, infer Last]\n ? Last | Pre[0]\n : T[0] | undefined;\n\n/**\n * Gets the first element of `array`.\n *\n * @param data - The array.\n * @returns The first element of the array.\n * @signature\n * first(array)\n * @example\n * first([1, 2, 3]) // => 1\n * first([]) // => undefined\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function first<T extends IterableContainer>(data: T): First<T>;\n\n/**\n * Gets the first element of `array`.\n *\n * @returns The first element of the array.\n * @signature\n * first()(array)\n * @example\n * pipe(\n * [1, 2, 4, 8, 16],\n * filter(x => x > 3),\n * first(),\n * x => x + 1\n * ); // => 5\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function first(): <T extends IterableContainer>(data: T) => First<T>;\n\nexport function first(...args: ReadonlyArray<unknown>): unknown {\n return curry(firstImplementation, args, toSingle(lazyImplementation));\n}\n\nconst firstImplementation = <T>([item]: ReadonlyArray<T>): T | undefined => item;\n\nconst lazyImplementation = (): LazyEvaluator => firstLazy;\n\nfunction firstLazy<T>(value: T) {\n return ({ hasNext: true, next: value, done: true }) as const;\n}\n"],"mappings":"0EAgDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAqB,EAAM,EAAS,
|
|
1
|
+
{"version":3,"file":"first.js","names":[],"sources":["../src/first.ts"],"sourcesContent":["import type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\nimport { toSingle } from './internal/to-single';\n\ntype First<T extends IterableContainer> = T extends []\n ? undefined\n : T extends readonly [unknown, ...Array<unknown>]\n ? T[0]\n : T extends readonly [...infer Pre, infer Last]\n ? Last | Pre[0]\n : T[0] | undefined;\n\n/**\n * Gets the first element of `array`.\n *\n * @param data - The array.\n * @returns The first element of the array.\n * @signature\n * first(array)\n * @example\n * first([1, 2, 3]) // => 1\n * first([]) // => undefined\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function first<T extends IterableContainer>(data: T): First<T>;\n\n/**\n * Gets the first element of `array`.\n *\n * @returns The first element of the array.\n * @signature\n * first()(array)\n * @example\n * pipe(\n * [1, 2, 4, 8, 16],\n * filter(x => x > 3),\n * first(),\n * x => x + 1\n * ); // => 5\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function first(): <T extends IterableContainer>(data: T) => First<T>;\n\nexport function first(...args: ReadonlyArray<unknown>): unknown {\n return curry(firstImplementation, args, toSingle(lazyImplementation));\n}\n\nconst firstImplementation = <T>([item]: ReadonlyArray<T>): T | undefined => item;\n\nconst lazyImplementation = (): LazyEvaluator => firstLazy;\n\nfunction firstLazy<T>(value: T) {\n return ({ hasNext: true, next: value, done: true }) as const;\n}\n"],"mappings":"0EAgDA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAqB,EAAM,EAAS,CAAkB,CAAC,CACtE,CAEA,MAAM,GAA0B,CAAC,KAA2C,EAEtE,MAA0C,EAEhD,SAAS,EAAa,EAAU,CAC9B,MAAQ,CAAE,QAAS,GAAM,KAAM,EAAO,KAAM,EAAK,CACnD"}
|
package/dist/flat-map.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,r)}function n(e,t){return e.flatMap(t)}function r(e){return(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}}}exports.flatMap=t;
|
|
2
2
|
//# sourceMappingURL=flat-map.cjs.map
|
package/dist/flat-map.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat-map.cjs","names":["curry"],"sources":["../src/flat-map.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param data - The items to map and flatten.\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(data, callbackfn)\n * @example\n * flatMap([1, 2, 3], x => [x, x * 10]) // => [1, 10, 2, 20, 3, 30]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n data: ReadonlyArray<T>,\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): Array<U>;\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(callbackfn)(data)\n * @example\n * pipe([1, 2, 3], flatMap(x => [x, x * 10])) // => [1, 10, 2, 20, 3, 30]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): (data: ReadonlyArray<T>) => Array<U>;\n\nexport function flatMap(...args: ReadonlyArray<unknown>): unknown {\n return curry(flatMapImplementation, args, lazyImplementation);\n}\n\nfunction flatMapImplementation<T, U>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U): Array<U> {\n return data.flatMap(callbackfn);\n}\n\nfunction lazyImplementation<T, K>(callbackfn: (\n input: T,\n index: number,\n data: ReadonlyArray<T>,\n) => K | ReadonlyArray<K>): LazyEvaluator<T, K> {\n return (value, index, data) => {\n const next = callbackfn(value, index, data);\n return Array.isArray(next)\n ? { done: false, hasNext: true, hasMany: true, next }\n : { done: false, hasNext: true, next };\n };\n}\n"],"mappings":"kGAqDA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAOA,EAAAA,MAAM,EAAuB,EAAM,
|
|
1
|
+
{"version":3,"file":"flat-map.cjs","names":["curry"],"sources":["../src/flat-map.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param data - The items to map and flatten.\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(data, callbackfn)\n * @example\n * flatMap([1, 2, 3], x => [x, x * 10]) // => [1, 10, 2, 20, 3, 30]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n data: ReadonlyArray<T>,\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): Array<U>;\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(callbackfn)(data)\n * @example\n * pipe([1, 2, 3], flatMap(x => [x, x * 10])) // => [1, 10, 2, 20, 3, 30]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): (data: ReadonlyArray<T>) => Array<U>;\n\nexport function flatMap(...args: ReadonlyArray<unknown>): unknown {\n return curry(flatMapImplementation, args, lazyImplementation);\n}\n\nfunction flatMapImplementation<T, U>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U): Array<U> {\n return data.flatMap(callbackfn);\n}\n\nfunction lazyImplementation<T, K>(callbackfn: (\n input: T,\n index: number,\n data: ReadonlyArray<T>,\n) => K | ReadonlyArray<K>): LazyEvaluator<T, K> {\n return (value, index, data) => {\n const next = callbackfn(value, index, data);\n return Array.isArray(next)\n ? { done: false, hasNext: true, hasMany: true, next }\n : { done: false, hasNext: true, next };\n };\n}\n"],"mappings":"kGAqDA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAOA,EAAAA,MAAM,EAAuB,EAAM,CAAkB,CAC9D,CAEA,SAAS,EAA4B,EAAwB,EAAiG,CAC5J,OAAO,EAAK,QAAQ,CAAU,CAChC,CAEA,SAAS,EAAyB,EAIc,CAC9C,OAAQ,EAAO,EAAO,IAAS,CAC7B,IAAM,EAAO,EAAW,EAAO,EAAO,CAAI,EAC1C,OAAO,MAAM,QAAQ,CAAI,EACrB,CAAE,KAAM,GAAO,QAAS,GAAM,QAAS,GAAM,MAAK,EAClD,CAAE,KAAM,GAAO,QAAS,GAAM,MAAK,CACzC,CACF"}
|
package/dist/flat-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat-map.js","names":[],"sources":["../src/flat-map.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param data - The items to map and flatten.\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(data, callbackfn)\n * @example\n * flatMap([1, 2, 3], x => [x, x * 10]) // => [1, 10, 2, 20, 3, 30]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n data: ReadonlyArray<T>,\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): Array<U>;\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(callbackfn)(data)\n * @example\n * pipe([1, 2, 3], flatMap(x => [x, x * 10])) // => [1, 10, 2, 20, 3, 30]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): (data: ReadonlyArray<T>) => Array<U>;\n\nexport function flatMap(...args: ReadonlyArray<unknown>): unknown {\n return curry(flatMapImplementation, args, lazyImplementation);\n}\n\nfunction flatMapImplementation<T, U>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U): Array<U> {\n return data.flatMap(callbackfn);\n}\n\nfunction lazyImplementation<T, K>(callbackfn: (\n input: T,\n index: number,\n data: ReadonlyArray<T>,\n) => K | ReadonlyArray<K>): LazyEvaluator<T, K> {\n return (value, index, data) => {\n const next = callbackfn(value, index, data);\n return Array.isArray(next)\n ? { done: false, hasNext: true, hasMany: true, next }\n : { done: false, hasNext: true, next };\n };\n}\n"],"mappings":"mCAqDA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAO,EAAM,EAAuB,EAAM,
|
|
1
|
+
{"version":3,"file":"flat-map.js","names":[],"sources":["../src/flat-map.ts"],"sourcesContent":["import type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curry } from './curry';\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param data - The items to map and flatten.\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(data, callbackfn)\n * @example\n * flatMap([1, 2, 3], x => [x, x * 10]) // => [1, 10, 2, 20, 3, 30]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n data: ReadonlyArray<T>,\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): Array<U>;\n\n/**\n * Returns a new array formed by applying a given callback function to each\n * element of the array, and then flattening the result by one level. It is\n * identical to a `map` followed by a `flat` of depth 1\n * (`flat(map(data, ...args))`), but slightly more efficient than calling those\n * two methods separately. Equivalent to `Array.prototype.flatMap`.\n *\n * @param callbackfn - A function to execute for each element in the array. It\n * should return an array containing new elements of the new array, or a single\n * non-array value to be added to the new array.\n * @returns A new array with each element being the result of the callback\n * function and flattened by a depth of 1.\n * @signature\n * flatMap(callbackfn)(data)\n * @example\n * pipe([1, 2, 3], flatMap(x => [x, x * 10])) // => [1, 10, 2, 20, 3, 30]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flatMap<T, U>(\n callbackfn: (input: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U,\n): (data: ReadonlyArray<T>) => Array<U>;\n\nexport function flatMap(...args: ReadonlyArray<unknown>): unknown {\n return curry(flatMapImplementation, args, lazyImplementation);\n}\n\nfunction flatMapImplementation<T, U>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => ReadonlyArray<U> | U): Array<U> {\n return data.flatMap(callbackfn);\n}\n\nfunction lazyImplementation<T, K>(callbackfn: (\n input: T,\n index: number,\n data: ReadonlyArray<T>,\n) => K | ReadonlyArray<K>): LazyEvaluator<T, K> {\n return (value, index, data) => {\n const next = callbackfn(value, index, data);\n return Array.isArray(next)\n ? { done: false, hasNext: true, hasMany: true, next }\n : { done: false, hasNext: true, next };\n };\n}\n"],"mappings":"mCAqDA,SAAgB,EAAQ,GAAG,EAAuC,CAChE,OAAO,EAAM,EAAuB,EAAM,CAAkB,CAC9D,CAEA,SAAS,EAA4B,EAAwB,EAAiG,CAC5J,OAAO,EAAK,QAAQ,CAAU,CAChC,CAEA,SAAS,EAAyB,EAIc,CAC9C,OAAQ,EAAO,EAAO,IAAS,CAC7B,IAAM,EAAO,EAAW,EAAO,EAAO,CAAI,EAC1C,OAAO,MAAM,QAAQ,CAAI,EACrB,CAAE,KAAM,GAAO,QAAS,GAAM,QAAS,GAAM,MAAK,EAClD,CAAE,KAAM,GAAO,QAAS,GAAM,MAAK,CACzC,CACF"}
|
package/dist/flat.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("./lazy-data-last-impl-Dd5zjCfU.cjs"),t=require("./utility-evaluators-BGM19SpK.cjs");function n(t,n){return typeof t==`object`?r(t,n):e.t(r,t===void 0?[]:[t],i)}function r(e,t){return t===void 0?e.flat():e.flat(t)}function i(e){return e===void 0||e===1?a:e<=0?t.r:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1}}function a(e){return Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1}}exports.flat=n;
|
|
2
2
|
//# sourceMappingURL=flat.cjs.map
|
package/dist/flat.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat.cjs","names":["lazyDataLastImpl","lazyIdentityEvaluator"],"sources":["../src/flat.ts"],"sourcesContent":["import type { IsNumericLiteral } from 'type-fest';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport type { LazyResult } from './internal/types/lazy-result';\nimport { lazyDataLastImpl } from './internal/lazy-data-last-impl';\nimport { lazyIdentityEvaluator } from './internal/utility-evaluators';\n\ntype FlatArray<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n> = Depth extends Iteration['length']\n ? // Stopping condition for the recursion when the array is a tuple.\n T\n : T extends readonly []\n ? // Trivial result when the array is empty.\n []\n : T extends readonly [infer Item, ...infer Rest]\n ? // Tuples could be special-cased by \"iterating\" over each item\n // separately so that we maintain more information from the input type,\n // instead of putting all values in a union.\n [\n ...(Item extends IterableContainer\n ? // If the item itself is an array we continue going deeper\n FlatArray<Item, Depth, [...Iteration, unknown]>\n : // But if it isn't we add it to the output tuple\n [Item]),\n // And we merge this with the result from the rest of the tuple.\n ...FlatArray<Rest, Depth, Iteration>,\n ]\n : // For simple arrays we compute the item type, and wrap it with an\n // array.\n Array<FlatSimpleArrayItems<T, Depth, Iteration>>;\n\n// This type is based on the built-in type for `Array.prototype.flat` from the\n// ES2019 Array typescript library, but we improved it to handle any depth\n// (avoiding the fixed `20` in the built-in type).\n// @see https://github.com/microsoft/TypeScript/blob/main/src/lib/es2019.array.d.ts#L1-L5\ntype FlatSimpleArrayItems<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n IsDone extends boolean = false,\n> = {\n done: T;\n recur: T extends ReadonlyArray<infer InnerArr>\n ? FlatSimpleArrayItems<\n InnerArr,\n Depth,\n [...Iteration, unknown],\n // This trick allows us to continue 1 iteration more than the depth,\n // which is required to flatten the array up to depth.\n Iteration['length'] extends Depth ? true : false\n >\n : T;\n}[IsDone extends true ? 'done' : 'recur'];\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param data - The items to flatten.\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1. Non literal values (those typed as\n * `number`cannot be used. `Infinity`, `Number.POSITIVE_INFINITY` and\n * `Number.MAX_VALUE` are all typed as `number` and can't be used either. For\n * \"unlimited\" depth use a literal value that would exceed your expected\n * practical maximum nesting level.\n * @signature\n * flat(data)\n * flat(data, depth)\n * @example\n * flat([[1, 2], [3, 4], [5], [[6]]]); // => [1, 2, 3, 4, 5, [6]]\n * flat([[[1]], [[2]]], 2); // => [1, 2]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flat<T extends IterableContainer, Depth extends number = 1>(\n data: T,\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): FlatArray<T, Depth>;\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1.\n * @signature\n * flat()(data)\n * flat(depth)(data)\n * @example\n * pipe([[1, 2], [3, 4], [5], [[6]]], flat()); // => [1, 2, 3, 4, 5, [6]]\n * pipe([[[1]], [[2]]], flat(2)); // => [1, 2]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flat<Depth extends number = 1>(\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): <T extends IterableContainer>(data: T) => FlatArray<T, Depth>;\n\nexport function flat(\n dataOrDepth?: IterableContainer | number,\n depth?: number,\n): unknown {\n if (typeof dataOrDepth === 'object') {\n return flatImplementation(dataOrDepth, depth);\n }\n\n return lazyDataLastImpl(\n flatImplementation,\n dataOrDepth === undefined ? [] : [dataOrDepth],\n lazyImplementation,\n );\n}\n\nfunction flatImplementation(data: IterableContainer, depth?: number): IterableContainer {\n return depth === undefined ? data.flat() : data.flat(depth);\n}\n\nfunction lazyImplementation(depth?: number): LazyEvaluator {\n if (depth === undefined || depth === 1) {\n return lazyShallow;\n }\n\n if (depth <= 0) {\n return lazyIdentityEvaluator;\n }\n\n return (value) =>\n Array.isArray(value)\n ? {\n next: value.flat(depth - 1),\n hasNext: true,\n hasMany: true,\n done: false,\n }\n : { next: value, hasNext: true, done: false }; ;\n}\n\n// This function is pulled out so that we don't generate a new arrow function\n// each time. Because it doesn't need to run with recursion it could be pulled\n// out from the lazyImplementation and be reused for all invocations.\nfunction lazyShallow<T>(value: T): LazyResult<T> {\n return Array.isArray(value)\n ? { next: value, hasNext: true, hasMany: true, done: false }\n : { next: value, hasNext: true, done: false };\n}\n"],"mappings":"wKAyGA,SAAgB,EACd,EACA,EACS,CAKT,OAJI,OAAO,GAAgB,SAClB,EAAmB,EAAa,
|
|
1
|
+
{"version":3,"file":"flat.cjs","names":["lazyDataLastImpl","lazyIdentityEvaluator"],"sources":["../src/flat.ts"],"sourcesContent":["import type { IsNumericLiteral } from 'type-fest';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport type { LazyResult } from './internal/types/lazy-result';\nimport { lazyDataLastImpl } from './internal/lazy-data-last-impl';\nimport { lazyIdentityEvaluator } from './internal/utility-evaluators';\n\ntype FlatArray<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n> = Depth extends Iteration['length']\n ? // Stopping condition for the recursion when the array is a tuple.\n T\n : T extends readonly []\n ? // Trivial result when the array is empty.\n []\n : T extends readonly [infer Item, ...infer Rest]\n ? // Tuples could be special-cased by \"iterating\" over each item\n // separately so that we maintain more information from the input type,\n // instead of putting all values in a union.\n [\n ...(Item extends IterableContainer\n ? // If the item itself is an array we continue going deeper\n FlatArray<Item, Depth, [...Iteration, unknown]>\n : // But if it isn't we add it to the output tuple\n [Item]),\n // And we merge this with the result from the rest of the tuple.\n ...FlatArray<Rest, Depth, Iteration>,\n ]\n : // For simple arrays we compute the item type, and wrap it with an\n // array.\n Array<FlatSimpleArrayItems<T, Depth, Iteration>>;\n\n// This type is based on the built-in type for `Array.prototype.flat` from the\n// ES2019 Array typescript library, but we improved it to handle any depth\n// (avoiding the fixed `20` in the built-in type).\n// @see https://github.com/microsoft/TypeScript/blob/main/src/lib/es2019.array.d.ts#L1-L5\ntype FlatSimpleArrayItems<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n IsDone extends boolean = false,\n> = {\n done: T;\n recur: T extends ReadonlyArray<infer InnerArr>\n ? FlatSimpleArrayItems<\n InnerArr,\n Depth,\n [...Iteration, unknown],\n // This trick allows us to continue 1 iteration more than the depth,\n // which is required to flatten the array up to depth.\n Iteration['length'] extends Depth ? true : false\n >\n : T;\n}[IsDone extends true ? 'done' : 'recur'];\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param data - The items to flatten.\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1. Non literal values (those typed as\n * `number`cannot be used. `Infinity`, `Number.POSITIVE_INFINITY` and\n * `Number.MAX_VALUE` are all typed as `number` and can't be used either. For\n * \"unlimited\" depth use a literal value that would exceed your expected\n * practical maximum nesting level.\n * @signature\n * flat(data)\n * flat(data, depth)\n * @example\n * flat([[1, 2], [3, 4], [5], [[6]]]); // => [1, 2, 3, 4, 5, [6]]\n * flat([[[1]], [[2]]], 2); // => [1, 2]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flat<T extends IterableContainer, Depth extends number = 1>(\n data: T,\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): FlatArray<T, Depth>;\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1.\n * @signature\n * flat()(data)\n * flat(depth)(data)\n * @example\n * pipe([[1, 2], [3, 4], [5], [[6]]], flat()); // => [1, 2, 3, 4, 5, [6]]\n * pipe([[[1]], [[2]]], flat(2)); // => [1, 2]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flat<Depth extends number = 1>(\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): <T extends IterableContainer>(data: T) => FlatArray<T, Depth>;\n\nexport function flat(\n dataOrDepth?: IterableContainer | number,\n depth?: number,\n): unknown {\n if (typeof dataOrDepth === 'object') {\n return flatImplementation(dataOrDepth, depth);\n }\n\n return lazyDataLastImpl(\n flatImplementation,\n dataOrDepth === undefined ? [] : [dataOrDepth],\n lazyImplementation,\n );\n}\n\nfunction flatImplementation(data: IterableContainer, depth?: number): IterableContainer {\n return depth === undefined ? data.flat() : data.flat(depth);\n}\n\nfunction lazyImplementation(depth?: number): LazyEvaluator {\n if (depth === undefined || depth === 1) {\n return lazyShallow;\n }\n\n if (depth <= 0) {\n return lazyIdentityEvaluator;\n }\n\n return (value) =>\n Array.isArray(value)\n ? {\n next: value.flat(depth - 1),\n hasNext: true,\n hasMany: true,\n done: false,\n }\n : { next: value, hasNext: true, done: false }; ;\n}\n\n// This function is pulled out so that we don't generate a new arrow function\n// each time. Because it doesn't need to run with recursion it could be pulled\n// out from the lazyImplementation and be reused for all invocations.\nfunction lazyShallow<T>(value: T): LazyResult<T> {\n return Array.isArray(value)\n ? { next: value, hasNext: true, hasMany: true, done: false }\n : { next: value, hasNext: true, done: false };\n}\n"],"mappings":"wKAyGA,SAAgB,EACd,EACA,EACS,CAKT,OAJI,OAAO,GAAgB,SAClB,EAAmB,EAAa,CAAK,EAGvCA,EAAAA,EACL,EACA,IAAgB,IAAA,GAAY,CAAC,EAAI,CAAC,CAAW,EAC7C,CACF,CACF,CAEA,SAAS,EAAmB,EAAyB,EAAmC,CACtF,OAAO,IAAU,IAAA,GAAY,EAAK,KAAK,EAAI,EAAK,KAAK,CAAK,CAC5D,CAEA,SAAS,EAAmB,EAA+B,CASzD,OARI,IAAU,IAAA,IAAa,IAAU,EAC5B,EAGL,GAAS,EACJC,EAAAA,EAGD,GACN,MAAM,QAAQ,CAAK,EACf,CACE,KAAM,EAAM,KAAK,EAAQ,CAAC,EAC1B,QAAS,GACT,QAAS,GACT,KAAM,EACR,EACA,CAAE,KAAM,EAAO,QAAS,GAAM,KAAM,EAAM,CAClD,CAKA,SAAS,EAAe,EAAyB,CAC/C,OAAO,MAAM,QAAQ,CAAK,EACtB,CAAE,KAAM,EAAO,QAAS,GAAM,QAAS,GAAM,KAAM,EAAM,EACzD,CAAE,KAAM,EAAO,QAAS,GAAM,KAAM,EAAM,CAChD"}
|
package/dist/flat.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./lazy-data-last-impl
|
|
1
|
+
import{t as e}from"./lazy-data-last-impl--3B10z3s.js";import{r as t}from"./utility-evaluators-DDW55xeL.js";function n(t,n){return typeof t==`object`?r(t,n):e(r,t===void 0?[]:[t],i)}function r(e,t){return t===void 0?e.flat():e.flat(t)}function i(e){return e===void 0||e===1?a:e<=0?t:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1}}function a(e){return Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1}}export{n as flat};
|
|
2
2
|
//# sourceMappingURL=flat.js.map
|
package/dist/flat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat.js","names":[],"sources":["../src/flat.ts"],"sourcesContent":["import type { IsNumericLiteral } from 'type-fest';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport type { LazyResult } from './internal/types/lazy-result';\nimport { lazyDataLastImpl } from './internal/lazy-data-last-impl';\nimport { lazyIdentityEvaluator } from './internal/utility-evaluators';\n\ntype FlatArray<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n> = Depth extends Iteration['length']\n ? // Stopping condition for the recursion when the array is a tuple.\n T\n : T extends readonly []\n ? // Trivial result when the array is empty.\n []\n : T extends readonly [infer Item, ...infer Rest]\n ? // Tuples could be special-cased by \"iterating\" over each item\n // separately so that we maintain more information from the input type,\n // instead of putting all values in a union.\n [\n ...(Item extends IterableContainer\n ? // If the item itself is an array we continue going deeper\n FlatArray<Item, Depth, [...Iteration, unknown]>\n : // But if it isn't we add it to the output tuple\n [Item]),\n // And we merge this with the result from the rest of the tuple.\n ...FlatArray<Rest, Depth, Iteration>,\n ]\n : // For simple arrays we compute the item type, and wrap it with an\n // array.\n Array<FlatSimpleArrayItems<T, Depth, Iteration>>;\n\n// This type is based on the built-in type for `Array.prototype.flat` from the\n// ES2019 Array typescript library, but we improved it to handle any depth\n// (avoiding the fixed `20` in the built-in type).\n// @see https://github.com/microsoft/TypeScript/blob/main/src/lib/es2019.array.d.ts#L1-L5\ntype FlatSimpleArrayItems<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n IsDone extends boolean = false,\n> = {\n done: T;\n recur: T extends ReadonlyArray<infer InnerArr>\n ? FlatSimpleArrayItems<\n InnerArr,\n Depth,\n [...Iteration, unknown],\n // This trick allows us to continue 1 iteration more than the depth,\n // which is required to flatten the array up to depth.\n Iteration['length'] extends Depth ? true : false\n >\n : T;\n}[IsDone extends true ? 'done' : 'recur'];\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param data - The items to flatten.\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1. Non literal values (those typed as\n * `number`cannot be used. `Infinity`, `Number.POSITIVE_INFINITY` and\n * `Number.MAX_VALUE` are all typed as `number` and can't be used either. For\n * \"unlimited\" depth use a literal value that would exceed your expected\n * practical maximum nesting level.\n * @signature\n * flat(data)\n * flat(data, depth)\n * @example\n * flat([[1, 2], [3, 4], [5], [[6]]]); // => [1, 2, 3, 4, 5, [6]]\n * flat([[[1]], [[2]]], 2); // => [1, 2]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flat<T extends IterableContainer, Depth extends number = 1>(\n data: T,\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): FlatArray<T, Depth>;\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1.\n * @signature\n * flat()(data)\n * flat(depth)(data)\n * @example\n * pipe([[1, 2], [3, 4], [5], [[6]]], flat()); // => [1, 2, 3, 4, 5, [6]]\n * pipe([[[1]], [[2]]], flat(2)); // => [1, 2]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flat<Depth extends number = 1>(\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): <T extends IterableContainer>(data: T) => FlatArray<T, Depth>;\n\nexport function flat(\n dataOrDepth?: IterableContainer | number,\n depth?: number,\n): unknown {\n if (typeof dataOrDepth === 'object') {\n return flatImplementation(dataOrDepth, depth);\n }\n\n return lazyDataLastImpl(\n flatImplementation,\n dataOrDepth === undefined ? [] : [dataOrDepth],\n lazyImplementation,\n );\n}\n\nfunction flatImplementation(data: IterableContainer, depth?: number): IterableContainer {\n return depth === undefined ? data.flat() : data.flat(depth);\n}\n\nfunction lazyImplementation(depth?: number): LazyEvaluator {\n if (depth === undefined || depth === 1) {\n return lazyShallow;\n }\n\n if (depth <= 0) {\n return lazyIdentityEvaluator;\n }\n\n return (value) =>\n Array.isArray(value)\n ? {\n next: value.flat(depth - 1),\n hasNext: true,\n hasMany: true,\n done: false,\n }\n : { next: value, hasNext: true, done: false }; ;\n}\n\n// This function is pulled out so that we don't generate a new arrow function\n// each time. Because it doesn't need to run with recursion it could be pulled\n// out from the lazyImplementation and be reused for all invocations.\nfunction lazyShallow<T>(value: T): LazyResult<T> {\n return Array.isArray(value)\n ? { next: value, hasNext: true, hasMany: true, done: false }\n : { next: value, hasNext: true, done: false };\n}\n"],"mappings":"2GAyGA,SAAgB,EACd,EACA,EACS,CAKT,OAJI,OAAO,GAAgB,SAClB,EAAmB,EAAa,
|
|
1
|
+
{"version":3,"file":"flat.js","names":[],"sources":["../src/flat.ts"],"sourcesContent":["import type { IsNumericLiteral } from 'type-fest';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport type { LazyResult } from './internal/types/lazy-result';\nimport { lazyDataLastImpl } from './internal/lazy-data-last-impl';\nimport { lazyIdentityEvaluator } from './internal/utility-evaluators';\n\ntype FlatArray<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n> = Depth extends Iteration['length']\n ? // Stopping condition for the recursion when the array is a tuple.\n T\n : T extends readonly []\n ? // Trivial result when the array is empty.\n []\n : T extends readonly [infer Item, ...infer Rest]\n ? // Tuples could be special-cased by \"iterating\" over each item\n // separately so that we maintain more information from the input type,\n // instead of putting all values in a union.\n [\n ...(Item extends IterableContainer\n ? // If the item itself is an array we continue going deeper\n FlatArray<Item, Depth, [...Iteration, unknown]>\n : // But if it isn't we add it to the output tuple\n [Item]),\n // And we merge this with the result from the rest of the tuple.\n ...FlatArray<Rest, Depth, Iteration>,\n ]\n : // For simple arrays we compute the item type, and wrap it with an\n // array.\n Array<FlatSimpleArrayItems<T, Depth, Iteration>>;\n\n// This type is based on the built-in type for `Array.prototype.flat` from the\n// ES2019 Array typescript library, but we improved it to handle any depth\n// (avoiding the fixed `20` in the built-in type).\n// @see https://github.com/microsoft/TypeScript/blob/main/src/lib/es2019.array.d.ts#L1-L5\ntype FlatSimpleArrayItems<\n T,\n Depth extends number,\n Iteration extends ReadonlyArray<unknown> = [],\n IsDone extends boolean = false,\n> = {\n done: T;\n recur: T extends ReadonlyArray<infer InnerArr>\n ? FlatSimpleArrayItems<\n InnerArr,\n Depth,\n [...Iteration, unknown],\n // This trick allows us to continue 1 iteration more than the depth,\n // which is required to flatten the array up to depth.\n Iteration['length'] extends Depth ? true : false\n >\n : T;\n}[IsDone extends true ? 'done' : 'recur'];\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param data - The items to flatten.\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1. Non literal values (those typed as\n * `number`cannot be used. `Infinity`, `Number.POSITIVE_INFINITY` and\n * `Number.MAX_VALUE` are all typed as `number` and can't be used either. For\n * \"unlimited\" depth use a literal value that would exceed your expected\n * practical maximum nesting level.\n * @signature\n * flat(data)\n * flat(data, depth)\n * @example\n * flat([[1, 2], [3, 4], [5], [[6]]]); // => [1, 2, 3, 4, 5, [6]]\n * flat([[[1]], [[2]]], 2); // => [1, 2]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function flat<T extends IterableContainer, Depth extends number = 1>(\n data: T,\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): FlatArray<T, Depth>;\n\n/**\n * Creates a new array with all sub-array elements concatenated into it\n * recursively up to the specified depth. Equivalent to the built-in\n * `Array.prototype.flat` method.\n *\n * @param depth - The depth level specifying how deep a nested array structure\n * should be flattened. Defaults to 1.\n * @signature\n * flat()(data)\n * flat(depth)(data)\n * @example\n * pipe([[1, 2], [3, 4], [5], [[6]]], flat()); // => [1, 2, 3, 4, 5, [6]]\n * pipe([[[1]], [[2]]], flat(2)); // => [1, 2]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function flat<Depth extends number = 1>(\n depth?: IsNumericLiteral<Depth> extends true ? Depth : never,\n): <T extends IterableContainer>(data: T) => FlatArray<T, Depth>;\n\nexport function flat(\n dataOrDepth?: IterableContainer | number,\n depth?: number,\n): unknown {\n if (typeof dataOrDepth === 'object') {\n return flatImplementation(dataOrDepth, depth);\n }\n\n return lazyDataLastImpl(\n flatImplementation,\n dataOrDepth === undefined ? [] : [dataOrDepth],\n lazyImplementation,\n );\n}\n\nfunction flatImplementation(data: IterableContainer, depth?: number): IterableContainer {\n return depth === undefined ? data.flat() : data.flat(depth);\n}\n\nfunction lazyImplementation(depth?: number): LazyEvaluator {\n if (depth === undefined || depth === 1) {\n return lazyShallow;\n }\n\n if (depth <= 0) {\n return lazyIdentityEvaluator;\n }\n\n return (value) =>\n Array.isArray(value)\n ? {\n next: value.flat(depth - 1),\n hasNext: true,\n hasMany: true,\n done: false,\n }\n : { next: value, hasNext: true, done: false }; ;\n}\n\n// This function is pulled out so that we don't generate a new arrow function\n// each time. Because it doesn't need to run with recursion it could be pulled\n// out from the lazyImplementation and be reused for all invocations.\nfunction lazyShallow<T>(value: T): LazyResult<T> {\n return Array.isArray(value)\n ? { next: value, hasNext: true, hasMany: true, done: false }\n : { next: value, hasNext: true, done: false };\n}\n"],"mappings":"2GAyGA,SAAgB,EACd,EACA,EACS,CAKT,OAJI,OAAO,GAAgB,SAClB,EAAmB,EAAa,CAAK,EAGvC,EACL,EACA,IAAgB,IAAA,GAAY,CAAC,EAAI,CAAC,CAAW,EAC7C,CACF,CACF,CAEA,SAAS,EAAmB,EAAyB,EAAmC,CACtF,OAAO,IAAU,IAAA,GAAY,EAAK,KAAK,EAAI,EAAK,KAAK,CAAK,CAC5D,CAEA,SAAS,EAAmB,EAA+B,CASzD,OARI,IAAU,IAAA,IAAa,IAAU,EAC5B,EAGL,GAAS,EACJ,EAGD,GACN,MAAM,QAAQ,CAAK,EACf,CACE,KAAM,EAAM,KAAK,EAAQ,CAAC,EAC1B,QAAS,GACT,QAAS,GACT,KAAM,EACR,EACA,CAAE,KAAM,EAAO,QAAS,GAAM,KAAM,EAAM,CAClD,CAKA,SAAS,EAAe,EAAyB,CAC/C,OAAO,MAAM,QAAQ,CAAK,EACtB,CAAE,KAAM,EAAO,QAAS,GAAM,QAAS,GAAM,KAAM,EAAM,EACzD,CAAE,KAAM,EAAO,QAAS,GAAM,KAAM,EAAM,CAChD"}
|
package/dist/floor.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("./with-precision-Dy5W6bdk.cjs");function n(...n){return e.curry(t.t(Math.floor),n)}exports.floor=n;
|
|
2
2
|
//# sourceMappingURL=floor.cjs.map
|
package/dist/floor.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floor.cjs","names":["curry","withPrecision"],"sources":["../src/floor.ts"],"sourcesContent":["import { curry } from './curry';\nimport { withPrecision } from './internal/with-precision';\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round down.\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(value, precision);\n * @example\n * floor(123.9876, 3) // => 123.987\n * floor(483.22243, 1) // => 483.2\n * floor(8541, -1) // => 8540\n * floor(456789, -3) // => 456000\n * @dataFirst\n * @category Number\n */\nexport function floor(value: number, precision: number): number;\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(precision)(value);\n * @example\n * floor(3)(123.9876) // => 123.987\n * floor(1)(483.22243) // => 483.2\n * floor(-1)(8541) // => 8540\n * floor(-3)(456789) // => 456000\n * @dataLast\n * @category Number\n */\nexport function floor(precision: number): (value: number) => number;\n\nexport function floor(...args: ReadonlyArray<unknown>): unknown {\n return curry(withPrecision(Math.floor), args);\n}\n"],"mappings":"6IAwCA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAMC,EAAAA,EAAc,KAAK,
|
|
1
|
+
{"version":3,"file":"floor.cjs","names":["curry","withPrecision"],"sources":["../src/floor.ts"],"sourcesContent":["import { curry } from './curry';\nimport { withPrecision } from './internal/with-precision';\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round down.\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(value, precision);\n * @example\n * floor(123.9876, 3) // => 123.987\n * floor(483.22243, 1) // => 483.2\n * floor(8541, -1) // => 8540\n * floor(456789, -3) // => 456000\n * @dataFirst\n * @category Number\n */\nexport function floor(value: number, precision: number): number;\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(precision)(value);\n * @example\n * floor(3)(123.9876) // => 123.987\n * floor(1)(483.22243) // => 483.2\n * floor(-1)(8541) // => 8540\n * floor(-3)(456789) // => 456000\n * @dataLast\n * @category Number\n */\nexport function floor(precision: number): (value: number) => number;\n\nexport function floor(...args: ReadonlyArray<unknown>): unknown {\n return curry(withPrecision(Math.floor), args);\n}\n"],"mappings":"6IAwCA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAOA,EAAAA,MAAMC,EAAAA,EAAc,KAAK,KAAK,EAAG,CAAI,CAC9C"}
|
package/dist/floor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{curry as e}from"./curry.js";import{t}from"./with-precision-
|
|
1
|
+
import{curry as e}from"./curry.js";import{t}from"./with-precision-D-84B_By.js";function n(...n){return e(t(Math.floor),n)}export{n as floor};
|
|
2
2
|
//# sourceMappingURL=floor.js.map
|
package/dist/floor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floor.js","names":[],"sources":["../src/floor.ts"],"sourcesContent":["import { curry } from './curry';\nimport { withPrecision } from './internal/with-precision';\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round down.\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(value, precision);\n * @example\n * floor(123.9876, 3) // => 123.987\n * floor(483.22243, 1) // => 483.2\n * floor(8541, -1) // => 8540\n * floor(456789, -3) // => 456000\n * @dataFirst\n * @category Number\n */\nexport function floor(value: number, precision: number): number;\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(precision)(value);\n * @example\n * floor(3)(123.9876) // => 123.987\n * floor(1)(483.22243) // => 483.2\n * floor(-1)(8541) // => 8540\n * floor(-3)(456789) // => 456000\n * @dataLast\n * @category Number\n */\nexport function floor(precision: number): (value: number) => number;\n\nexport function floor(...args: ReadonlyArray<unknown>): unknown {\n return curry(withPrecision(Math.floor), args);\n}\n"],"mappings":"+EAwCA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAc,KAAK,
|
|
1
|
+
{"version":3,"file":"floor.js","names":[],"sources":["../src/floor.ts"],"sourcesContent":["import { curry } from './curry';\nimport { withPrecision } from './internal/with-precision';\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round down.\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(value, precision);\n * @example\n * floor(123.9876, 3) // => 123.987\n * floor(483.22243, 1) // => 483.2\n * floor(8541, -1) // => 8540\n * floor(456789, -3) // => 456000\n * @dataFirst\n * @category Number\n */\nexport function floor(value: number, precision: number): number;\n\n/**\n * Rounds down a given number to a specific precision.\n * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.floor` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round down to. Must be an integer between -15 and 15.\n * @signature\n * floor(precision)(value);\n * @example\n * floor(3)(123.9876) // => 123.987\n * floor(1)(483.22243) // => 483.2\n * floor(-1)(8541) // => 8540\n * floor(-3)(456789) // => 456000\n * @dataLast\n * @category Number\n */\nexport function floor(precision: number): (value: number) => number;\n\nexport function floor(...args: ReadonlyArray<unknown>): unknown {\n return curry(withPrecision(Math.floor), args);\n}\n"],"mappings":"+EAwCA,SAAgB,EAAM,GAAG,EAAuC,CAC9D,OAAO,EAAM,EAAc,KAAK,KAAK,EAAG,CAAI,CAC9C"}
|
package/dist/for-each-obj.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){for(let[n,r]of Object.entries(e))t(r,n,e);return e}exports.forEachObj=t;
|
|
2
2
|
//# sourceMappingURL=for-each-obj.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"for-each-obj.cjs","names":["curry"],"sources":["../src/for-each-obj.ts"],"sourcesContent":["import type { EnumerableStringKeyOf } from './internal/types/enumerable-string-key-of';\nimport type { EnumerableStringKeyedValueOf } from './internal/types/enumerable-string-keyed-value-of';\nimport { curry } from './curry';\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param data - The object who'se entries would be iterated on.\n * @param callbackfn - A function to execute for each element in the array.\n * @signature\n * forEachObj(object, fn)\n * @example\n * forEachObj({a: 1}, (val, key, obj) => {\n * console.log(`${key}: ${val}`)\n * }) // \"a: 1\"\n * @dataFirst\n * @category Object\n */\nexport function forEachObj<T extends object>(\n data: T,\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): void;\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param callbackfn - A function to execute for each element in the array.\n * @returns The original object (the ref itself, not a shallow copy of it).\n * @signature\n * forEachObj(fn)(object)\n * @example\n * pipe(\n * {a: 1},\n * forEachObj((val, key) => console.log(`${key}: ${val}`))\n * ) // \"a: 1\"\n * @dataLast\n * @category Object\n */\nexport function forEachObj<T extends object>(\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): (object: T) => T;\n\nexport function forEachObj(...args: ReadonlyArray<unknown>): unknown {\n return curry(forEachObjImplementation, args);\n}\n\nfunction forEachObjImplementation<T extends object>(\n data: T,\n fn: (value: unknown, key: string, data: T) => void,\n): T {\n for (const [key, value] of Object.entries(data)) {\n fn(value, key, data);\n }\n return data;\n}\n"],"mappings":"kGA0DA,SAAgB,EAAW,GAAG,EAAuC,CACnE,OAAOA,EAAAA,MAAM,EAA0B,
|
|
1
|
+
{"version":3,"file":"for-each-obj.cjs","names":["curry"],"sources":["../src/for-each-obj.ts"],"sourcesContent":["import type { EnumerableStringKeyOf } from './internal/types/enumerable-string-key-of';\nimport type { EnumerableStringKeyedValueOf } from './internal/types/enumerable-string-keyed-value-of';\nimport { curry } from './curry';\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param data - The object who'se entries would be iterated on.\n * @param callbackfn - A function to execute for each element in the array.\n * @signature\n * forEachObj(object, fn)\n * @example\n * forEachObj({a: 1}, (val, key, obj) => {\n * console.log(`${key}: ${val}`)\n * }) // \"a: 1\"\n * @dataFirst\n * @category Object\n */\nexport function forEachObj<T extends object>(\n data: T,\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): void;\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param callbackfn - A function to execute for each element in the array.\n * @returns The original object (the ref itself, not a shallow copy of it).\n * @signature\n * forEachObj(fn)(object)\n * @example\n * pipe(\n * {a: 1},\n * forEachObj((val, key) => console.log(`${key}: ${val}`))\n * ) // \"a: 1\"\n * @dataLast\n * @category Object\n */\nexport function forEachObj<T extends object>(\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): (object: T) => T;\n\nexport function forEachObj(...args: ReadonlyArray<unknown>): unknown {\n return curry(forEachObjImplementation, args);\n}\n\nfunction forEachObjImplementation<T extends object>(\n data: T,\n fn: (value: unknown, key: string, data: T) => void,\n): T {\n for (const [key, value] of Object.entries(data)) {\n fn(value, key, data);\n }\n return data;\n}\n"],"mappings":"kGA0DA,SAAgB,EAAW,GAAG,EAAuC,CACnE,OAAOA,EAAAA,MAAM,EAA0B,CAAI,CAC7C,CAEA,SAAS,EACP,EACA,EACG,CACH,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAI,EAC5C,EAAG,EAAO,EAAK,CAAI,EAErB,OAAO,CACT"}
|
package/dist/for-each-obj.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"for-each-obj.js","names":[],"sources":["../src/for-each-obj.ts"],"sourcesContent":["import type { EnumerableStringKeyOf } from './internal/types/enumerable-string-key-of';\nimport type { EnumerableStringKeyedValueOf } from './internal/types/enumerable-string-keyed-value-of';\nimport { curry } from './curry';\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param data - The object who'se entries would be iterated on.\n * @param callbackfn - A function to execute for each element in the array.\n * @signature\n * forEachObj(object, fn)\n * @example\n * forEachObj({a: 1}, (val, key, obj) => {\n * console.log(`${key}: ${val}`)\n * }) // \"a: 1\"\n * @dataFirst\n * @category Object\n */\nexport function forEachObj<T extends object>(\n data: T,\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): void;\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param callbackfn - A function to execute for each element in the array.\n * @returns The original object (the ref itself, not a shallow copy of it).\n * @signature\n * forEachObj(fn)(object)\n * @example\n * pipe(\n * {a: 1},\n * forEachObj((val, key) => console.log(`${key}: ${val}`))\n * ) // \"a: 1\"\n * @dataLast\n * @category Object\n */\nexport function forEachObj<T extends object>(\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): (object: T) => T;\n\nexport function forEachObj(...args: ReadonlyArray<unknown>): unknown {\n return curry(forEachObjImplementation, args);\n}\n\nfunction forEachObjImplementation<T extends object>(\n data: T,\n fn: (value: unknown, key: string, data: T) => void,\n): T {\n for (const [key, value] of Object.entries(data)) {\n fn(value, key, data);\n }\n return data;\n}\n"],"mappings":"mCA0DA,SAAgB,EAAW,GAAG,EAAuC,CACnE,OAAO,EAAM,EAA0B,
|
|
1
|
+
{"version":3,"file":"for-each-obj.js","names":[],"sources":["../src/for-each-obj.ts"],"sourcesContent":["import type { EnumerableStringKeyOf } from './internal/types/enumerable-string-key-of';\nimport type { EnumerableStringKeyedValueOf } from './internal/types/enumerable-string-keyed-value-of';\nimport { curry } from './curry';\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param data - The object who'se entries would be iterated on.\n * @param callbackfn - A function to execute for each element in the array.\n * @signature\n * forEachObj(object, fn)\n * @example\n * forEachObj({a: 1}, (val, key, obj) => {\n * console.log(`${key}: ${val}`)\n * }) // \"a: 1\"\n * @dataFirst\n * @category Object\n */\nexport function forEachObj<T extends object>(\n data: T,\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): void;\n\n/**\n * Iterate an object using a defined callback function.\n *\n * The dataLast version returns the original object (instead of not returning\n * anything (`void`)) to allow using it in a pipe. The returned object is the\n * same reference as the input object, and not a shallow copy of it!\n *\n * @param callbackfn - A function to execute for each element in the array.\n * @returns The original object (the ref itself, not a shallow copy of it).\n * @signature\n * forEachObj(fn)(object)\n * @example\n * pipe(\n * {a: 1},\n * forEachObj((val, key) => console.log(`${key}: ${val}`))\n * ) // \"a: 1\"\n * @dataLast\n * @category Object\n */\nexport function forEachObj<T extends object>(\n callbackfn: (\n value: EnumerableStringKeyedValueOf<T>,\n key: EnumerableStringKeyOf<T>,\n obj: T,\n ) => void,\n): (object: T) => T;\n\nexport function forEachObj(...args: ReadonlyArray<unknown>): unknown {\n return curry(forEachObjImplementation, args);\n}\n\nfunction forEachObjImplementation<T extends object>(\n data: T,\n fn: (value: unknown, key: string, data: T) => void,\n): T {\n for (const [key, value] of Object.entries(data)) {\n fn(value, key, data);\n }\n return data;\n}\n"],"mappings":"mCA0DA,SAAgB,EAAW,GAAG,EAAuC,CACnE,OAAO,EAAM,EAA0B,CAAI,CAC7C,CAEA,SAAS,EACP,EACA,EACG,CACH,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAI,EAC5C,EAAG,EAAO,EAAK,CAAI,EAErB,OAAO,CACT"}
|
package/dist/for-each.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,r)}function n(e,t){return e.forEach(t),e}function r(e){return(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t})}exports.forEach=t;
|
|
2
2
|
//# sourceMappingURL=for-each.cjs.map
|