@vielzeug/toolkit 1.1.3 → 2.1.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/README.md +325 -452
- package/dist/array/chunk.cjs +2 -2
- package/dist/array/chunk.cjs.map +1 -1
- package/dist/array/chunk.d.ts +29 -0
- package/dist/array/chunk.d.ts.map +1 -0
- package/dist/array/chunk.js +22 -24
- package/dist/array/chunk.js.map +1 -1
- package/dist/array/contains.cjs +2 -2
- package/dist/array/contains.cjs.map +1 -1
- package/dist/array/contains.d.ts +19 -0
- package/dist/array/contains.d.ts.map +1 -0
- package/dist/array/contains.js +12 -9
- package/dist/array/contains.js.map +1 -1
- package/dist/array/fold.cjs +2 -0
- package/dist/array/fold.cjs.map +1 -0
- package/dist/array/fold.d.ts +21 -0
- package/dist/array/fold.d.ts.map +1 -0
- package/dist/array/fold.js +19 -0
- package/dist/array/fold.js.map +1 -0
- package/dist/array/group.cjs +2 -2
- package/dist/array/group.cjs.map +1 -1
- package/dist/array/group.d.ts +19 -0
- package/dist/array/group.d.ts.map +1 -0
- package/dist/array/group.js +18 -15
- package/dist/array/group.js.map +1 -1
- package/dist/array/index.d.ts +16 -0
- package/dist/array/index.d.ts.map +1 -0
- package/dist/array/keyBy.cjs +2 -0
- package/dist/array/keyBy.cjs.map +1 -0
- package/dist/array/keyBy.d.ts +20 -0
- package/dist/array/keyBy.d.ts.map +1 -0
- package/dist/array/keyBy.js +19 -0
- package/dist/array/keyBy.js.map +1 -0
- package/dist/array/list.cjs +2 -2
- package/dist/array/list.cjs.map +1 -1
- package/dist/array/list.d.ts +58 -0
- package/dist/array/list.d.ts.map +1 -0
- package/dist/array/list.js +103 -106
- package/dist/array/list.js.map +1 -1
- package/dist/array/pick.cjs +2 -2
- package/dist/array/pick.cjs.map +1 -1
- package/dist/array/pick.d.ts +19 -0
- package/dist/array/pick.d.ts.map +1 -0
- package/dist/array/pick.js +15 -14
- package/dist/array/pick.js.map +1 -1
- package/dist/array/remoteList.cjs +2 -2
- package/dist/array/remoteList.cjs.map +1 -1
- package/dist/array/remoteList.d.ts +64 -0
- package/dist/array/remoteList.d.ts.map +1 -0
- package/dist/array/remoteList.js +121 -122
- package/dist/array/remoteList.js.map +1 -1
- package/dist/array/replace.cjs +2 -0
- package/dist/array/replace.cjs.map +1 -0
- package/dist/array/replace.d.ts +20 -0
- package/dist/array/replace.d.ts.map +1 -0
- package/dist/array/replace.js +19 -0
- package/dist/array/replace.js.map +1 -0
- package/dist/array/rotate.cjs +2 -0
- package/dist/array/rotate.cjs.map +1 -0
- package/dist/array/rotate.d.ts +22 -0
- package/dist/array/rotate.d.ts.map +1 -0
- package/dist/array/rotate.js +19 -0
- package/dist/array/rotate.js.map +1 -0
- package/dist/array/search.cjs +2 -2
- package/dist/array/search.cjs.map +1 -1
- package/dist/array/search.d.ts +19 -0
- package/dist/array/search.d.ts.map +1 -0
- package/dist/array/search.js +23 -13
- package/dist/array/search.js.map +1 -1
- package/dist/array/select.cjs +2 -2
- package/dist/array/select.cjs.map +1 -1
- package/dist/array/select.d.ts +21 -0
- package/dist/array/select.d.ts.map +1 -0
- package/dist/array/select.js +16 -15
- package/dist/array/select.js.map +1 -1
- package/dist/array/sort.cjs +2 -2
- package/dist/array/sort.cjs.map +1 -1
- package/dist/array/sort.d.ts +26 -0
- package/dist/array/sort.d.ts.map +1 -0
- package/dist/array/sort.js +18 -12
- package/dist/array/sort.js.map +1 -1
- package/dist/array/toggle.cjs +2 -0
- package/dist/array/toggle.cjs.map +1 -0
- package/dist/array/toggle.d.ts +29 -0
- package/dist/array/toggle.d.ts.map +1 -0
- package/dist/array/toggle.js +9 -0
- package/dist/array/toggle.js.map +1 -0
- package/dist/array/uniq.cjs +2 -2
- package/dist/array/uniq.cjs.map +1 -1
- package/dist/array/uniq.d.ts +21 -0
- package/dist/array/uniq.d.ts.map +1 -0
- package/dist/array/uniq.js +15 -17
- package/dist/array/uniq.js.map +1 -1
- package/dist/async/attempt.cjs +2 -2
- package/dist/async/attempt.cjs.map +1 -1
- package/dist/async/attempt.d.ts +40 -0
- package/dist/async/attempt.d.ts.map +1 -0
- package/dist/async/attempt.js +19 -14
- package/dist/async/attempt.js.map +1 -1
- package/dist/async/defer.cjs +2 -2
- package/dist/async/defer.cjs.map +1 -1
- package/dist/async/defer.d.ts +23 -0
- package/dist/async/defer.d.ts.map +1 -0
- package/dist/async/defer.js +12 -9
- package/dist/async/defer.js.map +1 -1
- package/dist/async/index.d.ts +12 -0
- package/dist/async/index.d.ts.map +1 -0
- package/dist/async/parallel.cjs +2 -2
- package/dist/async/parallel.cjs.map +1 -1
- package/dist/async/parallel.d.ts +31 -0
- package/dist/async/parallel.d.ts.map +1 -0
- package/dist/async/parallel.js +26 -27
- package/dist/async/parallel.js.map +1 -1
- package/dist/async/pool.cjs +2 -2
- package/dist/async/pool.cjs.map +1 -1
- package/dist/async/pool.d.ts +21 -0
- package/dist/async/pool.d.ts.map +1 -0
- package/dist/async/pool.js +23 -21
- package/dist/async/pool.js.map +1 -1
- package/dist/async/predict.cjs +2 -2
- package/dist/async/predict.cjs.map +1 -1
- package/dist/async/predict.d.ts +24 -0
- package/dist/async/predict.d.ts.map +1 -0
- package/dist/async/predict.js +10 -12
- package/dist/async/predict.js.map +1 -1
- package/dist/async/queue.cjs +2 -2
- package/dist/async/queue.cjs.map +1 -1
- package/dist/async/queue.d.ts +43 -0
- package/dist/async/queue.d.ts.map +1 -0
- package/dist/async/queue.js +52 -56
- package/dist/async/queue.js.map +1 -1
- package/dist/async/race.cjs +2 -2
- package/dist/async/race.cjs.map +1 -1
- package/dist/async/race.d.ts +16 -0
- package/dist/async/race.d.ts.map +1 -0
- package/dist/async/race.js +8 -7
- package/dist/async/race.js.map +1 -1
- package/dist/async/retry.cjs +2 -2
- package/dist/async/retry.cjs.map +1 -1
- package/dist/async/retry.d.ts +32 -0
- package/dist/async/retry.d.ts.map +1 -0
- package/dist/async/retry.js +19 -24
- package/dist/async/retry.js.map +1 -1
- package/dist/async/scheduler.cjs +2 -0
- package/dist/async/scheduler.cjs.map +1 -0
- package/dist/async/scheduler.d.ts +51 -0
- package/dist/async/scheduler.d.ts.map +1 -0
- package/dist/async/scheduler.js +43 -0
- package/dist/async/scheduler.js.map +1 -0
- package/dist/async/sleep.cjs +2 -2
- package/dist/async/sleep.cjs.map +1 -1
- package/dist/async/sleep.d.ts +16 -0
- package/dist/async/sleep.d.ts.map +1 -0
- package/dist/async/sleep.js +11 -11
- package/dist/async/sleep.js.map +1 -1
- package/dist/async/waitFor.cjs +2 -2
- package/dist/async/waitFor.cjs.map +1 -1
- package/dist/async/waitFor.d.ts +33 -0
- package/dist/async/waitFor.d.ts.map +1 -0
- package/dist/async/waitFor.js +29 -36
- package/dist/async/waitFor.js.map +1 -1
- package/dist/date/expires.cjs +2 -2
- package/dist/date/expires.cjs.map +1 -1
- package/dist/date/expires.d.ts +15 -0
- package/dist/date/expires.d.ts.map +1 -0
- package/dist/date/expires.js +11 -10
- package/dist/date/expires.js.map +1 -1
- package/dist/date/index.d.ts +4 -0
- package/dist/date/index.d.ts.map +1 -0
- package/dist/date/interval.cjs +2 -2
- package/dist/date/interval.cjs.map +1 -1
- package/dist/date/interval.d.ts +25 -0
- package/dist/date/interval.d.ts.map +1 -0
- package/dist/date/interval.js +31 -37
- package/dist/date/interval.js.map +1 -1
- package/dist/date/timeDiff.cjs +2 -2
- package/dist/date/timeDiff.cjs.map +1 -1
- package/dist/date/timeDiff.d.ts +24 -0
- package/dist/date/timeDiff.d.ts.map +1 -0
- package/dist/date/timeDiff.js +58 -25
- package/dist/date/timeDiff.js.map +1 -1
- package/dist/function/assert.cjs +2 -3
- package/dist/function/assert.cjs.map +1 -1
- package/dist/function/assert.d.ts +38 -0
- package/dist/function/assert.d.ts.map +1 -0
- package/dist/function/assert.js +13 -11
- package/dist/function/assert.js.map +1 -1
- package/dist/function/assertParams.cjs +2 -2
- package/dist/function/assertParams.cjs.map +1 -1
- package/dist/function/assertParams.d.ts +24 -0
- package/dist/function/assertParams.d.ts.map +1 -0
- package/dist/function/assertParams.js +13 -12
- package/dist/function/assertParams.js.map +1 -1
- package/dist/function/compare.cjs +2 -2
- package/dist/function/compare.cjs.map +1 -1
- package/dist/function/compare.d.ts +23 -0
- package/dist/function/compare.d.ts.map +1 -0
- package/dist/function/compare.js +22 -21
- package/dist/function/compare.js.map +1 -1
- package/dist/function/compareBy.cjs +2 -2
- package/dist/function/compareBy.cjs.map +1 -1
- package/dist/function/compareBy.d.ts +24 -0
- package/dist/function/compareBy.d.ts.map +1 -0
- package/dist/function/compareBy.js +15 -14
- package/dist/function/compareBy.js.map +1 -1
- package/dist/function/compose.cjs +2 -2
- package/dist/function/compose.cjs.map +1 -1
- package/dist/function/compose.d.ts +22 -0
- package/dist/function/compose.d.ts.map +1 -0
- package/dist/function/compose.js +10 -13
- package/dist/function/compose.js.map +1 -1
- package/dist/function/curry.cjs +2 -2
- package/dist/function/curry.cjs.map +1 -1
- package/dist/function/curry.d.ts +21 -0
- package/dist/function/curry.d.ts.map +1 -0
- package/dist/function/curry.js +8 -7
- package/dist/function/curry.js.map +1 -1
- package/dist/function/debounce.cjs +2 -2
- package/dist/function/debounce.cjs.map +1 -1
- package/dist/function/debounce.d.ts +12 -0
- package/dist/function/debounce.d.ts.map +1 -0
- package/dist/function/debounce.js +34 -26
- package/dist/function/debounce.js.map +1 -1
- package/dist/function/fp.cjs +2 -2
- package/dist/function/fp.cjs.map +1 -1
- package/dist/function/fp.d.ts +24 -0
- package/dist/function/fp.d.ts.map +1 -0
- package/dist/function/fp.js +6 -10
- package/dist/function/fp.js.map +1 -1
- package/dist/function/index.d.ts +13 -0
- package/dist/function/index.d.ts.map +1 -0
- package/dist/function/memo.cjs +2 -2
- package/dist/function/memo.cjs.map +1 -1
- package/dist/function/memo.d.ts +30 -0
- package/dist/function/memo.d.ts.map +1 -0
- package/dist/function/memo.js +16 -24
- package/dist/function/memo.js.map +1 -1
- package/dist/function/once.cjs +2 -2
- package/dist/function/once.cjs.map +1 -1
- package/dist/function/once.d.ts +24 -0
- package/dist/function/once.d.ts.map +1 -0
- package/dist/function/once.js +10 -10
- package/dist/function/once.js.map +1 -1
- package/dist/function/pipe.cjs +2 -2
- package/dist/function/pipe.cjs.map +1 -1
- package/dist/function/pipe.d.ts +23 -0
- package/dist/function/pipe.d.ts.map +1 -0
- package/dist/function/pipe.js +10 -10
- package/dist/function/pipe.js.map +1 -1
- package/dist/function/throttle.cjs +2 -2
- package/dist/function/throttle.cjs.map +1 -1
- package/dist/function/throttle.d.ts +21 -0
- package/dist/function/throttle.d.ts.map +1 -0
- package/dist/function/throttle.js +45 -37
- package/dist/function/throttle.js.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +77 -2813
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +75 -253
- package/dist/math/abs.cjs +2 -2
- package/dist/math/abs.cjs.map +1 -1
- package/dist/math/abs.d.ts +17 -0
- package/dist/math/abs.d.ts.map +1 -0
- package/dist/math/abs.js +7 -6
- package/dist/math/abs.js.map +1 -1
- package/dist/math/allocate.cjs +2 -2
- package/dist/math/allocate.cjs.map +1 -1
- package/dist/math/allocate.d.ts +24 -0
- package/dist/math/allocate.d.ts.map +1 -0
- package/dist/math/allocate.js +20 -28
- package/dist/math/allocate.js.map +1 -1
- package/dist/math/average.cjs +2 -2
- package/dist/math/average.cjs.map +1 -1
- package/dist/math/average.d.ts +16 -0
- package/dist/math/average.d.ts.map +1 -0
- package/dist/math/average.js +13 -24
- package/dist/math/average.js.map +1 -1
- package/dist/math/clamp.cjs +2 -2
- package/dist/math/clamp.cjs.map +1 -1
- package/dist/math/clamp.d.ts +18 -0
- package/dist/math/clamp.d.ts.map +1 -0
- package/dist/math/clamp.js +7 -6
- package/dist/math/clamp.js.map +1 -1
- package/dist/math/distribute.cjs +2 -2
- package/dist/math/distribute.cjs.map +1 -1
- package/dist/math/distribute.d.ts +24 -0
- package/dist/math/distribute.d.ts.map +1 -0
- package/dist/math/distribute.js +14 -17
- package/dist/math/distribute.js.map +1 -1
- package/dist/math/index.d.ts +14 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/linspace.cjs +2 -0
- package/dist/math/linspace.cjs.map +1 -0
- package/dist/math/linspace.d.ts +19 -0
- package/dist/math/linspace.d.ts.map +1 -0
- package/dist/math/linspace.js +11 -0
- package/dist/math/linspace.js.map +1 -0
- package/dist/math/max.cjs +2 -2
- package/dist/math/max.cjs.map +1 -1
- package/dist/math/max.d.ts +23 -0
- package/dist/math/max.d.ts.map +1 -0
- package/dist/math/max.js +10 -11
- package/dist/math/max.js.map +1 -1
- package/dist/math/median.cjs +2 -2
- package/dist/math/median.cjs.map +1 -1
- package/dist/math/median.d.ts +17 -0
- package/dist/math/median.d.ts.map +1 -0
- package/dist/math/median.js +11 -10
- package/dist/math/median.js.map +1 -1
- package/dist/math/min.cjs +2 -2
- package/dist/math/min.cjs.map +1 -1
- package/dist/math/min.d.ts +23 -0
- package/dist/math/min.d.ts.map +1 -0
- package/dist/math/min.js +10 -11
- package/dist/math/min.js.map +1 -1
- package/dist/math/percent.cjs +2 -0
- package/dist/math/percent.cjs.map +1 -0
- package/dist/math/percent.d.ts +19 -0
- package/dist/math/percent.d.ts.map +1 -0
- package/dist/math/percent.js +8 -0
- package/dist/math/percent.js.map +1 -0
- package/dist/math/range.cjs +2 -2
- package/dist/math/range.cjs.map +1 -1
- package/dist/math/range.d.ts +23 -0
- package/dist/math/range.d.ts.map +1 -0
- package/dist/math/range.js +28 -17
- package/dist/math/range.js.map +1 -1
- package/dist/math/round.cjs +2 -2
- package/dist/math/round.cjs.map +1 -1
- package/dist/math/round.d.ts +21 -0
- package/dist/math/round.d.ts.map +1 -0
- package/dist/math/round.js +9 -8
- package/dist/math/round.js.map +1 -1
- package/dist/math/sum.cjs +2 -2
- package/dist/math/sum.cjs.map +1 -1
- package/dist/math/sum.d.ts +17 -0
- package/dist/math/sum.d.ts.map +1 -0
- package/dist/math/sum.js +11 -14
- package/dist/math/sum.js.map +1 -1
- package/dist/money/currency.cjs +2 -2
- package/dist/money/currency.cjs.map +1 -1
- package/dist/money/currency.d.ts +30 -0
- package/dist/money/currency.d.ts.map +1 -0
- package/dist/money/currency.js +19 -47
- package/dist/money/currency.js.map +1 -1
- package/dist/money/exchange.cjs +2 -2
- package/dist/money/exchange.cjs.map +1 -1
- package/dist/money/exchange.d.ts +29 -0
- package/dist/money/exchange.d.ts.map +1 -0
- package/dist/money/exchange.js +12 -12
- package/dist/money/exchange.js.map +1 -1
- package/dist/money/index.d.ts +4 -0
- package/dist/money/index.d.ts.map +1 -0
- package/dist/money/types.d.ts +9 -0
- package/dist/money/types.d.ts.map +1 -0
- package/dist/object/diff.cjs +2 -2
- package/dist/object/diff.cjs.map +1 -1
- package/dist/object/diff.d.ts +26 -0
- package/dist/object/diff.d.ts.map +1 -0
- package/dist/object/diff.js +19 -17
- package/dist/object/diff.js.map +1 -1
- package/dist/object/index.d.ts +9 -0
- package/dist/object/index.d.ts.map +1 -0
- package/dist/object/merge.cjs +2 -2
- package/dist/object/merge.cjs.map +1 -1
- package/dist/object/merge.d.ts +44 -0
- package/dist/object/merge.d.ts.map +1 -0
- package/dist/object/merge.js +27 -21
- package/dist/object/merge.js.map +1 -1
- package/dist/object/parseJSON.cjs +2 -2
- package/dist/object/parseJSON.cjs.map +1 -1
- package/dist/object/parseJSON.d.ts +32 -0
- package/dist/object/parseJSON.d.ts.map +1 -0
- package/dist/object/parseJSON.js +17 -18
- package/dist/object/parseJSON.js.map +1 -1
- package/dist/object/path.cjs +2 -2
- package/dist/object/path.cjs.map +1 -1
- package/dist/object/path.d.ts +32 -0
- package/dist/object/path.d.ts.map +1 -0
- package/dist/object/path.js +25 -23
- package/dist/object/path.js.map +1 -1
- package/dist/object/proxy.cjs +2 -0
- package/dist/object/proxy.cjs.map +1 -0
- package/dist/object/proxy.d.ts +30 -0
- package/dist/object/proxy.d.ts.map +1 -0
- package/dist/object/proxy.js +21 -0
- package/dist/object/proxy.js.map +1 -0
- package/dist/object/prune.cjs +2 -0
- package/dist/object/prune.cjs.map +1 -0
- package/dist/object/prune.d.ts +21 -0
- package/dist/object/prune.d.ts.map +1 -0
- package/dist/object/prune.js +31 -0
- package/dist/object/prune.js.map +1 -0
- package/dist/object/seek.cjs +2 -2
- package/dist/object/seek.cjs.map +1 -1
- package/dist/object/seek.d.ts +2 -0
- package/dist/object/seek.d.ts.map +1 -0
- package/dist/object/seek.js +25 -12
- package/dist/object/seek.js.map +1 -1
- package/dist/object/stash.cjs +2 -0
- package/dist/object/stash.cjs.map +1 -0
- package/dist/object/stash.d.ts +45 -0
- package/dist/object/stash.d.ts.map +1 -0
- package/dist/object/stash.js +99 -0
- package/dist/object/stash.js.map +1 -0
- package/dist/random/draw.cjs +2 -2
- package/dist/random/draw.cjs.map +1 -1
- package/dist/random/draw.d.ts +16 -0
- package/dist/random/draw.d.ts.map +1 -0
- package/dist/random/draw.js +13 -10
- package/dist/random/draw.js.map +1 -1
- package/dist/random/index.d.ts +5 -0
- package/dist/random/index.d.ts.map +1 -0
- package/dist/random/random.cjs +2 -2
- package/dist/random/random.cjs.map +1 -1
- package/dist/random/random.d.ts +14 -0
- package/dist/random/random.d.ts.map +1 -0
- package/dist/random/random.js +16 -9
- package/dist/random/random.js.map +1 -1
- package/dist/random/shuffle.cjs +2 -2
- package/dist/random/shuffle.cjs.map +1 -1
- package/dist/random/shuffle.d.ts +17 -0
- package/dist/random/shuffle.d.ts.map +1 -0
- package/dist/random/shuffle.js +18 -14
- package/dist/random/shuffle.js.map +1 -1
- package/dist/random/uuid.cjs +2 -2
- package/dist/random/uuid.cjs.map +1 -1
- package/dist/random/uuid.d.ts +12 -0
- package/dist/random/uuid.d.ts.map +1 -0
- package/dist/random/uuid.js +7 -9
- package/dist/random/uuid.js.map +1 -1
- package/dist/string/_caseUtils.cjs +2 -2
- package/dist/string/_caseUtils.cjs.map +1 -1
- package/dist/string/_caseUtils.d.ts +13 -0
- package/dist/string/_caseUtils.d.ts.map +1 -0
- package/dist/string/_caseUtils.js +8 -8
- package/dist/string/_caseUtils.js.map +1 -1
- package/dist/string/camelCase.cjs +2 -2
- package/dist/string/camelCase.cjs.map +1 -1
- package/dist/string/camelCase.d.ts +14 -0
- package/dist/string/camelCase.d.ts.map +1 -0
- package/dist/string/camelCase.js +8 -7
- package/dist/string/camelCase.js.map +1 -1
- package/dist/string/index.d.ts +7 -0
- package/dist/string/index.d.ts.map +1 -0
- package/dist/string/kebabCase.cjs +2 -2
- package/dist/string/kebabCase.cjs.map +1 -1
- package/dist/string/kebabCase.d.ts +15 -0
- package/dist/string/kebabCase.d.ts.map +1 -0
- package/dist/string/kebabCase.js +8 -7
- package/dist/string/kebabCase.js.map +1 -1
- package/dist/string/pascalCase.cjs +2 -2
- package/dist/string/pascalCase.cjs.map +1 -1
- package/dist/string/pascalCase.d.ts +15 -0
- package/dist/string/pascalCase.d.ts.map +1 -0
- package/dist/string/pascalCase.js +8 -7
- package/dist/string/pascalCase.js.map +1 -1
- package/dist/string/similarity.cjs +2 -2
- package/dist/string/similarity.cjs.map +1 -1
- package/dist/string/similarity.d.ts +20 -0
- package/dist/string/similarity.d.ts.map +1 -0
- package/dist/string/similarity.js +20 -36
- package/dist/string/similarity.js.map +1 -1
- package/dist/string/snakeCase.cjs +2 -2
- package/dist/string/snakeCase.cjs.map +1 -1
- package/dist/string/snakeCase.d.ts +15 -0
- package/dist/string/snakeCase.d.ts.map +1 -0
- package/dist/string/snakeCase.js +8 -7
- package/dist/string/snakeCase.js.map +1 -1
- package/dist/string/truncate.cjs +2 -2
- package/dist/string/truncate.cjs.map +1 -1
- package/dist/string/truncate.d.ts +28 -0
- package/dist/string/truncate.d.ts.map +1 -0
- package/dist/string/truncate.js +20 -17
- package/dist/string/truncate.js.map +1 -1
- package/dist/toolkit.cjs +2 -0
- package/dist/toolkit.cjs.map +1 -0
- package/dist/toolkit.js +1523 -0
- package/dist/toolkit.js.map +1 -0
- package/dist/typed/index.d.ts +24 -0
- package/dist/typed/index.d.ts.map +1 -0
- package/dist/typed/is.cjs +2 -2
- package/dist/typed/is.cjs.map +1 -1
- package/dist/typed/is.d.ts +95 -0
- package/dist/typed/is.d.ts.map +1 -0
- package/dist/typed/is.js +54 -42
- package/dist/typed/is.js.map +1 -1
- package/dist/typed/isArray.cjs +2 -2
- package/dist/typed/isArray.cjs.map +1 -1
- package/dist/typed/isArray.d.ts +16 -0
- package/dist/typed/isArray.d.ts.map +1 -0
- package/dist/typed/isArray.js +8 -8
- package/dist/typed/isArray.js.map +1 -1
- package/dist/typed/isBoolean.cjs +2 -2
- package/dist/typed/isBoolean.cjs.map +1 -1
- package/dist/typed/isBoolean.d.ts +23 -0
- package/dist/typed/isBoolean.d.ts.map +1 -0
- package/dist/typed/isBoolean.js +7 -6
- package/dist/typed/isBoolean.js.map +1 -1
- package/dist/typed/isDate.cjs +2 -2
- package/dist/typed/isDate.cjs.map +1 -1
- package/dist/typed/isDate.d.ts +16 -0
- package/dist/typed/isDate.d.ts.map +1 -0
- package/dist/typed/isDate.js +7 -8
- package/dist/typed/isDate.js.map +1 -1
- package/dist/typed/isDefined.cjs +2 -2
- package/dist/typed/isDefined.cjs.map +1 -1
- package/dist/typed/isDefined.d.ts +19 -0
- package/dist/typed/isDefined.d.ts.map +1 -0
- package/dist/typed/isDefined.js +7 -6
- package/dist/typed/isDefined.js.map +1 -1
- package/dist/typed/isEmpty.cjs +2 -2
- package/dist/typed/isEmpty.cjs.map +1 -1
- package/dist/typed/isEmpty.d.ts +24 -0
- package/dist/typed/isEmpty.d.ts.map +1 -0
- package/dist/typed/isEmpty.js +8 -9
- package/dist/typed/isEmpty.js.map +1 -1
- package/dist/typed/isEqual.cjs +2 -2
- package/dist/typed/isEqual.cjs.map +1 -1
- package/dist/typed/isEqual.d.ts +24 -0
- package/dist/typed/isEqual.d.ts.map +1 -0
- package/dist/typed/isEqual.js +27 -28
- package/dist/typed/isEqual.js.map +1 -1
- package/dist/typed/isEven.cjs +2 -2
- package/dist/typed/isEven.cjs.map +1 -1
- package/dist/typed/isEven.d.ts +9 -0
- package/dist/typed/isEven.d.ts.map +1 -0
- package/dist/typed/isEven.js +7 -6
- package/dist/typed/isEven.js.map +1 -1
- package/dist/typed/isFunction.cjs +2 -2
- package/dist/typed/isFunction.cjs.map +1 -1
- package/dist/typed/isFunction.d.ts +16 -0
- package/dist/typed/isFunction.d.ts.map +1 -0
- package/dist/typed/isFunction.js +7 -8
- package/dist/typed/isFunction.js.map +1 -1
- package/dist/typed/isMatch.cjs +2 -2
- package/dist/typed/isMatch.cjs.map +1 -1
- package/dist/typed/isMatch.d.ts +23 -0
- package/dist/typed/isMatch.d.ts.map +1 -0
- package/dist/typed/isMatch.js +16 -18
- package/dist/typed/isMatch.js.map +1 -1
- package/dist/typed/isNegative.cjs +2 -2
- package/dist/typed/isNegative.cjs.map +1 -1
- package/dist/typed/isNegative.d.ts +26 -0
- package/dist/typed/isNegative.d.ts.map +1 -0
- package/dist/typed/isNegative.js +7 -6
- package/dist/typed/isNegative.js.map +1 -1
- package/dist/typed/isNil.cjs +2 -2
- package/dist/typed/isNil.cjs.map +1 -1
- package/dist/typed/isNil.d.ts +17 -0
- package/dist/typed/isNil.d.ts.map +1 -0
- package/dist/typed/isNil.js +7 -8
- package/dist/typed/isNil.js.map +1 -1
- package/dist/typed/isNumber.cjs +2 -2
- package/dist/typed/isNumber.cjs.map +1 -1
- package/dist/typed/isNumber.d.ts +16 -0
- package/dist/typed/isNumber.d.ts.map +1 -0
- package/dist/typed/isNumber.js +8 -8
- package/dist/typed/isNumber.js.map +1 -1
- package/dist/typed/isObject.cjs +2 -2
- package/dist/typed/isObject.cjs.map +1 -1
- package/dist/typed/isObject.d.ts +19 -0
- package/dist/typed/isObject.d.ts.map +1 -0
- package/dist/typed/isObject.js +8 -8
- package/dist/typed/isObject.js.map +1 -1
- package/dist/typed/isOdd.cjs +2 -2
- package/dist/typed/isOdd.cjs.map +1 -1
- package/dist/typed/isOdd.d.ts +9 -0
- package/dist/typed/isOdd.d.ts.map +1 -0
- package/dist/typed/isOdd.js +7 -6
- package/dist/typed/isOdd.js.map +1 -1
- package/dist/typed/isPositive.cjs +2 -2
- package/dist/typed/isPositive.cjs.map +1 -1
- package/dist/typed/isPositive.d.ts +26 -0
- package/dist/typed/isPositive.d.ts.map +1 -0
- package/dist/typed/isPositive.js +7 -6
- package/dist/typed/isPositive.js.map +1 -1
- package/dist/typed/isPrimitive.cjs +2 -2
- package/dist/typed/isPrimitive.cjs.map +1 -1
- package/dist/typed/isPrimitive.d.ts +18 -0
- package/dist/typed/isPrimitive.d.ts.map +1 -0
- package/dist/typed/isPrimitive.js +8 -9
- package/dist/typed/isPrimitive.js.map +1 -1
- package/dist/typed/isPromise.cjs +2 -2
- package/dist/typed/isPromise.cjs.map +1 -1
- package/dist/typed/isPromise.d.ts +17 -0
- package/dist/typed/isPromise.d.ts.map +1 -0
- package/dist/typed/isPromise.js +7 -9
- package/dist/typed/isPromise.js.map +1 -1
- package/dist/typed/isRegex.cjs +2 -2
- package/dist/typed/isRegex.cjs.map +1 -1
- package/dist/typed/isRegex.d.ts +21 -0
- package/dist/typed/isRegex.d.ts.map +1 -0
- package/dist/typed/isRegex.js +7 -6
- package/dist/typed/isRegex.js.map +1 -1
- package/dist/typed/isString.cjs +2 -2
- package/dist/typed/isString.cjs.map +1 -1
- package/dist/typed/isString.d.ts +16 -0
- package/dist/typed/isString.d.ts.map +1 -0
- package/dist/typed/isString.js +8 -8
- package/dist/typed/isString.js.map +1 -1
- package/dist/typed/isWithin.cjs +2 -2
- package/dist/typed/isWithin.cjs.map +1 -1
- package/dist/typed/isWithin.d.ts +20 -0
- package/dist/typed/isWithin.d.ts.map +1 -0
- package/dist/typed/isWithin.js +9 -9
- package/dist/typed/isWithin.js.map +1 -1
- package/dist/typed/isZero.cjs +2 -2
- package/dist/typed/isZero.cjs.map +1 -1
- package/dist/typed/isZero.d.ts +25 -0
- package/dist/typed/isZero.d.ts.map +1 -0
- package/dist/typed/isZero.js +7 -6
- package/dist/typed/isZero.js.map +1 -1
- package/dist/typed/typeOf.cjs +2 -2
- package/dist/typed/typeOf.cjs.map +1 -1
- package/dist/typed/typeOf.d.ts +30 -0
- package/dist/typed/typeOf.d.ts.map +1 -0
- package/dist/typed/typeOf.js +11 -13
- package/dist/typed/typeOf.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +77 -12
- package/dist/array/aggregate.cjs +0 -2
- package/dist/array/aggregate.cjs.map +0 -1
- package/dist/array/aggregate.js +0 -16
- package/dist/array/aggregate.js.map +0 -1
- package/dist/array/alternate.cjs +0 -2
- package/dist/array/alternate.cjs.map +0 -1
- package/dist/array/alternate.js +0 -9
- package/dist/array/alternate.js.map +0 -1
- package/dist/array/arrange.cjs +0 -2
- package/dist/array/arrange.cjs.map +0 -1
- package/dist/array/arrange.js +0 -6
- package/dist/array/arrange.js.map +0 -1
- package/dist/array/compact.cjs +0 -2
- package/dist/array/compact.cjs.map +0 -1
- package/dist/array/compact.js +0 -9
- package/dist/array/compact.js.map +0 -1
- package/dist/array/every.cjs +0 -2
- package/dist/array/every.cjs.map +0 -1
- package/dist/array/every.js +0 -14
- package/dist/array/every.js.map +0 -1
- package/dist/array/filter.cjs +0 -2
- package/dist/array/filter.cjs.map +0 -1
- package/dist/array/filter.js +0 -14
- package/dist/array/filter.js.map +0 -1
- package/dist/array/find.cjs +0 -2
- package/dist/array/find.cjs.map +0 -1
- package/dist/array/find.js +0 -14
- package/dist/array/find.js.map +0 -1
- package/dist/array/findIndex.cjs +0 -2
- package/dist/array/findIndex.cjs.map +0 -1
- package/dist/array/findIndex.js +0 -14
- package/dist/array/findIndex.js.map +0 -1
- package/dist/array/findLast.cjs +0 -2
- package/dist/array/findLast.cjs.map +0 -1
- package/dist/array/findLast.js +0 -14
- package/dist/array/findLast.js.map +0 -1
- package/dist/array/flatten.cjs +0 -2
- package/dist/array/flatten.cjs.map +0 -1
- package/dist/array/flatten.js +0 -7
- package/dist/array/flatten.js.map +0 -1
- package/dist/array/map.cjs +0 -2
- package/dist/array/map.cjs.map +0 -1
- package/dist/array/map.js +0 -18
- package/dist/array/map.js.map +0 -1
- package/dist/array/reduce.cjs +0 -2
- package/dist/array/reduce.cjs.map +0 -1
- package/dist/array/reduce.js +0 -16
- package/dist/array/reduce.js.map +0 -1
- package/dist/array/shift.cjs +0 -2
- package/dist/array/shift.cjs.map +0 -1
- package/dist/array/shift.js +0 -13
- package/dist/array/shift.js.map +0 -1
- package/dist/array/some.cjs +0 -2
- package/dist/array/some.cjs.map +0 -1
- package/dist/array/some.js +0 -14
- package/dist/array/some.js.map +0 -1
- package/dist/array/substitute.cjs +0 -2
- package/dist/array/substitute.cjs.map +0 -1
- package/dist/array/substitute.js +0 -13
- package/dist/array/substitute.js.map +0 -1
- package/dist/async/delay.cjs +0 -2
- package/dist/async/delay.cjs.map +0 -1
- package/dist/async/delay.js +0 -8
- package/dist/async/delay.js.map +0 -1
- package/dist/function/proxy.cjs +0 -2
- package/dist/function/proxy.cjs.map +0 -1
- package/dist/function/proxy.js +0 -22
- package/dist/function/proxy.js.map +0 -1
- package/dist/function/prune.cjs +0 -2
- package/dist/function/prune.cjs.map +0 -1
- package/dist/function/prune.js +0 -30
- package/dist/function/prune.js.map +0 -1
- package/dist/function/worker.cjs +0 -14
- package/dist/function/worker.cjs.map +0 -1
- package/dist/function/worker.js +0 -29
- package/dist/function/worker.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logit/dist/logit.cjs +0 -2
- package/dist/logit/dist/logit.cjs.map +0 -1
- package/dist/logit/dist/logit.js +0 -263
- package/dist/logit/dist/logit.js.map +0 -1
- package/dist/math/add.cjs +0 -2
- package/dist/math/add.cjs.map +0 -1
- package/dist/math/add.js +0 -9
- package/dist/math/add.js.map +0 -1
- package/dist/math/boil.cjs +0 -2
- package/dist/math/boil.cjs.map +0 -1
- package/dist/math/boil.js +0 -17
- package/dist/math/boil.js.map +0 -1
- package/dist/math/divide.cjs +0 -2
- package/dist/math/divide.cjs.map +0 -1
- package/dist/math/divide.js +0 -11
- package/dist/math/divide.js.map +0 -1
- package/dist/math/multiply.cjs +0 -2
- package/dist/math/multiply.cjs.map +0 -1
- package/dist/math/multiply.js +0 -9
- package/dist/math/multiply.js.map +0 -1
- package/dist/math/rate.cjs +0 -2
- package/dist/math/rate.cjs.map +0 -1
- package/dist/math/rate.js +0 -9
- package/dist/math/rate.js.map +0 -1
- package/dist/math/subtract.cjs +0 -2
- package/dist/math/subtract.cjs.map +0 -1
- package/dist/math/subtract.js +0 -9
- package/dist/math/subtract.js.map +0 -1
- package/dist/object/cache.cjs +0 -2
- package/dist/object/cache.cjs.map +0 -1
- package/dist/object/cache.js +0 -63
- package/dist/object/cache.js.map +0 -1
- package/dist/object/clone.cjs +0 -2
- package/dist/object/clone.cjs.map +0 -1
- package/dist/object/clone.js +0 -17
- package/dist/object/clone.js.map +0 -1
- package/dist/object/entries.cjs +0 -2
- package/dist/object/entries.cjs.map +0 -1
- package/dist/object/entries.js +0 -9
- package/dist/object/entries.js.map +0 -1
- package/dist/object/keys.cjs +0 -2
- package/dist/object/keys.cjs.map +0 -1
- package/dist/object/keys.js +0 -9
- package/dist/object/keys.js.map +0 -1
- package/dist/object/values.cjs +0 -2
- package/dist/object/values.cjs.map +0 -1
- package/dist/object/values.js +0 -9
- package/dist/object/values.js.map +0 -1
- package/dist/typed/ge.cjs +0 -2
- package/dist/typed/ge.cjs.map +0 -1
- package/dist/typed/ge.js +0 -7
- package/dist/typed/ge.js.map +0 -1
- package/dist/typed/gt.cjs +0 -2
- package/dist/typed/gt.cjs.map +0 -1
- package/dist/typed/gt.js +0 -7
- package/dist/typed/gt.js.map +0 -1
- package/dist/typed/le.cjs +0 -2
- package/dist/typed/le.cjs.map +0 -1
- package/dist/typed/le.js +0 -7
- package/dist/typed/le.js.map +0 -1
- package/dist/typed/lt.cjs +0 -2
- package/dist/typed/lt.cjs.map +0 -1
- package/dist/typed/lt.js +0 -7
- package/dist/typed/lt.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ArgType = 'array' | 'boolean' | 'date' | 'error' | 'function' | 'map' | 'nan' | 'null' | 'number' | 'object' | 'promise' | 'regexp' | 'set' | 'string' | 'symbol' | 'weakmap' | 'weakset' | 'undefined';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the type of the given argument.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* typeOf(null); // 'null'
|
|
8
|
+
* typeOf(undefined); // 'undefined'
|
|
9
|
+
* typeOf(NaN); // 'nan'
|
|
10
|
+
* typeOf(async function() {}); // 'function'
|
|
11
|
+
* typeOf(123); // 'number'
|
|
12
|
+
* typeOf('abc'); // 'string'
|
|
13
|
+
* typeOf({}); // 'object'
|
|
14
|
+
* typeOf([]); // 'array'
|
|
15
|
+
* typeOf(() => {}); // 'function'
|
|
16
|
+
* typeOf(new Date()); // 'date'
|
|
17
|
+
* typeOf(new Error()); // 'error'
|
|
18
|
+
* typeOf(new Map()); // 'map'
|
|
19
|
+
* typeOf(new Set()); // 'set'
|
|
20
|
+
* typeOf(new WeakMap()); // 'weakmap'
|
|
21
|
+
* typeOf(new WeakSet()); // 'weakset'
|
|
22
|
+
* typeOf(new RegExp('')); // 'regexp'
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param arg - The argument whose type is to be determined.
|
|
26
|
+
*
|
|
27
|
+
* @returns The type of the argument.
|
|
28
|
+
*/
|
|
29
|
+
export declare function typeOf(arg: unknown): ArgType;
|
|
30
|
+
//# sourceMappingURL=typeOf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeOf.d.ts","sourceRoot":"","sources":["../../src/typed/typeOf.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GACf,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,GACP,UAAU,GACV,KAAK,GACL,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,WAAW,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAU5C"}
|
package/dist/typed/typeOf.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const n = Object.prototype.toString.call(e).slice(8, -1);
|
|
9
|
-
return n === "AsyncFunction" ? "promise" : n.toLowerCase();
|
|
1
|
+
//#region src/typed/typeOf.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (e === null) return "null";
|
|
4
|
+
if (e === void 0) return "undefined";
|
|
5
|
+
if (typeof e == "number" && Number.isNaN(e)) return "nan";
|
|
6
|
+
let t = Object.prototype.toString.call(e).slice(8, -1);
|
|
7
|
+
return t === "AsyncFunction" ? "function" : t.toLowerCase();
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=typeOf.js.map
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as typeOf };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=typeOf.js.map
|
package/dist/typed/typeOf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeOf.js","sources":["../../src/typed/typeOf.ts"],"sourcesContent":["export type ArgType =\n | 'array'\n | 'boolean'\n | 'date'\n | 'error'\n | 'function'\n | 'map'\n | 'nan'\n | 'null'\n | 'number'\n | 'object'\n | 'promise'\n | 'regexp'\n | 'set'\n | 'string'\n | 'symbol'\n | 'weakmap'\n | 'weakset'\n | 'undefined';\n\n
|
|
1
|
+
{"version":3,"file":"typeOf.js","names":[],"sources":["../../src/typed/typeOf.ts"],"sourcesContent":["export type ArgType =\n | 'array'\n | 'boolean'\n | 'date'\n | 'error'\n | 'function'\n | 'map'\n | 'nan'\n | 'null'\n | 'number'\n | 'object'\n | 'promise'\n | 'regexp'\n | 'set'\n | 'string'\n | 'symbol'\n | 'weakmap'\n | 'weakset'\n | 'undefined';\n\n/**\n * Returns the type of the given argument.\n *\n * @example\n * ```ts\n * typeOf(null); // 'null'\n * typeOf(undefined); // 'undefined'\n * typeOf(NaN); // 'nan'\n * typeOf(async function() {}); // 'function'\n * typeOf(123); // 'number'\n * typeOf('abc'); // 'string'\n * typeOf({}); // 'object'\n * typeOf([]); // 'array'\n * typeOf(() => {}); // 'function'\n * typeOf(new Date()); // 'date'\n * typeOf(new Error()); // 'error'\n * typeOf(new Map()); // 'map'\n * typeOf(new Set()); // 'set'\n * typeOf(new WeakMap()); // 'weakmap'\n * typeOf(new WeakSet()); // 'weakset'\n * typeOf(new RegExp('')); // 'regexp'\n * ```\n *\n * @param arg - The argument whose type is to be determined.\n *\n * @returns The type of the argument.\n */\nexport function typeOf(arg: unknown): ArgType {\n if (arg === null) return 'null';\n\n if (arg === undefined) return 'undefined';\n\n if (typeof arg === 'number' && Number.isNaN(arg)) return 'nan';\n\n const type = Object.prototype.toString.call(arg).slice(8, -1);\n\n return (type === 'AsyncFunction' ? 'function' : type.toLowerCase()) as ArgType;\n}\n"],"mappings":";AA+CA,SAAgB,EAAO,GAAuB;AAC5C,KAAI,MAAQ,KAAM,QAAO;AAEzB,KAAI,MAAQ,KAAA,EAAW,QAAO;AAE9B,KAAI,OAAO,KAAQ,YAAY,OAAO,MAAM,EAAI,CAAE,QAAO;CAEzD,IAAM,IAAO,OAAO,UAAU,SAAS,KAAK,EAAI,CAAC,MAAM,GAAG,GAAG;AAE7D,QAAQ,MAAS,kBAAkB,aAAa,EAAK,aAAa"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A function that tears down a subscription or listener registration. */
|
|
2
|
+
export type Unsubscribe = () => void;
|
|
3
|
+
export type Fn = (...args: any[]) => any;
|
|
4
|
+
export type Obj = Record<string, unknown>;
|
|
5
|
+
export type Predicate<T> = (value: T, index: number, array: readonly T[]) => boolean;
|
|
6
|
+
export type Sorter<T> = (a: T, b: T) => number;
|
|
7
|
+
export type Primitive = string | number | boolean;
|
|
8
|
+
export type Selector<T> = keyof T | ((item: T) => Primitive);
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,MAAM,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEzC,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC;AAErF,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAGlD,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/toolkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -10,15 +10,79 @@
|
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
13
15
|
"import": "./dist/index.js",
|
|
14
16
|
"require": "./dist/index.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./array": {
|
|
19
|
+
"source": "./src/array/index.ts",
|
|
20
|
+
"types": "./dist/array/index.d.ts",
|
|
21
|
+
"import": "./dist/array/index.js",
|
|
22
|
+
"require": "./dist/array/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./async": {
|
|
25
|
+
"source": "./src/async/index.ts",
|
|
26
|
+
"types": "./dist/async/index.d.ts",
|
|
27
|
+
"import": "./dist/async/index.js",
|
|
28
|
+
"require": "./dist/async/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./date": {
|
|
31
|
+
"source": "./src/date/index.ts",
|
|
32
|
+
"types": "./dist/date/index.d.ts",
|
|
33
|
+
"import": "./dist/date/index.js",
|
|
34
|
+
"require": "./dist/date/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./function": {
|
|
37
|
+
"source": "./src/function/index.ts",
|
|
38
|
+
"types": "./dist/function/index.d.ts",
|
|
39
|
+
"import": "./dist/function/index.js",
|
|
40
|
+
"require": "./dist/function/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./math": {
|
|
43
|
+
"source": "./src/math/index.ts",
|
|
44
|
+
"types": "./dist/math/index.d.ts",
|
|
45
|
+
"import": "./dist/math/index.js",
|
|
46
|
+
"require": "./dist/math/index.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./money": {
|
|
49
|
+
"source": "./src/money/index.ts",
|
|
50
|
+
"types": "./dist/money/index.d.ts",
|
|
51
|
+
"import": "./dist/money/index.js",
|
|
52
|
+
"require": "./dist/money/index.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./object": {
|
|
55
|
+
"source": "./src/object/index.ts",
|
|
56
|
+
"types": "./dist/object/index.d.ts",
|
|
57
|
+
"import": "./dist/object/index.js",
|
|
58
|
+
"require": "./dist/object/index.cjs"
|
|
59
|
+
},
|
|
60
|
+
"./random": {
|
|
61
|
+
"source": "./src/random/index.ts",
|
|
62
|
+
"types": "./dist/random/index.d.ts",
|
|
63
|
+
"import": "./dist/random/index.js",
|
|
64
|
+
"require": "./dist/random/index.cjs"
|
|
65
|
+
},
|
|
66
|
+
"./string": {
|
|
67
|
+
"source": "./src/string/index.ts",
|
|
68
|
+
"types": "./dist/string/index.d.ts",
|
|
69
|
+
"import": "./dist/string/index.js",
|
|
70
|
+
"require": "./dist/string/index.cjs"
|
|
71
|
+
},
|
|
72
|
+
"./typed": {
|
|
73
|
+
"source": "./src/typed/index.ts",
|
|
74
|
+
"types": "./dist/typed/index.d.ts",
|
|
75
|
+
"import": "./dist/typed/index.js",
|
|
76
|
+
"require": "./dist/typed/index.cjs"
|
|
15
77
|
}
|
|
16
78
|
},
|
|
17
79
|
"scripts": {
|
|
18
|
-
"build": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
80
|
+
"build": "vite build && pnpm run build:core && pnpm run build:types",
|
|
81
|
+
"build:core": "vite build --config vite.bundle.config.ts",
|
|
82
|
+
"build:types": "tsc -p tsconfig.declarations.json",
|
|
83
|
+
"fix": "eslint --fix src",
|
|
84
|
+
"lint": "eslint src",
|
|
85
|
+
"prepublishOnly": "pnpm run build",
|
|
22
86
|
"preview": "vite preview",
|
|
23
87
|
"test": "vitest"
|
|
24
88
|
},
|
|
@@ -26,13 +90,14 @@
|
|
|
26
90
|
"access": "public",
|
|
27
91
|
"registry": "https://registry.npmjs.org/"
|
|
28
92
|
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@vielzeug/logit": "workspace:*"
|
|
31
|
-
},
|
|
32
93
|
"devDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
94
|
+
"@types/node": "^25.5.0",
|
|
95
|
+
"@vielzeug/logit": "workspace:*",
|
|
96
|
+
"typescript": "~6.0.2",
|
|
97
|
+
"vite": "^8.0.3",
|
|
98
|
+
"vitest": "^4.1.2"
|
|
99
|
+
},
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"@vielzeug/logit": "workspace:*"
|
|
37
102
|
}
|
|
38
103
|
}
|
package/dist/array/aggregate.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../function/assert.cjs"),s=require("../typed/isArray.cjs");function n(t,r){u.assert(s.isArray(t),s.IS_ARRAY_ERROR_MSG,{args:{array:t},type:TypeError});const o={},g=typeof r=="function"?r:e=>e[r];for(const e of t){const i=g(e);o[i]=e}return o}n.fp=!0;exports.aggregate=n;
|
|
2
|
-
//# sourceMappingURL=aggregate.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.cjs","sources":["../../src/array/aggregate.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Selector } from '../types';\n\n/**\n * Aggregates an array of objects into an object based on a key generated by a selector function.\n *\n * @example\n * ```ts\n * const data = [{ a: 1 }, { a: 2 }, { a: 1 }];\n * aggregate(data, 'a') // { '1': { a: 1 }, '2': { a: 2 } };\n * ```\n *\n * @param array - The array to key.\n * @param selector - The function to generate the key for each element. It can be a string representing the key or a function that returns the key.\n *\n * @returns An object with keys as the generated values and values as the last element responsible for generating the key.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function aggregate<T, K extends keyof T, R extends T[K] extends string ? T[K] : never>(\n array: T[],\n selector: Selector<T>,\n): Record<R, T> {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n const result = {} as Record<R, T>;\n const getKey = typeof selector === 'function' ? selector : (item: T) => item[selector];\n\n for (const item of array) {\n const key = getKey(item) as R;\n\n result[key] = item;\n }\n\n return result;\n}\n\naggregate.fp = true;\n"],"names":["aggregate","array","selector","assert","isArray","IS_ARRAY_ERROR_MSG","result","getKey","item","key"],"mappings":"4JAoBO,SAASA,EACdC,EACAC,EACc,CACdC,EAAAA,OAAOC,EAAAA,QAAQH,CAAK,EAAGI,qBAAoB,CAAE,KAAM,CAAE,MAAAJ,CAAA,EAAS,KAAM,UAAW,EAE/E,MAAMK,EAAS,CAAA,EACTC,EAAS,OAAOL,GAAa,WAAaA,EAAYM,GAAYA,EAAKN,CAAQ,EAErF,UAAWM,KAAQP,EAAO,CACxB,MAAMQ,EAAMF,EAAOC,CAAI,EAEvBF,EAAOG,CAAG,EAAID,CAChB,CAEA,OAAOF,CACT,CAEAN,EAAU,GAAK"}
|
package/dist/array/aggregate.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { assert as p } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as s, isArray as i } from "../typed/isArray.js";
|
|
3
|
-
function g(o, r) {
|
|
4
|
-
p(i(o), s, { args: { array: o }, type: TypeError });
|
|
5
|
-
const e = {}, n = typeof r == "function" ? r : (t) => t[r];
|
|
6
|
-
for (const t of o) {
|
|
7
|
-
const f = n(t);
|
|
8
|
-
e[f] = t;
|
|
9
|
-
}
|
|
10
|
-
return e;
|
|
11
|
-
}
|
|
12
|
-
g.fp = !0;
|
|
13
|
-
export {
|
|
14
|
-
g as aggregate
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=aggregate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","sources":["../../src/array/aggregate.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Selector } from '../types';\n\n/**\n * Aggregates an array of objects into an object based on a key generated by a selector function.\n *\n * @example\n * ```ts\n * const data = [{ a: 1 }, { a: 2 }, { a: 1 }];\n * aggregate(data, 'a') // { '1': { a: 1 }, '2': { a: 2 } };\n * ```\n *\n * @param array - The array to key.\n * @param selector - The function to generate the key for each element. It can be a string representing the key or a function that returns the key.\n *\n * @returns An object with keys as the generated values and values as the last element responsible for generating the key.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function aggregate<T, K extends keyof T, R extends T[K] extends string ? T[K] : never>(\n array: T[],\n selector: Selector<T>,\n): Record<R, T> {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n const result = {} as Record<R, T>;\n const getKey = typeof selector === 'function' ? selector : (item: T) => item[selector];\n\n for (const item of array) {\n const key = getKey(item) as R;\n\n result[key] = item;\n }\n\n return result;\n}\n\naggregate.fp = true;\n"],"names":["aggregate","array","selector","assert","isArray","IS_ARRAY_ERROR_MSG","result","getKey","item","key"],"mappings":";;AAoBO,SAASA,EACdC,GACAC,GACc;AACd,EAAAC,EAAOC,EAAQH,CAAK,GAAGI,GAAoB,EAAE,MAAM,EAAE,OAAAJ,EAAA,GAAS,MAAM,WAAW;AAE/E,QAAMK,IAAS,CAAA,GACTC,IAAS,OAAOL,KAAa,aAAaA,IAAW,CAACM,MAAYA,EAAKN,CAAQ;AAErF,aAAWM,KAAQP,GAAO;AACxB,UAAMQ,IAAMF,EAAOC,CAAI;AAEvB,IAAAF,EAAOG,CAAG,IAAID;AAAA,EAChB;AAEA,SAAOF;AACT;AAEAN,EAAU,KAAK;"}
|
package/dist/array/alternate.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(n,e,t,p={}){const{strategy:u="append"}=p,i=t?d=>t(d)===t(e):d=>d===e,c=n.findIndex(i);return c!==-1?[...n.slice(0,c),...n.slice(c+1)]:u==="prepend"?[e,...n]:[...n,e]}o.fp=!0;exports.alternate=o;
|
|
2
|
-
//# sourceMappingURL=alternate.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alternate.cjs","sources":["../../src/array/alternate.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Either adds or removes an item from an array, based on whether it already exists in the array.\n *\n * @example\n * ```ts\n * alternate([1, 2, 3], 4) // [1, 2, 3, 4]\n * alternate([1, 2, 3], 2) // [1, 3]\n *\n * alternate(\n * [{ id: 1 }, { id: 2 }],\n * { id: 3 },\n * (obj) => obj.id,\n * { strategy: 'prepend' }\n * ) // [{ id: 3 }, { id: 1 }, { id: 2 }]\n * ```\n *\n * @param array - The array to modify.\n * @param item - The item to add or remove.\n * @param selector - A function to determine the uniqueness of the item.\n * @param [options] - Options for the alternate operation.\n * @param [options.strategy] - The strategy to use when adding the item ('prepend' or 'append').\n *\n * @returns A new array with the item added or removed.\n */\nexport function alternate<T>(\n array: T[],\n item: T,\n selector?: (item: T) => Primitive,\n options: { strategy?: 'prepend' | 'append' } = {},\n): T[] {\n const { strategy = 'append' } = options;\n const compareFn = selector ? (el: T) => selector(el) === selector(item) : (el: T) => el === item;\n\n const index = array.findIndex(compareFn);\n\n if (index !== -1) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n }\n\n return strategy === 'prepend' ? [item, ...array] : [...array, item];\n}\n\nalternate.fp = true;\n"],"names":["alternate","array","item","selector","options","strategy","compareFn","el","index"],"mappings":"gFA0BO,SAASA,EACdC,EACAC,EACAC,EACAC,EAA+C,CAAA,EAC1C,CACL,KAAM,CAAE,SAAAC,EAAW,QAAA,EAAaD,EAC1BE,EAAYH,EAAYI,GAAUJ,EAASI,CAAE,IAAMJ,EAASD,CAAI,EAAKK,GAAUA,IAAOL,EAEtFM,EAAQP,EAAM,UAAUK,CAAS,EAEvC,OAAIE,IAAU,GACL,CAAC,GAAGP,EAAM,MAAM,EAAGO,CAAK,EAAG,GAAGP,EAAM,MAAMO,EAAQ,CAAC,CAAC,EAGtDH,IAAa,UAAY,CAACH,EAAM,GAAGD,CAAK,EAAI,CAAC,GAAGA,EAAOC,CAAI,CACpE,CAEAF,EAAU,GAAK"}
|
package/dist/array/alternate.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
function s(n, e, p, d = {}) {
|
|
2
|
-
const { strategy: f = "append" } = d, o = p ? (c) => p(c) === p(e) : (c) => c === e, t = n.findIndex(o);
|
|
3
|
-
return t !== -1 ? [...n.slice(0, t), ...n.slice(t + 1)] : f === "prepend" ? [e, ...n] : [...n, e];
|
|
4
|
-
}
|
|
5
|
-
s.fp = !0;
|
|
6
|
-
export {
|
|
7
|
-
s as alternate
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=alternate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alternate.js","sources":["../../src/array/alternate.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Either adds or removes an item from an array, based on whether it already exists in the array.\n *\n * @example\n * ```ts\n * alternate([1, 2, 3], 4) // [1, 2, 3, 4]\n * alternate([1, 2, 3], 2) // [1, 3]\n *\n * alternate(\n * [{ id: 1 }, { id: 2 }],\n * { id: 3 },\n * (obj) => obj.id,\n * { strategy: 'prepend' }\n * ) // [{ id: 3 }, { id: 1 }, { id: 2 }]\n * ```\n *\n * @param array - The array to modify.\n * @param item - The item to add or remove.\n * @param selector - A function to determine the uniqueness of the item.\n * @param [options] - Options for the alternate operation.\n * @param [options.strategy] - The strategy to use when adding the item ('prepend' or 'append').\n *\n * @returns A new array with the item added or removed.\n */\nexport function alternate<T>(\n array: T[],\n item: T,\n selector?: (item: T) => Primitive,\n options: { strategy?: 'prepend' | 'append' } = {},\n): T[] {\n const { strategy = 'append' } = options;\n const compareFn = selector ? (el: T) => selector(el) === selector(item) : (el: T) => el === item;\n\n const index = array.findIndex(compareFn);\n\n if (index !== -1) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n }\n\n return strategy === 'prepend' ? [item, ...array] : [...array, item];\n}\n\nalternate.fp = true;\n"],"names":["alternate","array","item","selector","options","strategy","compareFn","el","index"],"mappings":"AA0BO,SAASA,EACdC,GACAC,GACAC,GACAC,IAA+C,CAAA,GAC1C;AACL,QAAM,EAAE,UAAAC,IAAW,SAAA,IAAaD,GAC1BE,IAAYH,IAAW,CAACI,MAAUJ,EAASI,CAAE,MAAMJ,EAASD,CAAI,IAAI,CAACK,MAAUA,MAAOL,GAEtFM,IAAQP,EAAM,UAAUK,CAAS;AAEvC,SAAIE,MAAU,KACL,CAAC,GAAGP,EAAM,MAAM,GAAGO,CAAK,GAAG,GAAGP,EAAM,MAAMO,IAAQ,CAAC,CAAC,IAGtDH,MAAa,YAAY,CAACH,GAAM,GAAGD,CAAK,IAAI,CAAC,GAAGA,GAAOC,CAAI;AACpE;AAEAF,EAAU,KAAK;"}
|
package/dist/array/arrange.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrange.cjs","sources":["../../src/array/arrange.ts"],"sourcesContent":["import { compareBy } from '../function/compareBy';\n\n/**\n * Arranges (sorts) an array of objects based on multiple selectors.\n *\n * @example\n * ```ts\n * const data = [\n * { name: 'Alice', age: 30 },\n * { name: 'Bob', age: 25 },\n * { name: 'Charlie', age: 35 },\n * { name: 'Alice', age: 25 },\n * { name: 'Bob', age: 30 },\n * { name: 'Charlie', age: 30 },\n * ].arrange(data, { name: 'asc', age: 'desc' }); // [ { name: 'Alice', age: 30 }, { name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }, { name: 'Bob', age: 25 }, { name: 'Charlie', age: 35 }, { name: 'Charlie', age: 30 } ]\n * ```\n *\n * @param array - The array to sort.\n * @param selectors - An object where keys are the properties to sort by and values are 'asc' or 'desc'.\n * @returns A new sorted array.\n */\nexport const arrange = <T>(array: T[], selectors: Partial<Record<keyof T, 'asc' | 'desc'>>) => {\n return [...array].sort(compareBy(selectors));\n};\n"],"names":["arrange","array","selectors","compareBy"],"mappings":"6HAqBaA,EAAU,CAAIC,EAAYC,IAC9B,CAAC,GAAGD,CAAK,EAAE,KAAKE,EAAAA,UAAUD,CAAS,CAAC"}
|
package/dist/array/arrange.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrange.js","sources":["../../src/array/arrange.ts"],"sourcesContent":["import { compareBy } from '../function/compareBy';\n\n/**\n * Arranges (sorts) an array of objects based on multiple selectors.\n *\n * @example\n * ```ts\n * const data = [\n * { name: 'Alice', age: 30 },\n * { name: 'Bob', age: 25 },\n * { name: 'Charlie', age: 35 },\n * { name: 'Alice', age: 25 },\n * { name: 'Bob', age: 30 },\n * { name: 'Charlie', age: 30 },\n * ].arrange(data, { name: 'asc', age: 'desc' }); // [ { name: 'Alice', age: 30 }, { name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }, { name: 'Bob', age: 25 }, { name: 'Charlie', age: 35 }, { name: 'Charlie', age: 30 } ]\n * ```\n *\n * @param array - The array to sort.\n * @param selectors - An object where keys are the properties to sort by and values are 'asc' or 'desc'.\n * @returns A new sorted array.\n */\nexport const arrange = <T>(array: T[], selectors: Partial<Record<keyof T, 'asc' | 'desc'>>) => {\n return [...array].sort(compareBy(selectors));\n};\n"],"names":["arrange","array","selectors","compareBy"],"mappings":";AAqBO,MAAMA,IAAU,CAAIC,GAAYC,MAC9B,CAAC,GAAGD,CAAK,EAAE,KAAKE,EAAUD,CAAS,CAAC;"}
|
package/dist/array/compact.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../function/assert.cjs"),r=require("../typed/isArray.cjs");function o(e){return t.assert(r.isArray(e),r.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError}),e.filter(Boolean)}exports.compact=o;
|
|
2
|
-
//# sourceMappingURL=compact.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact.cjs","sources":["../../src/array/compact.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\n\n/**\n * Removes falsy values from an array.\n *\n * @example\n * ```ts\n * const arr = [0, 1, false, 2, '', 3];\n * compact(arr); // [1, 2, 3]\n * ```\n *\n * @param array - The array to compact.\n *\n * @returns A new array with falsy values removed.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function compact<T>(array: T[]): NonNullable<T>[] {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n return array.filter(Boolean) as NonNullable<T>[];\n}\n"],"names":["compact","array","assert","isArray","IS_ARRAY_ERROR_MSG"],"mappings":"4JAkBO,SAASA,EAAWC,EAA8B,CACvDC,OAAAA,EAAAA,OAAOC,EAAAA,QAAQF,CAAK,EAAGG,qBAAoB,CAAE,KAAM,CAAE,MAAAH,CAAA,EAAS,KAAM,UAAW,EAExEA,EAAM,OAAO,OAAO,CAC7B"}
|
package/dist/array/compact.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { assert as o } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as t, isArray as e } from "../typed/isArray.js";
|
|
3
|
-
function m(r) {
|
|
4
|
-
return o(e(r), t, { args: { array: r }, type: TypeError }), r.filter(Boolean);
|
|
5
|
-
}
|
|
6
|
-
export {
|
|
7
|
-
m as compact
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=compact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact.js","sources":["../../src/array/compact.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\n\n/**\n * Removes falsy values from an array.\n *\n * @example\n * ```ts\n * const arr = [0, 1, false, 2, '', 3];\n * compact(arr); // [1, 2, 3]\n * ```\n *\n * @param array - The array to compact.\n *\n * @returns A new array with falsy values removed.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function compact<T>(array: T[]): NonNullable<T>[] {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n return array.filter(Boolean) as NonNullable<T>[];\n}\n"],"names":["compact","array","assert","isArray","IS_ARRAY_ERROR_MSG"],"mappings":";;AAkBO,SAASA,EAAWC,GAA8B;AACvD,SAAAC,EAAOC,EAAQF,CAAK,GAAGG,GAAoB,EAAE,MAAM,EAAE,OAAAH,EAAA,GAAS,MAAM,WAAW,GAExEA,EAAM,OAAO,OAAO;AAC7B;"}
|
package/dist/array/every.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../function/assert.cjs"),t=require("../typed/isArray.cjs");function s(e,i){n.assert(t.isArray(e),t.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});for(let r=0;r<e.length;r++)if(!i(e[r],r,e))return!1;return!0}s.fp=!0;exports.every=s;
|
|
2
|
-
//# sourceMappingURL=every.cjs.map
|
package/dist/array/every.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"every.cjs","sources":["../../src/array/every.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Checks if all elements in an array pass a predicate function.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * every(arr, isEven); // false\n * ```\n *\n * @param array - The array to check.\n * @param predicate - The predicate function to test each element.\n *\n * @returns true if all elements pass the predicate test, else false.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function every<T>(array: T[], predicate: Predicate<T>) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = 0; index < array.length; index++) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n\n return true;\n}\n\nevery.fp = true;\n"],"names":["every","array","predicate","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":"4JAqBO,SAASA,EAASC,EAAYC,EAAyB,CAC5DC,EAAAA,OAAOC,EAAAA,QAAQH,CAAK,EAAGI,qBAAoB,CAAE,KAAM,CAAE,MAAAJ,CAAA,EAAS,KAAM,UAAW,EAE/E,QAASK,EAAQ,EAAGA,EAAQL,EAAM,OAAQK,IACxC,GAAI,CAACJ,EAAUD,EAAMK,CAAK,EAAGA,EAAOL,CAAK,EACvC,MAAO,GAIX,MAAO,EACT,CAEAD,EAAM,GAAK"}
|
package/dist/array/every.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { assert as o } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as f, isArray as i } from "../typed/isArray.js";
|
|
3
|
-
function n(e, t) {
|
|
4
|
-
o(i(e), f, { args: { array: e }, type: TypeError });
|
|
5
|
-
for (let r = 0; r < e.length; r++)
|
|
6
|
-
if (!t(e[r], r, e))
|
|
7
|
-
return !1;
|
|
8
|
-
return !0;
|
|
9
|
-
}
|
|
10
|
-
n.fp = !0;
|
|
11
|
-
export {
|
|
12
|
-
n as every
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=every.js.map
|
package/dist/array/every.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"every.js","sources":["../../src/array/every.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Checks if all elements in an array pass a predicate function.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * every(arr, isEven); // false\n * ```\n *\n * @param array - The array to check.\n * @param predicate - The predicate function to test each element.\n *\n * @returns true if all elements pass the predicate test, else false.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function every<T>(array: T[], predicate: Predicate<T>) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = 0; index < array.length; index++) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n\n return true;\n}\n\nevery.fp = true;\n"],"names":["every","array","predicate","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":";;AAqBO,SAASA,EAASC,GAAYC,GAAyB;AAC5D,EAAAC,EAAOC,EAAQH,CAAK,GAAGI,GAAoB,EAAE,MAAM,EAAE,OAAAJ,EAAA,GAAS,MAAM,WAAW;AAE/E,WAASK,IAAQ,GAAGA,IAAQL,EAAM,QAAQK;AACxC,QAAI,CAACJ,EAAUD,EAAMK,CAAK,GAAGA,GAAOL,CAAK;AACvC,aAAO;AAIX,SAAO;AACT;AAEAD,EAAM,KAAK;"}
|
package/dist/array/filter.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../function/assert.cjs"),s=require("../typed/isArray.cjs");function i(e,n){o.assert(s.isArray(e),s.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});const r=[];for(let t=0;t<e.length;t++)n(e[t],t,e)&&r.push(e[t]);return r}i.fp=!0;exports.filter=i;
|
|
2
|
-
//# sourceMappingURL=filter.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter.cjs","sources":["../../src/array/filter.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Filters an array based on a predicate function.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * filter(arr, isEven); // [2, 4]\n * ```\n *\n * @param array - The array to filter.\n * @param predicate - The predicate function to test each element.\n *\n * @returns A new array with elements that pass the predicate test.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function filter<T>(array: T[], predicate: Predicate<T>) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n const result: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n result.push(array[index]);\n }\n }\n\n return result;\n}\n\nfilter.fp = true;\n"],"names":["filter","array","predicate","assert","isArray","IS_ARRAY_ERROR_MSG","result","index"],"mappings":"4JAqBO,SAASA,EAAUC,EAAYC,EAAyB,CAC7DC,EAAAA,OAAOC,EAAAA,QAAQH,CAAK,EAAGI,qBAAoB,CAAE,KAAM,CAAE,MAAAJ,CAAA,EAAS,KAAM,UAAW,EAE/E,MAAMK,EAAc,CAAA,EAEpB,QAASC,EAAQ,EAAGA,EAAQN,EAAM,OAAQM,IACpCL,EAAUD,EAAMM,CAAK,EAAGA,EAAON,CAAK,GACtCK,EAAO,KAAKL,EAAMM,CAAK,CAAC,EAI5B,OAAOD,CACT,CAEAN,EAAO,GAAK"}
|
package/dist/array/filter.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { assert as f } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as i, isArray as p } from "../typed/isArray.js";
|
|
3
|
-
function s(t, r) {
|
|
4
|
-
f(p(t), i, { args: { array: t }, type: TypeError });
|
|
5
|
-
const o = [];
|
|
6
|
-
for (let e = 0; e < t.length; e++)
|
|
7
|
-
r(t[e], e, t) && o.push(t[e]);
|
|
8
|
-
return o;
|
|
9
|
-
}
|
|
10
|
-
s.fp = !0;
|
|
11
|
-
export {
|
|
12
|
-
s as filter
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=filter.js.map
|
package/dist/array/filter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sources":["../../src/array/filter.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Filters an array based on a predicate function.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * filter(arr, isEven); // [2, 4]\n * ```\n *\n * @param array - The array to filter.\n * @param predicate - The predicate function to test each element.\n *\n * @returns A new array with elements that pass the predicate test.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function filter<T>(array: T[], predicate: Predicate<T>) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n const result: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n result.push(array[index]);\n }\n }\n\n return result;\n}\n\nfilter.fp = true;\n"],"names":["filter","array","predicate","assert","isArray","IS_ARRAY_ERROR_MSG","result","index"],"mappings":";;AAqBO,SAASA,EAAUC,GAAYC,GAAyB;AAC7D,EAAAC,EAAOC,EAAQH,CAAK,GAAGI,GAAoB,EAAE,MAAM,EAAE,OAAAJ,EAAA,GAAS,MAAM,WAAW;AAE/E,QAAMK,IAAc,CAAA;AAEpB,WAASC,IAAQ,GAAGA,IAAQN,EAAM,QAAQM;AACxC,IAAIL,EAAUD,EAAMM,CAAK,GAAGA,GAAON,CAAK,KACtCK,EAAO,KAAKL,EAAMM,CAAK,CAAC;AAI5B,SAAOD;AACT;AAEAN,EAAO,KAAK;"}
|
package/dist/array/find.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../function/assert.cjs"),r=require("../typed/isArray.cjs");function i(e,n,s){o.assert(r.isArray(e),r.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});for(let t=0;t<e.length;t++)if(n(e[t],t,e))return e[t];return s}i.fp=!0;exports.find=i;
|
|
2
|
-
//# sourceMappingURL=find.cjs.map
|
package/dist/array/find.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find.cjs","sources":["../../src/array/find.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Finds the first element in an array that satisfies a predicate function.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * find(arr, isEven); // 2\n * find(arr, (num) => num > 5, 0); // 0\n * find(arr, (num) => num > 5); // undefined\n * ```\n *\n * @param array - The array to search through.\n * @param predicate - A function that is called for each element in the array.\n * @param [defaultValue] - (optional) value to return if no element satisfies the predicate.\n *\n * @return The first element in the array that satisfies the predicate, or the default value if none match.\n */\nexport function find<T>(array: T[], predicate: Predicate<T>, defaultValue?: T) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n return array[index];\n }\n }\n\n return defaultValue;\n}\n\nfind.fp = true;\n"],"names":["find","array","predicate","defaultValue","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":"4JAsBO,SAASA,EAAQC,EAAYC,EAAyBC,EAAkB,CAC7EC,EAAAA,OAAOC,EAAAA,QAAQJ,CAAK,EAAGK,qBAAoB,CAAE,KAAM,CAAE,MAAAL,CAAA,EAAS,KAAM,UAAW,EAE/E,QAASM,EAAQ,EAAGA,EAAQN,EAAM,OAAQM,IACxC,GAAIL,EAAUD,EAAMM,CAAK,EAAGA,EAAON,CAAK,EACtC,OAAOA,EAAMM,CAAK,EAItB,OAAOJ,CACT,CAEAH,EAAK,GAAK"}
|
package/dist/array/find.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { assert as f } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as i, isArray as n } from "../typed/isArray.js";
|
|
3
|
-
function p(t, o, r) {
|
|
4
|
-
f(n(t), i, { args: { array: t }, type: TypeError });
|
|
5
|
-
for (let e = 0; e < t.length; e++)
|
|
6
|
-
if (o(t[e], e, t))
|
|
7
|
-
return t[e];
|
|
8
|
-
return r;
|
|
9
|
-
}
|
|
10
|
-
p.fp = !0;
|
|
11
|
-
export {
|
|
12
|
-
p as find
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=find.js.map
|
package/dist/array/find.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","sources":["../../src/array/find.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Finds the first element in an array that satisfies a predicate function.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * find(arr, isEven); // 2\n * find(arr, (num) => num > 5, 0); // 0\n * find(arr, (num) => num > 5); // undefined\n * ```\n *\n * @param array - The array to search through.\n * @param predicate - A function that is called for each element in the array.\n * @param [defaultValue] - (optional) value to return if no element satisfies the predicate.\n *\n * @return The first element in the array that satisfies the predicate, or the default value if none match.\n */\nexport function find<T>(array: T[], predicate: Predicate<T>, defaultValue?: T) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n return array[index];\n }\n }\n\n return defaultValue;\n}\n\nfind.fp = true;\n"],"names":["find","array","predicate","defaultValue","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":";;AAsBO,SAASA,EAAQC,GAAYC,GAAyBC,GAAkB;AAC7E,EAAAC,EAAOC,EAAQJ,CAAK,GAAGK,GAAoB,EAAE,MAAM,EAAE,OAAAL,EAAA,GAAS,MAAM,WAAW;AAE/E,WAASM,IAAQ,GAAGA,IAAQN,EAAM,QAAQM;AACxC,QAAIL,EAAUD,EAAMM,CAAK,GAAGA,GAAON,CAAK;AACtC,aAAOA,EAAMM,CAAK;AAItB,SAAOJ;AACT;AAEAH,EAAK,KAAK;"}
|
package/dist/array/findIndex.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../function/assert.cjs"),r=require("../typed/isArray.cjs");function n(e,i){s.assert(r.isArray(e),r.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});for(let t=0;t<e.length;t++)if(i(e[t],t,e))return t;return-1}n.fp=!0;exports.findIndex=n;
|
|
2
|
-
//# sourceMappingURL=findIndex.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findIndex.cjs","sources":["../../src/array/findIndex.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Finds the first element in an array that satisfies a predicate function. If no such element is found, returns -1.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * findIndex(arr, isEven); // 1\n * findIndex(arr, (num) => num > 5); // -1\n * ```\n *\n * @param array - The array to search.\n * @param predicate - A function that is called for each element in the array.\n *\n * @return The index of the first element that satisfies the predicate, or -1 if no such element is found.\n */\nexport function findIndex<T>(array: T[], predicate: Predicate<T>) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n\n return -1;\n}\n\nfindIndex.fp = true;\n"],"names":["findIndex","array","predicate","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":"4JAoBO,SAASA,EAAaC,EAAYC,EAAyB,CAChEC,EAAAA,OAAOC,EAAAA,QAAQH,CAAK,EAAGI,qBAAoB,CAAE,KAAM,CAAE,MAAAJ,CAAA,EAAS,KAAM,UAAW,EAE/E,QAASK,EAAQ,EAAGA,EAAQL,EAAM,OAAQK,IACxC,GAAIJ,EAAUD,EAAMK,CAAK,EAAGA,EAAOL,CAAK,EACtC,OAAOK,EAIX,MAAO,EACT,CAEAN,EAAU,GAAK"}
|
package/dist/array/findIndex.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { assert as n } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as o, isArray as f } from "../typed/isArray.js";
|
|
3
|
-
function i(e, r) {
|
|
4
|
-
n(f(e), o, { args: { array: e }, type: TypeError });
|
|
5
|
-
for (let t = 0; t < e.length; t++)
|
|
6
|
-
if (r(e[t], t, e))
|
|
7
|
-
return t;
|
|
8
|
-
return -1;
|
|
9
|
-
}
|
|
10
|
-
i.fp = !0;
|
|
11
|
-
export {
|
|
12
|
-
i as findIndex
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=findIndex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findIndex.js","sources":["../../src/array/findIndex.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Finds the first element in an array that satisfies a predicate function. If no such element is found, returns -1.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * findIndex(arr, isEven); // 1\n * findIndex(arr, (num) => num > 5); // -1\n * ```\n *\n * @param array - The array to search.\n * @param predicate - A function that is called for each element in the array.\n *\n * @return The index of the first element that satisfies the predicate, or -1 if no such element is found.\n */\nexport function findIndex<T>(array: T[], predicate: Predicate<T>) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n\n return -1;\n}\n\nfindIndex.fp = true;\n"],"names":["findIndex","array","predicate","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":";;AAoBO,SAASA,EAAaC,GAAYC,GAAyB;AAChE,EAAAC,EAAOC,EAAQH,CAAK,GAAGI,GAAoB,EAAE,MAAM,EAAE,OAAAJ,EAAA,GAAS,MAAM,WAAW;AAE/E,WAASK,IAAQ,GAAGA,IAAQL,EAAM,QAAQK;AACxC,QAAIJ,EAAUD,EAAMK,CAAK,GAAGA,GAAOL,CAAK;AACtC,aAAOK;AAIX,SAAO;AACT;AAEAN,EAAU,KAAK;"}
|
package/dist/array/findLast.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../function/assert.cjs"),r=require("../typed/isArray.cjs");function s(e,i,n){o.assert(r.isArray(e),r.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});for(let t=e.length-1;t>=0;t--)if(i(e[t],t,e))return e[t];return n}s.fp=!0;exports.findLast=s;
|
|
2
|
-
//# sourceMappingURL=findLast.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findLast.cjs","sources":["../../src/array/findLast.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Finds the last element in the array that satisfies the provided predicate function.\n * If no such element is found, returns the specified default value (if provided).\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * findLast(arr, isEven); // 4\n * findLast(arr, (num) => num > 5, 0); // 0\n * findLast(arr, (num) => num > 5); // undefined\n * ```\n *\n * @param array - The array to search through.\n * @param predicate - A function to test each element of the array.\n * @param [defaultValue] - The value to return if no element satisfies the predicate.\n *\n * @return The last element in the array that satisfies the predicate, or the default value if none match.\n */\nexport function findLast<T>(array: T[], predicate: Predicate<T>, defaultValue?: T) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = array.length - 1; index >= 0; index--) {\n if (predicate(array[index], index, array)) {\n return array[index];\n }\n }\n\n return defaultValue;\n}\n\nfindLast.fp = true;\n"],"names":["findLast","array","predicate","defaultValue","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":"4JAuBO,SAASA,EAAYC,EAAYC,EAAyBC,EAAkB,CACjFC,EAAAA,OAAOC,EAAAA,QAAQJ,CAAK,EAAGK,qBAAoB,CAAE,KAAM,CAAE,MAAAL,CAAA,EAAS,KAAM,UAAW,EAE/E,QAASM,EAAQN,EAAM,OAAS,EAAGM,GAAS,EAAGA,IAC7C,GAAIL,EAAUD,EAAMM,CAAK,EAAGA,EAAON,CAAK,EACtC,OAAOA,EAAMM,CAAK,EAItB,OAAOJ,CACT,CAEAH,EAAS,GAAK"}
|
package/dist/array/findLast.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { assert as f } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as i, isArray as n } from "../typed/isArray.js";
|
|
3
|
-
function p(t, o, r) {
|
|
4
|
-
f(n(t), i, { args: { array: t }, type: TypeError });
|
|
5
|
-
for (let e = t.length - 1; e >= 0; e--)
|
|
6
|
-
if (o(t[e], e, t))
|
|
7
|
-
return t[e];
|
|
8
|
-
return r;
|
|
9
|
-
}
|
|
10
|
-
p.fp = !0;
|
|
11
|
-
export {
|
|
12
|
-
p as findLast
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=findLast.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findLast.js","sources":["../../src/array/findLast.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport type { Predicate } from '../types';\n\n/**\n * Finds the last element in the array that satisfies the provided predicate function.\n * If no such element is found, returns the specified default value (if provided).\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * const isEven = (num) => num % 2 === 0;\n * findLast(arr, isEven); // 4\n * findLast(arr, (num) => num > 5, 0); // 0\n * findLast(arr, (num) => num > 5); // undefined\n * ```\n *\n * @param array - The array to search through.\n * @param predicate - A function to test each element of the array.\n * @param [defaultValue] - The value to return if no element satisfies the predicate.\n *\n * @return The last element in the array that satisfies the predicate, or the default value if none match.\n */\nexport function findLast<T>(array: T[], predicate: Predicate<T>, defaultValue?: T) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n for (let index = array.length - 1; index >= 0; index--) {\n if (predicate(array[index], index, array)) {\n return array[index];\n }\n }\n\n return defaultValue;\n}\n\nfindLast.fp = true;\n"],"names":["findLast","array","predicate","defaultValue","assert","isArray","IS_ARRAY_ERROR_MSG","index"],"mappings":";;AAuBO,SAASA,EAAYC,GAAYC,GAAyBC,GAAkB;AACjF,EAAAC,EAAOC,EAAQJ,CAAK,GAAGK,GAAoB,EAAE,MAAM,EAAE,OAAAL,EAAA,GAAS,MAAM,WAAW;AAE/E,WAASM,IAAQN,EAAM,SAAS,GAAGM,KAAS,GAAGA;AAC7C,QAAIL,EAAUD,EAAMM,CAAK,GAAGA,GAAON,CAAK;AACtC,aAAOA,EAAMM,CAAK;AAItB,SAAOJ;AACT;AAEAH,EAAS,KAAK;"}
|
package/dist/array/flatten.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.cjs","sources":["../../src/array/flatten.ts"],"sourcesContent":["type FlatArray<T> = T extends readonly (infer U)[] ? U : T;\n\n/**\n * Flattens a nested array into a single-level array.\n *\n * @example\n * ```ts\n * const arr = [1, [2, [3, [4, [5]]]]];\n * flatten(arr) // [1, 2, 3, 4, 5];\n * ```\n *\n * @param array - The array to flatten.\n *\n * @returns A single-level array.\n */\nexport function flatten<T>(array: T[]): FlatArray<T>[] {\n return array.flat(Number.POSITIVE_INFINITY) as FlatArray<T>[];\n}\n"],"names":["flatten","array"],"mappings":"gFAeO,SAASA,EAAWC,EAA4B,CACrD,OAAOA,EAAM,KAAK,OAAO,iBAAiB,CAC5C"}
|
package/dist/array/flatten.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.js","sources":["../../src/array/flatten.ts"],"sourcesContent":["type FlatArray<T> = T extends readonly (infer U)[] ? U : T;\n\n/**\n * Flattens a nested array into a single-level array.\n *\n * @example\n * ```ts\n * const arr = [1, [2, [3, [4, [5]]]]];\n * flatten(arr) // [1, 2, 3, 4, 5];\n * ```\n *\n * @param array - The array to flatten.\n *\n * @returns A single-level array.\n */\nexport function flatten<T>(array: T[]): FlatArray<T>[] {\n return array.flat(Number.POSITIVE_INFINITY) as FlatArray<T>[];\n}\n"],"names":["flatten","array"],"mappings":"AAeO,SAASA,EAAWC,GAA4B;AACrD,SAAOA,EAAM,KAAK,OAAO,iBAAiB;AAC5C;"}
|
package/dist/array/map.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../function/assert.cjs"),i=require("../typed/isArray.cjs"),u=require("../typed/isPromise.cjs");function o(e,s){n.assert(i.isArray(e),i.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});const t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=s(e[r],r,e);return u.isPromise(s)?Promise.all(t):t}o.fp=!0;exports.map=o;
|
|
2
|
-
//# sourceMappingURL=map.cjs.map
|
package/dist/array/map.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map.cjs","sources":["../../src/array/map.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport { isPromise } from '../typed/isPromise';\nimport type { CallbackDynamic, ResultArray } from '../types';\n\n/**\n * Transforms an array by applying a callback function to each of its elements.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3];\n * map(arr, x => x * 2); // [2, 4, 6]\n * map(arr, async x => x * 2); // Promise<[2, 4, 6]>\n * ```\n *\n * @param array - The array to be transformed.\n * @param callback - The function to invoke for each element in the array.\n *\n * @return The transformed array, either as a synchronous result or a Promise if lazy is set.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function map<T, R, C extends CallbackDynamic<T, R>>(array: T[], callback: C): ResultArray<C> {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, {\n args: { array },\n type: TypeError,\n });\n\n const result = Array(array.length);\n\n for (let index = 0; index < array.length; index++) {\n result[index] = callback(array[index], index, array);\n }\n\n return (isPromise(callback) ? Promise.all(result) : result) as ResultArray<C>;\n}\n\nmap.fp = true;\n"],"names":["map","array","callback","assert","isArray","IS_ARRAY_ERROR_MSG","result","index","isPromise"],"mappings":"gMAsBO,SAASA,EAA2CC,EAAYC,EAA6B,CAClGC,EAAAA,OAAOC,EAAAA,QAAQH,CAAK,EAAGI,qBAAoB,CACzC,KAAM,CAAE,MAAAJ,CAAA,EACR,KAAM,SAAA,CACP,EAED,MAAMK,EAAS,MAAML,EAAM,MAAM,EAEjC,QAASM,EAAQ,EAAGA,EAAQN,EAAM,OAAQM,IACxCD,EAAOC,CAAK,EAAIL,EAASD,EAAMM,CAAK,EAAGA,EAAON,CAAK,EAGrD,OAAQO,EAAAA,UAAUN,CAAQ,EAAI,QAAQ,IAAII,CAAM,EAAIA,CACtD,CAEAN,EAAI,GAAK"}
|
package/dist/array/map.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { assert as i } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as m, isArray as s } from "../typed/isArray.js";
|
|
3
|
-
import { isPromise as p } from "../typed/isPromise.js";
|
|
4
|
-
function n(t, r) {
|
|
5
|
-
i(s(t), m, {
|
|
6
|
-
args: { array: t },
|
|
7
|
-
type: TypeError
|
|
8
|
-
});
|
|
9
|
-
const o = Array(t.length);
|
|
10
|
-
for (let e = 0; e < t.length; e++)
|
|
11
|
-
o[e] = r(t[e], e, t);
|
|
12
|
-
return p(r) ? Promise.all(o) : o;
|
|
13
|
-
}
|
|
14
|
-
n.fp = !0;
|
|
15
|
-
export {
|
|
16
|
-
n as map
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=map.js.map
|
package/dist/array/map.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","sources":["../../src/array/map.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport { isPromise } from '../typed/isPromise';\nimport type { CallbackDynamic, ResultArray } from '../types';\n\n/**\n * Transforms an array by applying a callback function to each of its elements.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3];\n * map(arr, x => x * 2); // [2, 4, 6]\n * map(arr, async x => x * 2); // Promise<[2, 4, 6]>\n * ```\n *\n * @param array - The array to be transformed.\n * @param callback - The function to invoke for each element in the array.\n *\n * @return The transformed array, either as a synchronous result or a Promise if lazy is set.\n *\n * @throws {TypeError} If the provided array is not an array.\n */\nexport function map<T, R, C extends CallbackDynamic<T, R>>(array: T[], callback: C): ResultArray<C> {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, {\n args: { array },\n type: TypeError,\n });\n\n const result = Array(array.length);\n\n for (let index = 0; index < array.length; index++) {\n result[index] = callback(array[index], index, array);\n }\n\n return (isPromise(callback) ? Promise.all(result) : result) as ResultArray<C>;\n}\n\nmap.fp = true;\n"],"names":["map","array","callback","assert","isArray","IS_ARRAY_ERROR_MSG","result","index","isPromise"],"mappings":";;;AAsBO,SAASA,EAA2CC,GAAYC,GAA6B;AAClG,EAAAC,EAAOC,EAAQH,CAAK,GAAGI,GAAoB;AAAA,IACzC,MAAM,EAAE,OAAAJ,EAAA;AAAA,IACR,MAAM;AAAA,EAAA,CACP;AAED,QAAMK,IAAS,MAAML,EAAM,MAAM;AAEjC,WAASM,IAAQ,GAAGA,IAAQN,EAAM,QAAQM;AACxC,IAAAD,EAAOC,CAAK,IAAIL,EAASD,EAAMM,CAAK,GAAGA,GAAON,CAAK;AAGrD,SAAQO,EAAUN,CAAQ,IAAI,QAAQ,IAAII,CAAM,IAAIA;AACtD;AAEAN,EAAI,KAAK;"}
|
package/dist/array/reduce.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../function/assert.cjs"),n=require("../typed/isArray.cjs"),R=require("../typed/isPromise.cjs");function u(e,r,o){f.assert(n.isArray(e),n.IS_ARRAY_ERROR_MSG,{args:{array:e},type:TypeError});const i=R.isPromise(r);let t=i?Promise.resolve(o):o;for(let s=0;s<e.length;s++)i?t=t.then(c=>r(c,e[s],s,e)):t=r(t,e[s],s,e);return t}u.fn=!0;exports.reduce=u;
|
|
2
|
-
//# sourceMappingURL=reduce.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reduce.cjs","sources":["../../src/array/reduce.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport { isPromise } from '../typed/isPromise';\nimport type { Result } from '../types';\n\ntype SyncCallback<R, T> = (prev: R, curr: T, index: number, array: T[]) => R;\ntype AsyncCallback<R, T> = (prev: R, curr: T, index: number, array: T[]) => Promise<R>;\ntype Callback<R, T> = SyncCallback<R, T> | AsyncCallback<R, T>;\n\n/**\n * Reduces an array to a single value by applying a callback function\n * to each element in the array, passing the accumulated result and\n * the current element as arguments. Supports both synchronous and\n * asynchronous callback functions.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3];\n * reduce(arr, (acc, curr) => acc + curr, 0); // 10\n * await reduce(arr, async (acc, curr) => acc + curr, 0); // 10\n * ```\n *\n * @param array - The array to reduce.\n * @param callback - The callback function to apply to each element.\n * @param initialValue - The initial value for the accumulator.\n *\n * @returns The reduced value, or a Promise that resolves to the reduced value if the callback is asynchronous.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function reduce<T, R, C extends Callback<R, T>>(array: T[], callback: C, initialValue: R) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n const lazy = isPromise(callback);\n\n let acc: R | Promise<R> = lazy ? Promise.resolve(initialValue) : initialValue;\n\n for (let i = 0; i < array.length; i++) {\n if (lazy) {\n acc = (acc as Promise<R>).then((resolvedAcc) => callback(resolvedAcc, array[i], i, array));\n } else {\n acc = callback(acc as R, array[i], i, array);\n }\n }\n\n return acc as Result<C>;\n}\n\nreduce.fn = true;\n"],"names":["reduce","array","callback","initialValue","assert","isArray","IS_ARRAY_ERROR_MSG","lazy","isPromise","acc","i","resolvedAcc"],"mappings":"gMA8BO,SAASA,EAAuCC,EAAYC,EAAaC,EAAiB,CAC/FC,EAAAA,OAAOC,EAAAA,QAAQJ,CAAK,EAAGK,qBAAoB,CAAE,KAAM,CAAE,MAAAL,CAAA,EAAS,KAAM,UAAW,EAE/E,MAAMM,EAAOC,EAAAA,UAAUN,CAAQ,EAE/B,IAAIO,EAAsBF,EAAO,QAAQ,QAAQJ,CAAY,EAAIA,EAEjE,QAASO,EAAI,EAAGA,EAAIT,EAAM,OAAQS,IAC5BH,EACFE,EAAOA,EAAmB,KAAME,GAAgBT,EAASS,EAAaV,EAAMS,CAAC,EAAGA,EAAGT,CAAK,CAAC,EAEzFQ,EAAMP,EAASO,EAAUR,EAAMS,CAAC,EAAGA,EAAGT,CAAK,EAI/C,OAAOQ,CACT,CAEAT,EAAO,GAAK"}
|
package/dist/array/reduce.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { assert as i } from "../function/assert.js";
|
|
2
|
-
import { IS_ARRAY_ERROR_MSG as n, isArray as p } from "../typed/isArray.js";
|
|
3
|
-
import { isPromise as R } from "../typed/isPromise.js";
|
|
4
|
-
function u(e, r, s) {
|
|
5
|
-
i(p(e), n, { args: { array: e }, type: TypeError });
|
|
6
|
-
const m = R(r);
|
|
7
|
-
let t = m ? Promise.resolve(s) : s;
|
|
8
|
-
for (let o = 0; o < e.length; o++)
|
|
9
|
-
m ? t = t.then((f) => r(f, e[o], o, e)) : t = r(t, e[o], o, e);
|
|
10
|
-
return t;
|
|
11
|
-
}
|
|
12
|
-
u.fn = !0;
|
|
13
|
-
export {
|
|
14
|
-
u as reduce
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=reduce.js.map
|
package/dist/array/reduce.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reduce.js","sources":["../../src/array/reduce.ts"],"sourcesContent":["import { assert } from '../function/assert';\nimport { IS_ARRAY_ERROR_MSG, isArray } from '../typed/isArray';\nimport { isPromise } from '../typed/isPromise';\nimport type { Result } from '../types';\n\ntype SyncCallback<R, T> = (prev: R, curr: T, index: number, array: T[]) => R;\ntype AsyncCallback<R, T> = (prev: R, curr: T, index: number, array: T[]) => Promise<R>;\ntype Callback<R, T> = SyncCallback<R, T> | AsyncCallback<R, T>;\n\n/**\n * Reduces an array to a single value by applying a callback function\n * to each element in the array, passing the accumulated result and\n * the current element as arguments. Supports both synchronous and\n * asynchronous callback functions.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3];\n * reduce(arr, (acc, curr) => acc + curr, 0); // 10\n * await reduce(arr, async (acc, curr) => acc + curr, 0); // 10\n * ```\n *\n * @param array - The array to reduce.\n * @param callback - The callback function to apply to each element.\n * @param initialValue - The initial value for the accumulator.\n *\n * @returns The reduced value, or a Promise that resolves to the reduced value if the callback is asynchronous.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function reduce<T, R, C extends Callback<R, T>>(array: T[], callback: C, initialValue: R) {\n assert(isArray(array), IS_ARRAY_ERROR_MSG, { args: { array }, type: TypeError });\n\n const lazy = isPromise(callback);\n\n let acc: R | Promise<R> = lazy ? Promise.resolve(initialValue) : initialValue;\n\n for (let i = 0; i < array.length; i++) {\n if (lazy) {\n acc = (acc as Promise<R>).then((resolvedAcc) => callback(resolvedAcc, array[i], i, array));\n } else {\n acc = callback(acc as R, array[i], i, array);\n }\n }\n\n return acc as Result<C>;\n}\n\nreduce.fn = true;\n"],"names":["reduce","array","callback","initialValue","assert","isArray","IS_ARRAY_ERROR_MSG","lazy","isPromise","acc","i","resolvedAcc"],"mappings":";;;AA8BO,SAASA,EAAuCC,GAAYC,GAAaC,GAAiB;AAC/F,EAAAC,EAAOC,EAAQJ,CAAK,GAAGK,GAAoB,EAAE,MAAM,EAAE,OAAAL,EAAA,GAAS,MAAM,WAAW;AAE/E,QAAMM,IAAOC,EAAUN,CAAQ;AAE/B,MAAIO,IAAsBF,IAAO,QAAQ,QAAQJ,CAAY,IAAIA;AAEjE,WAASO,IAAI,GAAGA,IAAIT,EAAM,QAAQS;AAChC,IAAIH,IACFE,IAAOA,EAAmB,KAAK,CAACE,MAAgBT,EAASS,GAAaV,EAAMS,CAAC,GAAGA,GAAGT,CAAK,CAAC,IAEzFQ,IAAMP,EAASO,GAAUR,EAAMS,CAAC,GAAGA,GAAGT,CAAK;AAI/C,SAAOQ;AACT;AAEAT,EAAO,KAAK;"}
|