@vielzeug/toolkit 1.1.3 → 2.0.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
package/dist/index.d.ts
CHANGED
|
@@ -1,2813 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
|
|
78
|
-
* @returns Array of allocated amounts (sum equals original amount)
|
|
79
|
-
* @throws {Error} If ratios array is empty or contains negative values
|
|
80
|
-
*/
|
|
81
|
-
export declare function allocate(amount: number, ratios: number[]): number[];
|
|
82
|
-
|
|
83
|
-
export declare function allocate(amount: bigint, ratios: number[]): bigint[];
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Either adds or removes an item from an array, based on whether it already exists in the array.
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```ts
|
|
90
|
-
* alternate([1, 2, 3], 4) // [1, 2, 3, 4]
|
|
91
|
-
* alternate([1, 2, 3], 2) // [1, 3]
|
|
92
|
-
*
|
|
93
|
-
* alternate(
|
|
94
|
-
* [{ id: 1 }, { id: 2 }],
|
|
95
|
-
* { id: 3 },
|
|
96
|
-
* (obj) => obj.id,
|
|
97
|
-
* { strategy: 'prepend' }
|
|
98
|
-
* ) // [{ id: 3 }, { id: 1 }, { id: 2 }]
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* @param array - The array to modify.
|
|
102
|
-
* @param item - The item to add or remove.
|
|
103
|
-
* @param selector - A function to determine the uniqueness of the item.
|
|
104
|
-
* @param [options] - Options for the alternate operation.
|
|
105
|
-
* @param [options.strategy] - The strategy to use when adding the item ('prepend' or 'append').
|
|
106
|
-
*
|
|
107
|
-
* @returns A new array with the item added or removed.
|
|
108
|
-
*/
|
|
109
|
-
export declare function alternate<T>(array: T[], item: T, selector?: (item: T) => Primitive, options?: {
|
|
110
|
-
strategy?: 'prepend' | 'append';
|
|
111
|
-
}): T[];
|
|
112
|
-
|
|
113
|
-
export declare namespace alternate {
|
|
114
|
-
var fp: boolean;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export declare type ArgType = 'array' | 'boolean' | 'date' | 'error' | 'function' | 'map' | 'nan' | 'null' | 'number' | 'object' | 'promise' | 'regexp' | 'set' | 'string' | 'symbol' | 'weakmap' | 'weakset' | 'undefined';
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Arranges (sorts) an array of objects based on multiple selectors.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```ts
|
|
124
|
-
* const data = [
|
|
125
|
-
* { name: 'Alice', age: 30 },
|
|
126
|
-
* { name: 'Bob', age: 25 },
|
|
127
|
-
* { name: 'Charlie', age: 35 },
|
|
128
|
-
* { name: 'Alice', age: 25 },
|
|
129
|
-
* { name: 'Bob', age: 30 },
|
|
130
|
-
* { name: 'Charlie', age: 30 },
|
|
131
|
-
* ].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 } ]
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* @param array - The array to sort.
|
|
135
|
-
* @param selectors - An object where keys are the properties to sort by and values are 'asc' or 'desc'.
|
|
136
|
-
* @returns A new sorted array.
|
|
137
|
-
*/
|
|
138
|
-
export declare const arrange: <T>(array: T[], selectors: Partial<Record<keyof T, "asc" | "desc">>) => T[];
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Asserts that the condition is true. If the condition is false, it throws an error
|
|
142
|
-
* with the provided message or logs a warning in soft mode.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```ts
|
|
146
|
-
* assert(Array.isArray([])); // Does nothing
|
|
147
|
-
* assert(typeof foo === 'string', 'This is an error message'); // Throws an error
|
|
148
|
-
* assert(x > 0, 'x must be positive', { args: { x } }); // Throws with argument details
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* @param condition - The condition to assert, or an array of conditions.
|
|
152
|
-
* @param [message] - The error message to throw. Default is 'Assertion failed'.
|
|
153
|
-
* @param options - Assertion options.
|
|
154
|
-
* @param [options.type] - The error class to throw (default: `Error`).
|
|
155
|
-
* @param [options.args] - Additional debugging information (e.g., variable values).
|
|
156
|
-
* @param [options.bypass] - If `true`, logs a warning instead of throwing an error.
|
|
157
|
-
*
|
|
158
|
-
* @throws {Error} If the condition is false and `bypass` is not set to `true`.
|
|
159
|
-
*/
|
|
160
|
-
declare function assert_2(condition: boolean | boolean[], message?: string, { type, args, bypass }?: {
|
|
161
|
-
type?: ErrorConstructor;
|
|
162
|
-
args?: Obj;
|
|
163
|
-
bypass?: boolean;
|
|
164
|
-
}): void;
|
|
165
|
-
export { assert_2 as assert }
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Asserts that the specified keys are present in the params object and are not empty strings.
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* ```ts
|
|
172
|
-
* const params = { id: '123', name: '' };
|
|
173
|
-
* assertParams(params, ['id']); // Does nothing
|
|
174
|
-
* assertParams(params, ['id', 'name'], 'UserUpdate'); // Throws: Missing required parameter: "name" in "UserUpdate"
|
|
175
|
-
* ```
|
|
176
|
-
*
|
|
177
|
-
* @param params - The object containing the parameters to check.
|
|
178
|
-
* @param keys - An array of keys that must be present and non-empty in the params object.
|
|
179
|
-
* @param [name] - An optional name for the context of the assertion (e.g., function name).
|
|
180
|
-
* @param [options] - Assertion options.
|
|
181
|
-
* @param [options.type] - The error class to throw (default: `Error`).
|
|
182
|
-
* @param [options.bypass] - If `true`, logs a warning instead of throwing an error.
|
|
183
|
-
*
|
|
184
|
-
* @throws {Error} If any of the required keys are missing or are empty strings.
|
|
185
|
-
*/
|
|
186
|
-
export declare function assertParams<T extends object, K extends keyof T>(params: T, keys: K[], name?: string, options?: {
|
|
187
|
-
type?: ErrorConstructor;
|
|
188
|
-
bypass?: boolean;
|
|
189
|
-
}): asserts params is T & Required<Pick<T, K>>;
|
|
190
|
-
|
|
191
|
-
declare type AsyncCallback<R, T> = (prev: R, curr: T, index: number, array: T[]) => Promise<R>;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Attempts to execute a function with advanced error handling and retry logic.
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```ts
|
|
198
|
-
* const unreliableFunction = async () => {
|
|
199
|
-
* if (Math.random() < 0.7) throw new Error ('Random failure');
|
|
200
|
-
* return 'Success!';
|
|
201
|
-
* };
|
|
202
|
-
*
|
|
203
|
-
* await attempt(
|
|
204
|
-
* unreliableFunction,
|
|
205
|
-
* { retries: 3, silent: false, timeout: 5000 }); // Success! (or undefined if all attempts failed)
|
|
206
|
-
* ```
|
|
207
|
-
*
|
|
208
|
-
* @param fn - The function to be executed.
|
|
209
|
-
* @param [options] - Configuration options for the attempt.
|
|
210
|
-
* @param [options.identifier] - Custom identifier for logging purposes.
|
|
211
|
-
* @param [options.retries=0] - Number of retry attempts if the function fails.
|
|
212
|
-
* @param [options.silent=false] - If true, suppresses error logging.
|
|
213
|
-
* @param [options.timeout=7000] - Timeout in milliseconds for function execution.
|
|
214
|
-
*
|
|
215
|
-
* @returns The result of the function or undefined if it failed.
|
|
216
|
-
*/
|
|
217
|
-
export declare function attempt<T extends Fn, R = Awaited<ReturnType<T>>>(fn: T, { silent, retries, timeout, identifier }?: AttemptOptions): Promise<R | undefined>;
|
|
218
|
-
|
|
219
|
-
declare type AttemptOptions = {
|
|
220
|
-
identifier?: string;
|
|
221
|
-
retries?: number;
|
|
222
|
-
silent?: boolean;
|
|
223
|
-
timeout?: number;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Calculates the average of an array of numbers or dates.
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* ```ts
|
|
231
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
232
|
-
* average(arr); // 3
|
|
233
|
-
* average(arr, (num) => num * 2); // 6
|
|
234
|
-
* average(arr, (num) => new Date(Date.now() + 1000 * 60 * 60 * 24 * num); // Date object representing 3 days from now
|
|
235
|
-
* ```
|
|
236
|
-
*
|
|
237
|
-
* @param array - The array of numbers or dates to average.
|
|
238
|
-
* @param callback - (optional) A callback function to map the values.
|
|
239
|
-
* @returns The average of the numbers or dates in the array.
|
|
240
|
-
*/
|
|
241
|
-
export declare function average<T>(array: T[], callback?: (item: T) => number | Date): number | Date | undefined;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Boils down an array to a single value by applying a callback function to each pair of elements.
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* ```ts
|
|
248
|
-
* boil([1, 2, 3]) // 3
|
|
249
|
-
* boil([1, 2, 3], (a, b) => a > b ? a : b) // 3
|
|
250
|
-
* boil([1, 2, 3], (a, b) => a + b) // 6
|
|
251
|
-
* boil([{ a: 1 }, { a: 2 }, { a: 3 }], (a, b) => ({ a: a.a + b.a })) // { a: 6 }
|
|
252
|
-
* boil([], (a, b) => a + b) // undefined
|
|
253
|
-
* boil([1], (a, b) => a + b) // 1
|
|
254
|
-
* ```
|
|
255
|
-
*
|
|
256
|
-
* @param array - The array to be boiled down.
|
|
257
|
-
* @param callback - The function to invoke for each pair of elements in the array.
|
|
258
|
-
*
|
|
259
|
-
* @return The boiled down value, or `undefined` if the array is empty.
|
|
260
|
-
*/
|
|
261
|
-
export declare function boil<T>(array: readonly T[], callback: (a: T, b: T) => T): T | undefined;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Creates a generic key-value cache with automatic garbage collection and observer support.
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* ```ts
|
|
268
|
-
* const myCache = cache<string>();
|
|
269
|
-
* myCache.set(['user', 1], 'John Doe');
|
|
270
|
-
* const value = myCache.get(['user', 1]); // 'John Doe'
|
|
271
|
-
* myCache.scheduleGc(['user', 1], 5000); // Auto-delete after 5s
|
|
272
|
-
* ```
|
|
273
|
-
*
|
|
274
|
-
* @template T - The type of values stored in the cache.
|
|
275
|
-
*
|
|
276
|
-
* @returns A cache instance with get, set, delete, clear, and GC methods.
|
|
277
|
-
*/
|
|
278
|
-
export declare function cache<T>(): {
|
|
279
|
-
clear: () => void;
|
|
280
|
-
delete: (key: readonly unknown[]) => boolean;
|
|
281
|
-
get: (key: readonly unknown[]) => T | undefined;
|
|
282
|
-
getMeta: (key: readonly unknown[]) => Record<string, unknown> | undefined;
|
|
283
|
-
getMetaByHash: (keyHash: string) => Record<string, unknown> | undefined;
|
|
284
|
-
hash: (key: readonly unknown[]) => string;
|
|
285
|
-
listMetaHashes: () => string[];
|
|
286
|
-
scheduleGc: (key: readonly unknown[], delayMs: number) => void;
|
|
287
|
-
set: (key: readonly unknown[], value: T) => void;
|
|
288
|
-
setMeta: (key: readonly unknown[], meta: Record<string, unknown>) => void;
|
|
289
|
-
size: () => number;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
/** biome-ignore-all lint/suspicious/noExplicitAny: - */
|
|
293
|
-
export declare type Callback<T = any, R = any> = (value: T, index: number, array: T[]) => R;
|
|
294
|
-
|
|
295
|
-
declare type Callback_2<R, T> = SyncCallback<R, T> | AsyncCallback<R, T>;
|
|
296
|
-
|
|
297
|
-
export declare type CallbackAsync<T = any, R = any> = (value: T, index: number, array: T[]) => Promise<R>;
|
|
298
|
-
|
|
299
|
-
export declare type CallbackDynamic<T = any, R = any> = (value: T, index: number, array: T[]) => R | Promise<R>;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Converts a string to camel case.
|
|
303
|
-
*
|
|
304
|
-
* @example
|
|
305
|
-
* ```ts
|
|
306
|
-
* const text = 'hello world';
|
|
307
|
-
* camelCase(text); // 'helloWorld'
|
|
308
|
-
* ```
|
|
309
|
-
*
|
|
310
|
-
* @param str - The string to convert.
|
|
311
|
-
* @returns The converted string.
|
|
312
|
-
*/
|
|
313
|
-
export declare function camelCase(str: string): string;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Splits an array or string into chunks of a specified size.
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* ```ts
|
|
320
|
-
* chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
|
|
321
|
-
* chunk("hello", 2) // ["he", "ll", "o"]
|
|
322
|
-
* chunk("hello", 2, { overlap: true }) // [" h", "he", "el", "ll", "lo", "o "]
|
|
323
|
-
* ```
|
|
324
|
-
*
|
|
325
|
-
* @param input - The input array or string to be chunked.
|
|
326
|
-
* @param size - The size of each chunk.
|
|
327
|
-
* @param [options] - Additional options for chunking.
|
|
328
|
-
* @param [options.overlap] -
|
|
329
|
-
* @param [options.pad] -
|
|
330
|
-
*
|
|
331
|
-
* @returns An array of chunks.
|
|
332
|
-
*
|
|
333
|
-
* @throws {RangeError} If the chunk size is invalid.
|
|
334
|
-
* @throws {TypeError} If the input type is invalid.
|
|
335
|
-
*/
|
|
336
|
-
export declare function chunk<T>(input: T[] | string, size?: number, options?: ChunkOptions): ChunkResult<T>;
|
|
337
|
-
|
|
338
|
-
declare type ChunkOptions = {
|
|
339
|
-
overlap?: boolean;
|
|
340
|
-
pad?: string;
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
declare type ChunkResult<T> = (T extends string ? string : T[])[];
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* The `clamp` function restricts a number to be within a specified range.
|
|
347
|
-
*
|
|
348
|
-
* @example
|
|
349
|
-
* ```ts
|
|
350
|
-
* clamp(5, 1, 10) // 5
|
|
351
|
-
* clamp(0, 1, 10) // 1
|
|
352
|
-
* clamp(15, 1, 10) // 10
|
|
353
|
-
* ```
|
|
354
|
-
*
|
|
355
|
-
* @param n - The number to be clamped.
|
|
356
|
-
* @param min - The minimum value of the range.
|
|
357
|
-
* @param max - The maximum value of the range.
|
|
358
|
-
*
|
|
359
|
-
* @returns The clamped number.
|
|
360
|
-
*/
|
|
361
|
-
export declare function clamp(n: number, min: number, max: number): number;
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Creates a deep copy of the provided data using the structuredClone algorithm.
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* ```ts
|
|
368
|
-
* const obj = { a: 1, b: { c: 2 } };
|
|
369
|
-
* const dup = clone(obj);
|
|
370
|
-
*
|
|
371
|
-
* dup.b.c = 3;
|
|
372
|
-
* console.log(obj.b.c); // logs 2
|
|
373
|
-
* console.log(dup.b.c); // logs 3
|
|
374
|
-
* ```
|
|
375
|
-
*
|
|
376
|
-
* @param item - The data to clone.
|
|
377
|
-
*
|
|
378
|
-
* @returns A deep copy of the provided data.
|
|
379
|
-
*
|
|
380
|
-
* @throws {Error} If the item cannot be cloned.
|
|
381
|
-
*/
|
|
382
|
-
export declare function clone<T>(item: T): T;
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Removes falsy values from an array.
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* ```ts
|
|
389
|
-
* const arr = [0, 1, false, 2, '', 3];
|
|
390
|
-
* compact(arr); // [1, 2, 3]
|
|
391
|
-
* ```
|
|
392
|
-
*
|
|
393
|
-
* @param array - The array to compact.
|
|
394
|
-
*
|
|
395
|
-
* @returns A new array with falsy values removed.
|
|
396
|
-
*
|
|
397
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
398
|
-
*/
|
|
399
|
-
export declare function compact<T>(array: T[]): NonNullable<T>[];
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Compares two values and returns:
|
|
403
|
-
* - 0 if they are equal
|
|
404
|
-
* - 1 if the first value is greater
|
|
405
|
-
* - -1 if the second value is greater
|
|
406
|
-
*
|
|
407
|
-
* @example
|
|
408
|
-
* ```ts
|
|
409
|
-
* compare('a', 'b'); // -1
|
|
410
|
-
* compare(1, 2); // -1
|
|
411
|
-
* compare(new Date('2023-01-01'), new Date('2023-01-02')); // -1
|
|
412
|
-
* compare('a', 'a'); // 0
|
|
413
|
-
* compare(1, 1); // 0
|
|
414
|
-
* compare(new Date('2023-01-01'), new Date('2023-01-01')); // 0
|
|
415
|
-
* ```
|
|
416
|
-
*
|
|
417
|
-
* @param a - The first value to compare.
|
|
418
|
-
* @param b - The second value to compare.
|
|
419
|
-
*
|
|
420
|
-
* @returns 0 if equal, 1 if the first value is greater, -1 if the second value is greater.
|
|
421
|
-
*/
|
|
422
|
-
export declare const compare: (a: any, b: any) => number;
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Compares two objects based on multiple selectors.
|
|
426
|
-
* The comparison is done in the order of the selectors provided.
|
|
427
|
-
* Each selector can be 'asc' for ascending or 'desc' for descending order.
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```ts
|
|
431
|
-
* const compareByNameAndAge = compareBy<{ name: string; age: number }>({
|
|
432
|
-
* name: 'asc',
|
|
433
|
-
* age: 'desc',
|
|
434
|
-
* });
|
|
435
|
-
*
|
|
436
|
-
* const a = { name: 'Alice', age: 30 };
|
|
437
|
-
* const b = { name: 'Bob', age: 25 };
|
|
438
|
-
*
|
|
439
|
-
* console.log(compareByNameAndAge(a, b)); // -1 (Alice < Bob)
|
|
440
|
-
* ```
|
|
441
|
-
*
|
|
442
|
-
* @param selectors - An object where keys are properties to compare and values are 'asc' or 'desc'.
|
|
443
|
-
*
|
|
444
|
-
* @returns A comparison function that can be used with array sorting methods.
|
|
445
|
-
*/
|
|
446
|
-
export declare const compareBy: <T>(selectors: Partial<Record<keyof T, "asc" | "desc">>) => (a: T, b: T) => number;
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Composes multiple functions into a single function. It starts from the rightmost function and proceeds to the left.
|
|
450
|
-
*
|
|
451
|
-
* @example
|
|
452
|
-
* ```ts
|
|
453
|
-
* const add = (x) => x + 2;
|
|
454
|
-
* const multiply = (x) => x * 3;
|
|
455
|
-
* const subtract = (x) => x - 4;
|
|
456
|
-
* const composedFn = compose(subtract, multiply, add);
|
|
457
|
-
* composedFn(5); // ((5 + 2) * 3) - 4 = 17
|
|
458
|
-
* ```
|
|
459
|
-
*
|
|
460
|
-
* @example
|
|
461
|
-
* ```ts
|
|
462
|
-
* const square = async (x) => x * x;
|
|
463
|
-
* const add = async (x) => x + 2;
|
|
464
|
-
* const composedFn = compose(square, add);
|
|
465
|
-
* await composedFn(4); // (4 * 4) + 2 = 18
|
|
466
|
-
* ```
|
|
467
|
-
*
|
|
468
|
-
* @param fns - List of the functions to be composed.
|
|
469
|
-
*
|
|
470
|
-
* @returns A new function that is the composition of the input functions.
|
|
471
|
-
*/
|
|
472
|
-
export declare function compose<T extends FnDynamic[]>(...fns: T): ComposeReturn<T>;
|
|
473
|
-
|
|
474
|
-
declare type ComposeReturn<T extends FnDynamic[]> = (...args: LastParameters<T>) => FirstReturnType<T> extends Promise<any> ? Promise<Awaited<FirstReturnType<T>>> : FirstReturnType<T>;
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Checks if a value is present in an array.
|
|
478
|
-
*
|
|
479
|
-
* @example
|
|
480
|
-
* ```ts
|
|
481
|
-
* const arr = [1, 2, 3, { a: 1 }, 'hello'];
|
|
482
|
-
* const value = { a: 1 };
|
|
483
|
-
* contains(arr, value) // true;
|
|
484
|
-
* ```
|
|
485
|
-
*
|
|
486
|
-
* @param array - The array to check.
|
|
487
|
-
* @param value - The value to search for.
|
|
488
|
-
*
|
|
489
|
-
* @returns true if the value is present in the array, else false.
|
|
490
|
-
*
|
|
491
|
-
* @throws {TypeError} If the first argument is not an array.
|
|
492
|
-
*/
|
|
493
|
-
export declare function contains<T>(array: T[], value: any): boolean;
|
|
494
|
-
|
|
495
|
-
export declare namespace contains {
|
|
496
|
-
var fp: boolean;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Formats a monetary amount as a currency string with proper locale and symbol.
|
|
501
|
-
* Handles decimal places automatically based on currency.
|
|
502
|
-
*
|
|
503
|
-
* @example
|
|
504
|
-
* ```ts
|
|
505
|
-
* const money = { amount: 123456n, currency: 'USD' };
|
|
506
|
-
*
|
|
507
|
-
* currency(money); // '$1,234.56' (default en-US)
|
|
508
|
-
* currency(money, { locale: 'de-DE' }); // '1.234,56 $'
|
|
509
|
-
* currency(money, { style: 'code' }); // 'USD 1,234.56'
|
|
510
|
-
* currency(money, { style: 'name' }); // '1,234.56 US dollars'
|
|
511
|
-
* ```
|
|
512
|
-
*
|
|
513
|
-
* @param money - Money object to format
|
|
514
|
-
* @param options - Formatting options
|
|
515
|
-
* @returns Formatted currency string
|
|
516
|
-
*/
|
|
517
|
-
export declare function currency(money: Money, options?: CurrencyFormatOptions): string;
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Options for currency formatting.
|
|
521
|
-
*/
|
|
522
|
-
export declare type CurrencyFormatOptions = {
|
|
523
|
-
locale?: string;
|
|
524
|
-
style?: 'symbol' | 'code' | 'name';
|
|
525
|
-
minimumFractionDigits?: number;
|
|
526
|
-
maximumFractionDigits?: number;
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
export declare type Curried<P extends readonly unknown[], R> = P extends readonly [] ? () => R : <A extends readonly [unknown, ...(readonly unknown[])]>(...args: A) => P extends readonly [...A, ...infer Rest] ? (Rest extends readonly [] ? R : Curried<Rest, R>) : never;
|
|
530
|
-
|
|
531
|
-
export declare function curry<T extends (...args: any[]) => any>(fn: T): Curried<Parameters<T>, ReturnType<T>>;
|
|
532
|
-
|
|
533
|
-
export declare function curry<T extends (...args: any[]) => any, N extends number>(fn: T, arity: N): Curried<Take<N, Parameters<T>>, ReturnType<T>>;
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Debounce a function (trailing). Use `flush` to invoke immediately,
|
|
537
|
-
* `cancel` to clear, and `pending` to check if an invocation is scheduled.
|
|
538
|
-
*/
|
|
539
|
-
export declare function debounce<T extends Fn>(fn: T, delay?: number): Debounced<T>;
|
|
540
|
-
|
|
541
|
-
export declare type Debounced<T extends Fn> = ((this: ThisParameterType<T>, ...args: Parameters<T>) => void) & {
|
|
542
|
-
cancel(): void;
|
|
543
|
-
flush(): ReturnType<T> | undefined;
|
|
544
|
-
pending(): boolean;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
declare type DeepMerge<T, U> = T extends Obj ? U extends Obj ? {
|
|
548
|
-
[K in keyof T | keyof U]: K extends keyof T ? K extends keyof U ? DeepMerge<T[K], U[K]> : T[K] : K extends keyof U ? U[K] : never;
|
|
549
|
-
} : U : U;
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Creates a deferred promise with resolve and reject methods exposed.
|
|
553
|
-
* Useful for creating promises that are resolved/rejected externally.
|
|
554
|
-
*
|
|
555
|
-
* @example
|
|
556
|
-
* ```ts
|
|
557
|
-
* const deferred = defer<string>();
|
|
558
|
-
*
|
|
559
|
-
* setTimeout(() => {
|
|
560
|
-
* deferred.resolve('Done!');
|
|
561
|
-
* }, 1000);
|
|
562
|
-
*
|
|
563
|
-
* const result = await deferred.promise; // 'Done!'
|
|
564
|
-
* ```
|
|
565
|
-
*
|
|
566
|
-
* @returns Object with promise and resolve/reject methods
|
|
567
|
-
*/
|
|
568
|
-
export declare function defer<T = void>(): {
|
|
569
|
-
promise: Promise<T>;
|
|
570
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
571
|
-
reject: (reason?: unknown) => void;
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Delays the execution of a function by a specified amount of time.
|
|
576
|
-
*
|
|
577
|
-
* @example
|
|
578
|
-
* ```ts
|
|
579
|
-
* const log = () => console.log('Hello, world!');
|
|
580
|
-
*
|
|
581
|
-
* delay(log, 1000); // logs 'Hello, world!' after 1 second
|
|
582
|
-
* ```
|
|
583
|
-
*
|
|
584
|
-
* @param fn - The function to be delayed.
|
|
585
|
-
* @param delay - The amount of time to delay the function execution, in milliseconds. Default is 700.
|
|
586
|
-
*
|
|
587
|
-
* @returns A Promise that resolves with the result of the function execution.
|
|
588
|
-
*/
|
|
589
|
-
export declare function delay<T extends Fn>(fn: T, delay?: number): Promise<any>;
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Computes the difference between two objects.
|
|
593
|
-
*
|
|
594
|
-
* @example
|
|
595
|
-
* ```ts
|
|
596
|
-
* const obj1 = { a: 1, b: 2, c: 3 };
|
|
597
|
-
* const obj2 = { b: 2, c: 3, d: 4 };
|
|
598
|
-
*
|
|
599
|
-
* diff(obj1, obj2); // { d: 4 }
|
|
600
|
-
* ```
|
|
601
|
-
*
|
|
602
|
-
* @param curr - The current object.
|
|
603
|
-
* @param prev - The previous object.
|
|
604
|
-
* @param [compareFn] - A custom function to compare values.
|
|
605
|
-
* @returns An object containing new/modified properties.
|
|
606
|
-
*/
|
|
607
|
-
export declare function diff<T extends Obj>(curr?: T, prev?: T, compareFn?: (a: unknown, b: unknown) => boolean): Partial<T>;
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Distributes an amount evenly among N parties.
|
|
611
|
-
* Handles rounding to ensure the sum equals the original amount exactly.
|
|
612
|
-
* Useful for splitting bills, costs, or payments equally.
|
|
613
|
-
*
|
|
614
|
-
* @example
|
|
615
|
-
* ```ts
|
|
616
|
-
* // Split $100 among 3 people
|
|
617
|
-
* distribute(100, 3);
|
|
618
|
-
* // [34, 33, 33] - sum is exactly 100
|
|
619
|
-
*
|
|
620
|
-
* // Split with bigint (e.g., cents)
|
|
621
|
-
* distribute(10000n, 3);
|
|
622
|
-
* // [3334n, 3333n, 3333n] - sum is exactly 10000n
|
|
623
|
-
* ```
|
|
624
|
-
*
|
|
625
|
-
* @param amount - Total amount to distribute
|
|
626
|
-
* @param parts - Number of parts to divide into
|
|
627
|
-
* @returns Array of distributed amounts (a sum equals original amount)
|
|
628
|
-
* @throws {Error} If parts are less than 1
|
|
629
|
-
*/
|
|
630
|
-
export declare function distribute(amount: number, parts: number): number[];
|
|
631
|
-
|
|
632
|
-
export declare function distribute(amount: bigint, parts: number): bigint[];
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* Divides a number by a divisor with precision handling for financial calculations.
|
|
636
|
-
* Supports both regular numbers and bigint for exact precision.
|
|
637
|
-
*
|
|
638
|
-
* @example
|
|
639
|
-
* ```ts
|
|
640
|
-
* divide(20, 5); // 4
|
|
641
|
-
* divide(0.6, 3); // 0.2 (precision-safe)
|
|
642
|
-
* divide(500n, 5n); // 100n
|
|
643
|
-
* ```
|
|
644
|
-
*
|
|
645
|
-
* @param a - Number to divide (dividend)
|
|
646
|
-
* @param b - Divisor
|
|
647
|
-
* @returns Quotient of a divided by b
|
|
648
|
-
* @throws {Error} If divisor is zero
|
|
649
|
-
*/
|
|
650
|
-
export declare function divide(a: number, b: number): number;
|
|
651
|
-
|
|
652
|
-
export declare function divide(a: bigint, b: bigint): bigint;
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* “Draw” a random item from an array.
|
|
656
|
-
*
|
|
657
|
-
* @example
|
|
658
|
-
* ```ts
|
|
659
|
-
* draw([1, 2, 3]) // 3
|
|
660
|
-
* ```
|
|
661
|
-
*
|
|
662
|
-
* @param array - The array to draw from.
|
|
663
|
-
*
|
|
664
|
-
* @returns A random item from the array or `undefined` if the array is empty.
|
|
665
|
-
*
|
|
666
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
667
|
-
*/
|
|
668
|
-
export declare const draw: <T>(array: T[]) => T | undefined;
|
|
669
|
-
|
|
670
|
-
declare type Entries<T> = {
|
|
671
|
-
[K in keyof T]: [K, T[K]];
|
|
672
|
-
}[keyof T][];
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Returns an array of a given object's own enumerable string-keyed property [key, value] pairs.
|
|
676
|
-
*
|
|
677
|
-
* @example
|
|
678
|
-
* ```ts
|
|
679
|
-
* const obj = { a: 1, b: 2, c: 3 };
|
|
680
|
-
* entries(obj); // logs [['a', 1], ['b', 2], ['c', 3]]
|
|
681
|
-
* ```
|
|
682
|
-
*
|
|
683
|
-
* @param item - The object whose properties are to be returned.
|
|
684
|
-
*
|
|
685
|
-
* @returns an array of the object's own enumerable string-keyed property [key, value] pairs.
|
|
686
|
-
*/
|
|
687
|
-
export declare function entries<T extends Obj>(item: T): Entries<T>;
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Checks if all elements in an array pass a predicate function.
|
|
691
|
-
*
|
|
692
|
-
* @example
|
|
693
|
-
* ```ts
|
|
694
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
695
|
-
* const isEven = (num) => num % 2 === 0;
|
|
696
|
-
* every(arr, isEven); // false
|
|
697
|
-
* ```
|
|
698
|
-
*
|
|
699
|
-
* @param array - The array to check.
|
|
700
|
-
* @param predicate - The predicate function to test each element.
|
|
701
|
-
*
|
|
702
|
-
* @returns true if all elements pass the predicate test, else false.
|
|
703
|
-
*
|
|
704
|
-
* @throws {TypeError} If the first argument is not an array.
|
|
705
|
-
*/
|
|
706
|
-
export declare function every<T>(array: T[], predicate: Predicate<T>): boolean;
|
|
707
|
-
|
|
708
|
-
export declare namespace every {
|
|
709
|
-
var fp: boolean;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* Converts money from one currency to another using the provided exchange rate.
|
|
714
|
-
* Maintains precision by using bigint arithmetic.
|
|
715
|
-
*
|
|
716
|
-
* @example
|
|
717
|
-
* ```ts
|
|
718
|
-
* const usd = { amount: 100000n, currency: 'USD' }; // $1,000.00
|
|
719
|
-
* const rate = { from: 'USD', to: 'EUR', rate: 0.85 };
|
|
720
|
-
*
|
|
721
|
-
* exchange(usd, rate);
|
|
722
|
-
* // { amount: 85000n, currency: 'EUR' } // €850.00
|
|
723
|
-
* ```
|
|
724
|
-
*
|
|
725
|
-
* @param money - Money to convert
|
|
726
|
-
* @param rate - Exchange rate information
|
|
727
|
-
* @returns Converted money in target currency
|
|
728
|
-
* @throws {Error} If source currency doesn't match rate.from
|
|
729
|
-
*/
|
|
730
|
-
export declare function exchange(money: Money, rate: ExchangeRate): Money;
|
|
731
|
-
|
|
732
|
-
/**
|
|
733
|
-
* Exchange rate for currency conversion.
|
|
734
|
-
*/
|
|
735
|
-
export declare type ExchangeRate = {
|
|
736
|
-
from: string;
|
|
737
|
-
to: string;
|
|
738
|
-
rate: number;
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
export declare type Expires = 'EXPIRED' | 'SOON' | 'LATER' | 'NEVER' | 'UNKNOWN';
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
* Determines the expiry status of a given date.
|
|
745
|
-
*
|
|
746
|
-
* @param date - The date to check, as a string or Date object.
|
|
747
|
-
* @param days - Number of days before expiry to be considered "SOON" (default: 7).
|
|
748
|
-
* @returns
|
|
749
|
-
* - 'EXPIRED' if the date is in the past,
|
|
750
|
-
* - 'SOON' if the date is within the next `days`,
|
|
751
|
-
* - 'LATER' if the date is further in the future,
|
|
752
|
-
* - 'NEVER' if the year is >= 9999,
|
|
753
|
-
* - 'UNKNOWN' if the date is invalid.
|
|
754
|
-
*/
|
|
755
|
-
export declare function expires(date: string | Date, days?: number): Expires;
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Filters an array based on a predicate function.
|
|
759
|
-
*
|
|
760
|
-
* @example
|
|
761
|
-
* ```ts
|
|
762
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
763
|
-
* const isEven = (num) => num % 2 === 0;
|
|
764
|
-
* filter(arr, isEven); // [2, 4]
|
|
765
|
-
* ```
|
|
766
|
-
*
|
|
767
|
-
* @param array - The array to filter.
|
|
768
|
-
* @param predicate - The predicate function to test each element.
|
|
769
|
-
*
|
|
770
|
-
* @returns A new array with elements that pass the predicate test.
|
|
771
|
-
*
|
|
772
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
773
|
-
*/
|
|
774
|
-
export declare function filter<T>(array: T[], predicate: Predicate<T>): T[];
|
|
775
|
-
|
|
776
|
-
export declare namespace filter {
|
|
777
|
-
var fp: boolean;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
/**
|
|
781
|
-
* Finds the first element in an array that satisfies a predicate function.
|
|
782
|
-
*
|
|
783
|
-
* @example
|
|
784
|
-
* ```ts
|
|
785
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
786
|
-
* const isEven = (num) => num % 2 === 0;
|
|
787
|
-
* find(arr, isEven); // 2
|
|
788
|
-
* find(arr, (num) => num > 5, 0); // 0
|
|
789
|
-
* find(arr, (num) => num > 5); // undefined
|
|
790
|
-
* ```
|
|
791
|
-
*
|
|
792
|
-
* @param array - The array to search through.
|
|
793
|
-
* @param predicate - A function that is called for each element in the array.
|
|
794
|
-
* @param [defaultValue] - (optional) value to return if no element satisfies the predicate.
|
|
795
|
-
*
|
|
796
|
-
* @return The first element in the array that satisfies the predicate, or the default value if none match.
|
|
797
|
-
*/
|
|
798
|
-
export declare function find<T>(array: T[], predicate: Predicate<T>, defaultValue?: T): T | undefined;
|
|
799
|
-
|
|
800
|
-
export declare namespace find {
|
|
801
|
-
var fp: boolean;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* Finds the first element in an array that satisfies a predicate function. If no such element is found, returns -1.
|
|
806
|
-
*
|
|
807
|
-
* @example
|
|
808
|
-
* ```ts
|
|
809
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
810
|
-
* const isEven = (num) => num % 2 === 0;
|
|
811
|
-
* findIndex(arr, isEven); // 1
|
|
812
|
-
* findIndex(arr, (num) => num > 5); // -1
|
|
813
|
-
* ```
|
|
814
|
-
*
|
|
815
|
-
* @param array - The array to search.
|
|
816
|
-
* @param predicate - A function that is called for each element in the array.
|
|
817
|
-
*
|
|
818
|
-
* @return The index of the first element that satisfies the predicate, or -1 if no such element is found.
|
|
819
|
-
*/
|
|
820
|
-
export declare function findIndex<T>(array: T[], predicate: Predicate<T>): number;
|
|
821
|
-
|
|
822
|
-
export declare namespace findIndex {
|
|
823
|
-
var fp: boolean;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
/**
|
|
827
|
-
* Finds the last element in the array that satisfies the provided predicate function.
|
|
828
|
-
* If no such element is found, returns the specified default value (if provided).
|
|
829
|
-
*
|
|
830
|
-
* @example
|
|
831
|
-
* ```ts
|
|
832
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
833
|
-
* const isEven = (num) => num % 2 === 0;
|
|
834
|
-
* findLast(arr, isEven); // 4
|
|
835
|
-
* findLast(arr, (num) => num > 5, 0); // 0
|
|
836
|
-
* findLast(arr, (num) => num > 5); // undefined
|
|
837
|
-
* ```
|
|
838
|
-
*
|
|
839
|
-
* @param array - The array to search through.
|
|
840
|
-
* @param predicate - A function to test each element of the array.
|
|
841
|
-
* @param [defaultValue] - The value to return if no element satisfies the predicate.
|
|
842
|
-
*
|
|
843
|
-
* @return The last element in the array that satisfies the predicate, or the default value if none match.
|
|
844
|
-
*/
|
|
845
|
-
export declare function findLast<T>(array: T[], predicate: Predicate<T>, defaultValue?: T): T | undefined;
|
|
846
|
-
|
|
847
|
-
export declare namespace findLast {
|
|
848
|
-
var fp: boolean;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
declare type FirstParameters<T> = T extends [infer First extends FnDynamic, ...any] ? Parameters<First> : never;
|
|
852
|
-
|
|
853
|
-
declare type FirstReturnType<F> = F extends [infer First extends FnDynamic, ...any] ? ReturnType<First> : never;
|
|
854
|
-
|
|
855
|
-
declare type FlatArray_2<T> = T extends readonly (infer U)[] ? U : T;
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
* Flattens a nested array into a single-level array.
|
|
859
|
-
*
|
|
860
|
-
* @example
|
|
861
|
-
* ```ts
|
|
862
|
-
* const arr = [1, [2, [3, [4, [5]]]]];
|
|
863
|
-
* flatten(arr) // [1, 2, 3, 4, 5];
|
|
864
|
-
* ```
|
|
865
|
-
*
|
|
866
|
-
* @param array - The array to flatten.
|
|
867
|
-
*
|
|
868
|
-
* @returns A single-level array.
|
|
869
|
-
*/
|
|
870
|
-
export declare function flatten<T>(array: T[]): FlatArray_2<T>[];
|
|
871
|
-
|
|
872
|
-
export declare type Fn<P = any, R = any> = (...args: P[]) => R;
|
|
873
|
-
|
|
874
|
-
export declare type FnAsync<P = any, R = any> = (...args: P[]) => Promise<R>;
|
|
875
|
-
|
|
876
|
-
export declare type FnDynamic<P = any, R = any> = (...args: P[]) => R | Promise<R>;
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* Creates a function that can be used in functional programming mode.
|
|
880
|
-
* This function is a wrapper around the original function, allowing you to pass the first argument as an array.
|
|
881
|
-
*
|
|
882
|
-
* @example
|
|
883
|
-
* ```ts
|
|
884
|
-
* import { fp } from './fp';
|
|
885
|
-
* import { map } from './map';
|
|
886
|
-
*
|
|
887
|
-
* const double = (num: number) => num * 2;
|
|
888
|
-
* const doubleArray = fp(map, double);
|
|
889
|
-
*
|
|
890
|
-
* doubleArray([1, 2, 3]) // [2, 4, 6]
|
|
891
|
-
* ```
|
|
892
|
-
*
|
|
893
|
-
* @param callback - The function to be wrapped.
|
|
894
|
-
* @param args - The arguments to be passed to the function.
|
|
895
|
-
*
|
|
896
|
-
* @returns A function that takes an array and applies the original function to it.
|
|
897
|
-
*
|
|
898
|
-
* @throws {TypeError} If the function cannot be used in functional programming mode.
|
|
899
|
-
*/
|
|
900
|
-
export declare const fp: <T, F extends Fn = Fn>(callback: F, ...args: RemoveFirstParameter<F>) => (array: T[]) => any;
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Checks if the first argument is greater than or equal to the second argument.
|
|
904
|
-
*
|
|
905
|
-
* @example
|
|
906
|
-
* ```ts
|
|
907
|
-
* gte(5, 3); // true
|
|
908
|
-
* gte(3, 5); // false
|
|
909
|
-
* gte(5, 5); // true
|
|
910
|
-
* gte(5, '3'); // false
|
|
911
|
-
* gte('5', 3); // false
|
|
912
|
-
* gte('5', '3'); // false
|
|
913
|
-
* ```
|
|
914
|
-
* @param a - The first argument to compare.
|
|
915
|
-
* @param b - The second argument to compare.
|
|
916
|
-
*
|
|
917
|
-
* @returns `true` if `a` is greater than or equal to `b`, otherwise `false`.
|
|
918
|
-
*/
|
|
919
|
-
export declare function ge(a: unknown, b: unknown): boolean;
|
|
920
|
-
|
|
921
|
-
/**
|
|
922
|
-
* Groups the elements of an array based on the given key.
|
|
923
|
-
*
|
|
924
|
-
* @example
|
|
925
|
-
* ```ts
|
|
926
|
-
* const data = [{ a: 2 }, { a: 1 }];
|
|
927
|
-
* group(data, 'a') // { '1': [{ a: 2 }], '2': [{ a: 1 }] };
|
|
928
|
-
* ```
|
|
929
|
-
*
|
|
930
|
-
* @param array - The array to group.
|
|
931
|
-
* @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.
|
|
932
|
-
*
|
|
933
|
-
* @returns an object with keys as the grouped values and values as arrays of elements.
|
|
934
|
-
*
|
|
935
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
936
|
-
*/
|
|
937
|
-
export declare function group<T, _K extends keyof T, R extends string | number | symbol>(array: T[], selector: Selector<T>): Record<R, T[]>;
|
|
938
|
-
|
|
939
|
-
export declare namespace group {
|
|
940
|
-
var fp: boolean;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
/**
|
|
944
|
-
* Checks if the first argument is greater than the second argument.
|
|
945
|
-
*
|
|
946
|
-
* @example
|
|
947
|
-
* ```ts
|
|
948
|
-
* gt(5, 3); // true
|
|
949
|
-
* gt(3, 5); // false
|
|
950
|
-
* gt(5, 5); // false
|
|
951
|
-
* ```
|
|
952
|
-
*
|
|
953
|
-
* @param a - The first argument to compare.
|
|
954
|
-
* @param b - The second argument to compare.
|
|
955
|
-
*
|
|
956
|
-
* @returns `true` if `a` is greater than `b`, otherwise `false`.
|
|
957
|
-
*/
|
|
958
|
-
export declare function gt(a: unknown, b: unknown): boolean;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* Generates an array of dates between a start and end date, with a specified interval and step size.
|
|
962
|
-
*
|
|
963
|
-
* @example
|
|
964
|
-
* ```ts
|
|
965
|
-
* const options = { interval: 'D', steps: 1, latest: false };
|
|
966
|
-
*
|
|
967
|
-
* interval('2022-01-01', '2022-01-31', options); // Returns an array of dates for every day in January 2022
|
|
968
|
-
* ```
|
|
969
|
-
*
|
|
970
|
-
* @param start - The start date (Date object or ISO string).
|
|
971
|
-
* @param end - The end date (Date object or ISO string).
|
|
972
|
-
* @param options - Options for an interval and steps.
|
|
973
|
-
*
|
|
974
|
-
* @returns An array of generated dates.
|
|
975
|
-
*/
|
|
976
|
-
export declare function interval(start: Date | string, end: Date | string, { interval, steps, latest }?: IntervalOptions): Date[];
|
|
977
|
-
|
|
978
|
-
declare type IntervalOptions = {
|
|
979
|
-
interval?: IntervalType;
|
|
980
|
-
steps?: number;
|
|
981
|
-
latest?: boolean;
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
declare type IntervalType = 'D' | 'W' | 'M' | 'MS' | 'ME' | 'Y' | 'YS' | 'YE';
|
|
985
|
-
|
|
986
|
-
/**
|
|
987
|
-
* @description
|
|
988
|
-
* Checks if the value type of argument.
|
|
989
|
-
*
|
|
990
|
-
* @example
|
|
991
|
-
* ```ts
|
|
992
|
-
* is('array', []);
|
|
993
|
-
* is('boolean', true);
|
|
994
|
-
* is('date', new Date());
|
|
995
|
-
* is('defined', 123);
|
|
996
|
-
* is('empty', []);
|
|
997
|
-
* is('even', 2);
|
|
998
|
-
* is('function', () => {});
|
|
999
|
-
* is('match', { a: 1, b: 2 }, { a: 1 });
|
|
1000
|
-
* is('nan', Number.NaN);
|
|
1001
|
-
* is('negative', -123);
|
|
1002
|
-
* is('nil', null);
|
|
1003
|
-
* is('null', null);
|
|
1004
|
-
* is('number', 123);
|
|
1005
|
-
* is('object', {});
|
|
1006
|
-
* is('odd', 3);
|
|
1007
|
-
* is('positive', 123);
|
|
1008
|
-
* is('string', 'hello');
|
|
1009
|
-
* is('symbol', Symbol('test'));
|
|
1010
|
-
* is('regex', /abc/);
|
|
1011
|
-
* is('string', 'hello world');
|
|
1012
|
-
* is('undefined', undefined);
|
|
1013
|
-
* is('within', 1, 2, 3);
|
|
1014
|
-
* is('zero', 0);
|
|
1015
|
-
* is('eq', [1, 2, 3], [1, 2, 3]);
|
|
1016
|
-
* is('ne', [1, 2, 3], [1, 2]);
|
|
1017
|
-
* is('ge', 5, 5);
|
|
1018
|
-
* is('gt', 5, 3);
|
|
1019
|
-
* is('le', 5, 5);
|
|
1020
|
-
* is('lt', 3, 5);
|
|
1021
|
-
* ```
|
|
1022
|
-
*
|
|
1023
|
-
* @param type - The type to check against.
|
|
1024
|
-
* @param args - The argument to be checked.
|
|
1025
|
-
*
|
|
1026
|
-
* @returns `true` if the value is of the specified type, else `false`.
|
|
1027
|
-
*/
|
|
1028
|
-
export declare function is(type: 'within', ...args: Parameters<typeof isWithin>): boolean;
|
|
1029
|
-
|
|
1030
|
-
export declare function is(type: 'eq', ...args: Parameters<typeof isEqual>): boolean;
|
|
1031
|
-
|
|
1032
|
-
export declare function is(type: 'ne', ...args: Parameters<typeof isEqual>): boolean;
|
|
1033
|
-
|
|
1034
|
-
export declare function is(type: 'gt', ...args: Parameters<typeof gt>): boolean;
|
|
1035
|
-
|
|
1036
|
-
export declare function is(type: 'ge', ...args: Parameters<typeof ge>): boolean;
|
|
1037
|
-
|
|
1038
|
-
export declare function is(type: 'lt', ...args: Parameters<typeof lt>): boolean;
|
|
1039
|
-
|
|
1040
|
-
export declare function is(type: 'le', ...args: Parameters<typeof le>): boolean;
|
|
1041
|
-
|
|
1042
|
-
export declare function is(type: 'match', ...args: Parameters<typeof isMatch>): boolean;
|
|
1043
|
-
|
|
1044
|
-
export declare function is(type: 'empty', ...args: Parameters<typeof isEmpty>): boolean;
|
|
1045
|
-
|
|
1046
|
-
export declare function is(type: 'array', arg: unknown): arg is Array<unknown>;
|
|
1047
|
-
|
|
1048
|
-
export declare function is(type: 'string', arg: unknown): arg is string;
|
|
1049
|
-
|
|
1050
|
-
export declare function is(type: 'number', arg: unknown): arg is number;
|
|
1051
|
-
|
|
1052
|
-
export declare function is(type: 'object', arg: unknown): arg is object;
|
|
1053
|
-
|
|
1054
|
-
export declare function is(type: 'nil', arg: unknown): arg is null | undefined;
|
|
1055
|
-
|
|
1056
|
-
export declare function is(type: 'primitive', arg: unknown): arg is string | number | boolean;
|
|
1057
|
-
|
|
1058
|
-
export declare function is(type: isType, arg: unknown): boolean;
|
|
1059
|
-
|
|
1060
|
-
export declare const IS_ARRAY_ERROR_MSG = "Expected an array";
|
|
1061
|
-
|
|
1062
|
-
export declare const IS_DATE_ERROR_MSG = "Expected a Date object";
|
|
1063
|
-
|
|
1064
|
-
export declare const IS_EMPTY_ERROR_MSG = "Expected an empty value";
|
|
1065
|
-
|
|
1066
|
-
export declare const IS_EQUAL_ERROR_MSG = "Expected two values to be equal";
|
|
1067
|
-
|
|
1068
|
-
export declare const IS_FUNCTION_ERROR_MSG = "Expected a function";
|
|
1069
|
-
|
|
1070
|
-
export declare const IS_NIL_ERROR_MSG = "Expected a null or undefined value";
|
|
1071
|
-
|
|
1072
|
-
export declare const IS_NUMBER_ERROR_MSG = "Expected a number";
|
|
1073
|
-
|
|
1074
|
-
export declare const IS_OBJECT_ERROR_MSG = "Expected an object";
|
|
1075
|
-
|
|
1076
|
-
export declare const IS_PRIMITIVE_ERROR_MSG = "Expected a primitive value";
|
|
1077
|
-
|
|
1078
|
-
export declare const IS_PROMISE_ERROR_MSG = "Expected a promise";
|
|
1079
|
-
|
|
1080
|
-
export declare const IS_STRING_ERROR_MSG = "Expected a string";
|
|
1081
|
-
|
|
1082
|
-
export declare const IS_WITHIN_ERROR_MSG = "Expected a number within a specified range";
|
|
1083
|
-
|
|
1084
|
-
/**
|
|
1085
|
-
* Determines if the passed value is an array.
|
|
1086
|
-
*
|
|
1087
|
-
* @example
|
|
1088
|
-
* ```ts
|
|
1089
|
-
* isArray([1, 2, 3]) // true
|
|
1090
|
-
* isArray(1, 2, 3) // false
|
|
1091
|
-
* ```
|
|
1092
|
-
*
|
|
1093
|
-
* @param arg - The argument to be checked.
|
|
1094
|
-
*
|
|
1095
|
-
* @returns `true` if the value is an array, else `false`.
|
|
1096
|
-
*/
|
|
1097
|
-
export declare function isArray(arg: unknown): arg is Array<unknown>;
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* Checks if the value is a boolean.
|
|
1101
|
-
*
|
|
1102
|
-
* @example
|
|
1103
|
-
* ```ts
|
|
1104
|
-
* isBoolean(true); // true
|
|
1105
|
-
* isBoolean(false); // true
|
|
1106
|
-
* isBoolean(123); // false
|
|
1107
|
-
* isBoolean('hello world'); // false
|
|
1108
|
-
* isBoolean({}); // false
|
|
1109
|
-
* isBoolean([]); // false
|
|
1110
|
-
* isBoolean(new Date()); // false
|
|
1111
|
-
* isBoolean(null); // false
|
|
1112
|
-
* isBoolean(undefined); // false
|
|
1113
|
-
* isBoolean(NaN); // false
|
|
1114
|
-
* ```
|
|
1115
|
-
*
|
|
1116
|
-
* @param arg - The argument to be checked.
|
|
1117
|
-
*
|
|
1118
|
-
* @returns `true` if the value is a boolean, else `false`.
|
|
1119
|
-
*/
|
|
1120
|
-
export declare function isBoolean(arg: unknown): arg is boolean;
|
|
1121
|
-
|
|
1122
|
-
/**
|
|
1123
|
-
* Determines if the passed value is a valid Date Object.
|
|
1124
|
-
*
|
|
1125
|
-
* @example
|
|
1126
|
-
* ```ts
|
|
1127
|
-
* isDate(new Date()); // true
|
|
1128
|
-
* isDate(123); // false
|
|
1129
|
-
* ```
|
|
1130
|
-
*
|
|
1131
|
-
* @param arg - The argument to be checked.
|
|
1132
|
-
*
|
|
1133
|
-
* @returns `true` if the value is a valid Date object, else `false`.
|
|
1134
|
-
*/
|
|
1135
|
-
export declare function isDate(arg: unknown): arg is Date;
|
|
1136
|
-
|
|
1137
|
-
/**
|
|
1138
|
-
* Checks if a value is defined (not `undefined`).
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* ```ts
|
|
1142
|
-
* isDefined(123); // true
|
|
1143
|
-
* isDefined(undefined); // false
|
|
1144
|
-
* isDefined('hello world'); // true
|
|
1145
|
-
* isDefined({}); // true
|
|
1146
|
-
* isDefined([]); // true
|
|
1147
|
-
* isDefined(null); // true
|
|
1148
|
-
* ```
|
|
1149
|
-
*
|
|
1150
|
-
* @param arg - The value to check.
|
|
1151
|
-
*
|
|
1152
|
-
* @returns `true` if the value is defined, else `false`.
|
|
1153
|
-
*/
|
|
1154
|
-
export declare function isDefined<T>(arg: T | undefined): arg is T;
|
|
1155
|
-
|
|
1156
|
-
/**
|
|
1157
|
-
* Checks if the given argument is empty.
|
|
1158
|
-
*
|
|
1159
|
-
* @example
|
|
1160
|
-
* ```ts
|
|
1161
|
-
* isEmpty(null); // true
|
|
1162
|
-
* isEmpty(undefined); // true
|
|
1163
|
-
* isEmpty([]); // true
|
|
1164
|
-
* isEmpty({}); // true
|
|
1165
|
-
* isEmpty(''); // true
|
|
1166
|
-
* isEmpty(0); // false
|
|
1167
|
-
* isEmpty(123); // false
|
|
1168
|
-
* isEmpty('abc'); // false
|
|
1169
|
-
* isEmpty([1, 2, 3]); // false
|
|
1170
|
-
* isEmpty({ a: 1, b: 2 }); // false
|
|
1171
|
-
* ```
|
|
1172
|
-
*
|
|
1173
|
-
* @param arg - The argument to be checked.
|
|
1174
|
-
*
|
|
1175
|
-
* @returns `true` if all arguments are `null`, `undefined`, `{}`, `[]`, or empty strings. Otherwise, it returns `false`.
|
|
1176
|
-
*/
|
|
1177
|
-
export declare function isEmpty(arg: any): boolean;
|
|
1178
|
-
|
|
1179
|
-
/**
|
|
1180
|
-
* Deeply compares two values for equality, including objects, arrays, and primitives.
|
|
1181
|
-
* Detects circular references and optimizes performance.
|
|
1182
|
-
*
|
|
1183
|
-
* @example
|
|
1184
|
-
* ```ts
|
|
1185
|
-
* isEqual([1, 2, 3], [1, 2, 3]); // true
|
|
1186
|
-
* isEqual([1, 2], [1, 2, 3]); // false
|
|
1187
|
-
* isEqual({ a: 1, b: 2 }, { a: 1, b: 2 }); // true
|
|
1188
|
-
* isEqual({ a: { b: 2 } }, { a: { b: 2 } }); // true
|
|
1189
|
-
* isEqual({ a: 1 }, { a: 2 }); // false
|
|
1190
|
-
* isEqual({ a: 1 }, { b: 1 }); // false
|
|
1191
|
-
* isEqual(new Date('2023-01-01'), new Date('2023-01-01')); // true
|
|
1192
|
-
* isEqual(new Date('2023-01-01'), new Date('2023-01-02')); // false
|
|
1193
|
-
* isEqual(new Date('2023-01-01'), 1); // false
|
|
1194
|
-
* ```
|
|
1195
|
-
*
|
|
1196
|
-
* @param a - First value to compare.
|
|
1197
|
-
* @param b - Second value to compare.
|
|
1198
|
-
* @returns Whether the values are deeply equal.
|
|
1199
|
-
*/
|
|
1200
|
-
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
1201
|
-
|
|
1202
|
-
/**
|
|
1203
|
-
* Checks if a number is even.
|
|
1204
|
-
*
|
|
1205
|
-
* @param {number} arg - The number to check.
|
|
1206
|
-
*
|
|
1207
|
-
* @returns {boolean} - Returns true if the number is even, otherwise false.
|
|
1208
|
-
*/
|
|
1209
|
-
export declare function isEven(arg: unknown): arg is number;
|
|
1210
|
-
|
|
1211
|
-
/**
|
|
1212
|
-
* Determines if the passed value is a function.
|
|
1213
|
-
*
|
|
1214
|
-
* @example
|
|
1215
|
-
* ```ts
|
|
1216
|
-
* isFunction(function() {}) // true
|
|
1217
|
-
* isFunction(() => {}) // true
|
|
1218
|
-
* isFunction('hello world') // false
|
|
1219
|
-
* ```
|
|
1220
|
-
*
|
|
1221
|
-
* @param arg - The argument to be checked.
|
|
1222
|
-
*
|
|
1223
|
-
* @returns `true` if the value is a function, else `false`.
|
|
1224
|
-
*/
|
|
1225
|
-
export declare function isFunction(arg: unknown): arg is (...args: any[]) => any;
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* Performs a partial deep comparison between object and source to determine if object contains equivalent property values.
|
|
1229
|
-
*
|
|
1230
|
-
* @example
|
|
1231
|
-
* ```ts
|
|
1232
|
-
* const object = { a: 1, b: 2, c: { d: 3 } };
|
|
1233
|
-
*
|
|
1234
|
-
* isMatch(object, { a: 1, c: { d: 3 } }); // true
|
|
1235
|
-
* isMatch(object, { a: 1, b: 2 }); // true
|
|
1236
|
-
* isMatch(object, { a: 1, c: { d: 4 } }); // false
|
|
1237
|
-
*
|
|
1238
|
-
* isMatch([1, 2, 3], [1, 2]); // true
|
|
1239
|
-
* isMatch([1, 2, 3], [1, 2, 3]); // true
|
|
1240
|
-
* isMatch([1, 2, 3], [1, 2, 4]); // false
|
|
1241
|
-
* ```
|
|
1242
|
-
*
|
|
1243
|
-
* @param object - The object to inspect.
|
|
1244
|
-
* @param source - The object of property values to match.
|
|
1245
|
-
*
|
|
1246
|
-
* @returns `true` if the object is a match, else `false`.
|
|
1247
|
-
*/
|
|
1248
|
-
declare function isMatch(object: any, source: any): boolean;
|
|
1249
|
-
|
|
1250
|
-
/**
|
|
1251
|
-
* @description
|
|
1252
|
-
* Checks if the value is a negative number.
|
|
1253
|
-
*
|
|
1254
|
-
* @example
|
|
1255
|
-
* ```ts
|
|
1256
|
-
* isNegative(-123); // true
|
|
1257
|
-
* isNegative(123); // false
|
|
1258
|
-
* isNegative(0); // false
|
|
1259
|
-
* isNegative(0.1); // false
|
|
1260
|
-
* isNegative(-0.1); // true
|
|
1261
|
-
* isNegative('hello world'); // false
|
|
1262
|
-
* isNegative({}); // false
|
|
1263
|
-
* isNegative([]); // false
|
|
1264
|
-
* isNegative(new Date()); // false
|
|
1265
|
-
* isNegative(null); // false
|
|
1266
|
-
* isNegative(undefined); // false
|
|
1267
|
-
* isNegative(NaN); // false
|
|
1268
|
-
* ```
|
|
1269
|
-
*
|
|
1270
|
-
* @param arg - The argument to be checked.
|
|
1271
|
-
*
|
|
1272
|
-
* @returns `true` if the value is a negative number, else `false`.
|
|
1273
|
-
*/
|
|
1274
|
-
export declare function isNegative(arg: unknown): arg is number;
|
|
1275
|
-
|
|
1276
|
-
/**
|
|
1277
|
-
* Determines if the passed value is null or undefined.
|
|
1278
|
-
*
|
|
1279
|
-
* @example
|
|
1280
|
-
* ```ts
|
|
1281
|
-
* isNil(null); // true
|
|
1282
|
-
* isNil(undefined); // true
|
|
1283
|
-
* isNil(''); // false
|
|
1284
|
-
* isNil(0); // false
|
|
1285
|
-
* ```
|
|
1286
|
-
*
|
|
1287
|
-
* @param arg - The argument to be checked.
|
|
1288
|
-
*
|
|
1289
|
-
* @returns `true` if the value is null or undefined, else `false`.
|
|
1290
|
-
*/
|
|
1291
|
-
export declare function isNil(arg: unknown): arg is null | undefined;
|
|
1292
|
-
|
|
1293
|
-
/**
|
|
1294
|
-
* Determines if the passed value is a number.
|
|
1295
|
-
*
|
|
1296
|
-
* @example
|
|
1297
|
-
* ```ts
|
|
1298
|
-
* isNumber(123); // true
|
|
1299
|
-
* isNumber('hello world'); // false
|
|
1300
|
-
* ```
|
|
1301
|
-
*
|
|
1302
|
-
* @param arg - The argument to be checked.
|
|
1303
|
-
*
|
|
1304
|
-
* @returns `true` if the value is a number, else `false`.
|
|
1305
|
-
*/
|
|
1306
|
-
export declare function isNumber(arg: unknown): arg is number;
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* Determines if the passed value is an object.
|
|
1310
|
-
*
|
|
1311
|
-
* @example
|
|
1312
|
-
* ```ts
|
|
1313
|
-
* const value = { key: 'value' };
|
|
1314
|
-
* isObject(value); // true
|
|
1315
|
-
* isObject('hello world'); // false
|
|
1316
|
-
* isObject(value, 1); // false
|
|
1317
|
-
* isObject(value, value); // true
|
|
1318
|
-
* ```
|
|
1319
|
-
*
|
|
1320
|
-
* @param arg - The argument to be checked.
|
|
1321
|
-
*
|
|
1322
|
-
* @returns `true` if the value is an object, else `false`.
|
|
1323
|
-
*/
|
|
1324
|
-
export declare function isObject(arg: unknown): arg is object;
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* Checks if a number is odd.
|
|
1328
|
-
*
|
|
1329
|
-
* @param {number} arg - The number to check.
|
|
1330
|
-
*
|
|
1331
|
-
* @returns {boolean} - Returns true if the number is odd, otherwise false.
|
|
1332
|
-
*/
|
|
1333
|
-
export declare function isOdd(arg: unknown): arg is number;
|
|
1334
|
-
|
|
1335
|
-
/**
|
|
1336
|
-
* Checks if the value is a positive number.
|
|
1337
|
-
*
|
|
1338
|
-
* @example
|
|
1339
|
-
* ```ts
|
|
1340
|
-
* isPositive(123); // true
|
|
1341
|
-
* isPositive(-123); // false
|
|
1342
|
-
* isPositive(0); // false
|
|
1343
|
-
* isPositive(0.1); // true
|
|
1344
|
-
* isPositive(-0.1); // false
|
|
1345
|
-
* isPositive('hello world'); // false
|
|
1346
|
-
* isPositive({}); // false
|
|
1347
|
-
* isPositive([]); // false
|
|
1348
|
-
* isPositive(new Date()); // false
|
|
1349
|
-
* isPositive(null); // false
|
|
1350
|
-
* isPositive(undefined); // false
|
|
1351
|
-
* isPositive(NaN); // false
|
|
1352
|
-
* ```
|
|
1353
|
-
*
|
|
1354
|
-
* @param arg - The argument to be checked.
|
|
1355
|
-
*
|
|
1356
|
-
* @returns `true` if the value is a positive number, else `false`.
|
|
1357
|
-
*
|
|
1358
|
-
*/
|
|
1359
|
-
export declare function isPositive(arg: unknown): arg is number;
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* Type guard to check if a value is a primitive
|
|
1363
|
-
*
|
|
1364
|
-
* @example
|
|
1365
|
-
* ```ts
|
|
1366
|
-
* isPrimitive('Hello World'); // true
|
|
1367
|
-
* isPrimitive(42); // true
|
|
1368
|
-
* isPrimitive(true); // true
|
|
1369
|
-
* isPrimitive({}); // false
|
|
1370
|
-
* isPrimitive([]); // false
|
|
1371
|
-
* isPrimitive(() => {}); // false
|
|
1372
|
-
* ```
|
|
1373
|
-
* @param arg - The argument to be checked.
|
|
1374
|
-
*
|
|
1375
|
-
* @returns `true` if the value is a primitive, else `false`.
|
|
1376
|
-
*/
|
|
1377
|
-
export declare function isPrimitive(arg: unknown): arg is string | number | boolean;
|
|
1378
|
-
|
|
1379
|
-
/**
|
|
1380
|
-
* Determines if the passed value is a promise.
|
|
1381
|
-
*
|
|
1382
|
-
* @example
|
|
1383
|
-
* ```ts
|
|
1384
|
-
* isPromise(new Promise((resolve, reject) => {})); // true
|
|
1385
|
-
* isPromise(async () => {}); // true
|
|
1386
|
-
* isPromise(() => {}); // false
|
|
1387
|
-
* ```
|
|
1388
|
-
*
|
|
1389
|
-
* @param arg - The argument to be checked.
|
|
1390
|
-
*
|
|
1391
|
-
* @returns `true` if the value is a promise, else `false`.
|
|
1392
|
-
*/
|
|
1393
|
-
export declare function isPromise(arg: unknown): arg is Promise<unknown>;
|
|
1394
|
-
|
|
1395
|
-
/**
|
|
1396
|
-
* Checks if the provided argument is a regular expression.
|
|
1397
|
-
*
|
|
1398
|
-
* @example
|
|
1399
|
-
* ```ts
|
|
1400
|
-
* isRegex(/abc/); // true
|
|
1401
|
-
* isRegex(new RegExp('abc')); // true
|
|
1402
|
-
* isRegex('abc'); // false
|
|
1403
|
-
* isRegex(123); // false
|
|
1404
|
-
* isRegex({}); // false
|
|
1405
|
-
* isRegex([]); // false
|
|
1406
|
-
* isRegex(null); // false
|
|
1407
|
-
* isRegex(undefined); // false
|
|
1408
|
-
* ```
|
|
1409
|
-
*
|
|
1410
|
-
* @param arg - The argument to be checked.
|
|
1411
|
-
*
|
|
1412
|
-
* @return `true` if the argument is a regular expression, otherwise `false`.
|
|
1413
|
-
*/
|
|
1414
|
-
export declare function isRegex(arg: unknown): arg is RegExp;
|
|
1415
|
-
|
|
1416
|
-
/**
|
|
1417
|
-
* Determines if the passed value is a String.
|
|
1418
|
-
*
|
|
1419
|
-
* @example
|
|
1420
|
-
* ```ts
|
|
1421
|
-
* isString('Hello World'); // true
|
|
1422
|
-
* isString(42); // false
|
|
1423
|
-
* ```
|
|
1424
|
-
*
|
|
1425
|
-
* @param arg - The argument to be checked.
|
|
1426
|
-
*
|
|
1427
|
-
* @returns `true` if the value is a String, else `false`.
|
|
1428
|
-
*/
|
|
1429
|
-
export declare function isString(arg: unknown): arg is string;
|
|
1430
|
-
|
|
1431
|
-
declare type isType = ArgType | 'defined' | 'empty' | 'eq' | 'even' | 'ge' | 'gt' | 'le' | 'lt' | 'match' | 'ne' | 'negative' | 'nil' | 'odd' | 'positive' | 'regex' | 'within' | 'zero';
|
|
1432
|
-
|
|
1433
|
-
/**
|
|
1434
|
-
* Checks if a value is within a specified range.
|
|
1435
|
-
*
|
|
1436
|
-
* @example
|
|
1437
|
-
* ```ts
|
|
1438
|
-
* isWithin(1, 0, 1); // true
|
|
1439
|
-
* isWithin(1, 0, 1, false); // false
|
|
1440
|
-
* isWithin(0.5, 0, 1); // true
|
|
1441
|
-
* ```
|
|
1442
|
-
*
|
|
1443
|
-
* @param arg - The value to be checked.
|
|
1444
|
-
* @param min - The minimum value of the range.
|
|
1445
|
-
* @param max - The maximum value of the range.
|
|
1446
|
-
* @param inclusive - Whether the range is inclusive or exclusive. (defaults: `true`).
|
|
1447
|
-
*
|
|
1448
|
-
* @returns `true` if the value is in between, else `false`.
|
|
1449
|
-
*/
|
|
1450
|
-
export declare function isWithin(arg: unknown, min: unknown, max: unknown, inclusive?: boolean): boolean;
|
|
1451
|
-
|
|
1452
|
-
/**
|
|
1453
|
-
* Checks if the value is a positive number.
|
|
1454
|
-
*
|
|
1455
|
-
* @example
|
|
1456
|
-
* ```ts
|
|
1457
|
-
* isPositive(0); // true
|
|
1458
|
-
* isPositive(123); // false
|
|
1459
|
-
* isPositive(-123); // false
|
|
1460
|
-
* isPositive(0.0000001); // false
|
|
1461
|
-
* isPositive('hello world'); // false
|
|
1462
|
-
* isPositive({}); // false
|
|
1463
|
-
* isPositive([]); // false
|
|
1464
|
-
* isPositive(new Date()); // false
|
|
1465
|
-
* isPositive(null); // false
|
|
1466
|
-
* isPositive(undefined); // false
|
|
1467
|
-
* isPositive(NaN); // false
|
|
1468
|
-
* ```
|
|
1469
|
-
*
|
|
1470
|
-
* @param arg - The argument to be checked.
|
|
1471
|
-
*
|
|
1472
|
-
* @returns `true` if the value is a positive number, else `false`.
|
|
1473
|
-
*
|
|
1474
|
-
*/
|
|
1475
|
-
export declare function isZero(arg: unknown): arg is number;
|
|
1476
|
-
|
|
1477
|
-
declare type JSONValue = string | number | boolean | null | JSONValue[] | {
|
|
1478
|
-
[key: string]: JSONValue;
|
|
1479
|
-
};
|
|
1480
|
-
|
|
1481
|
-
/**
|
|
1482
|
-
* Converts a string to kebab case.
|
|
1483
|
-
*
|
|
1484
|
-
* @example
|
|
1485
|
-
* ```ts
|
|
1486
|
-
* const text = 'Hello World';
|
|
1487
|
-
* kebabCase(text); // 'hello-world'
|
|
1488
|
-
* ```
|
|
1489
|
-
*
|
|
1490
|
-
* @param str - The string to convert.
|
|
1491
|
-
*
|
|
1492
|
-
* @returns The converted string.
|
|
1493
|
-
*/
|
|
1494
|
-
export declare function kebabCase(str: string): string;
|
|
1495
|
-
|
|
1496
|
-
/**
|
|
1497
|
-
* Returns an array of the keys for an object's properties.
|
|
1498
|
-
*
|
|
1499
|
-
* @example
|
|
1500
|
-
* ```ts
|
|
1501
|
-
* const obj = { a: 1, b: 2, c: 3 };
|
|
1502
|
-
*
|
|
1503
|
-
* keys(obj); // ['a', 'b', 'c']
|
|
1504
|
-
* ```
|
|
1505
|
-
*
|
|
1506
|
-
* @param item - The object to query.
|
|
1507
|
-
*
|
|
1508
|
-
* @returns true if the object has the property, false otherwise.
|
|
1509
|
-
*/
|
|
1510
|
-
export declare function keys<T extends Obj, K extends keyof T>(item: T): K[];
|
|
1511
|
-
|
|
1512
|
-
declare type LastParameters<T> = T extends [...any, infer Last extends FnDynamic] ? Parameters<Last> : never;
|
|
1513
|
-
|
|
1514
|
-
declare type LastReturnType<T> = T extends [...any, infer Last extends FnDynamic] ? ReturnType<Last> : never;
|
|
1515
|
-
|
|
1516
|
-
/**
|
|
1517
|
-
* Check if the first argument is less than or equal to the second argument.
|
|
1518
|
-
*
|
|
1519
|
-
* @example
|
|
1520
|
-
* ```ts
|
|
1521
|
-
* le(3, 5); // true
|
|
1522
|
-
* le(5, 3); // false
|
|
1523
|
-
* le(5, 5); // true
|
|
1524
|
-
* ```
|
|
1525
|
-
*
|
|
1526
|
-
* @param a - The first argument to compare.
|
|
1527
|
-
* @param b - The second argument to compare.
|
|
1528
|
-
*
|
|
1529
|
-
* @returns `true` if `a` is less than or equal to `b`, otherwise `false`.
|
|
1530
|
-
*/
|
|
1531
|
-
export declare function le(a: unknown, b: unknown): boolean;
|
|
1532
|
-
|
|
1533
|
-
export declare type List<T, F, S> = {
|
|
1534
|
-
readonly current: readonly T[];
|
|
1535
|
-
readonly meta: Meta;
|
|
1536
|
-
subscribe(listener: () => void): () => void;
|
|
1537
|
-
goTo(page: number): void;
|
|
1538
|
-
next(): void;
|
|
1539
|
-
prev(): void;
|
|
1540
|
-
reset(): void;
|
|
1541
|
-
search(query: string, opts?: {
|
|
1542
|
-
immediate?: boolean;
|
|
1543
|
-
}): void;
|
|
1544
|
-
setData?(data: readonly T[]): void;
|
|
1545
|
-
setFilter(filter: F): void;
|
|
1546
|
-
setLimit(n: number): void;
|
|
1547
|
-
setSort(sort?: S): void;
|
|
1548
|
-
batch(mutator: (ctx: {
|
|
1549
|
-
setLimit(n: number): void;
|
|
1550
|
-
setFilter(f: F): void;
|
|
1551
|
-
setSort(s?: S): void;
|
|
1552
|
-
setQuery(q: string): void;
|
|
1553
|
-
setData?(d: readonly T[]): void;
|
|
1554
|
-
goTo(p: number): void;
|
|
1555
|
-
}) => void): void;
|
|
1556
|
-
};
|
|
1557
|
-
|
|
1558
|
-
export declare function list<T>(initialData: readonly T[], cfg?: LocalConfig<T>): List<T, Predicate<T>, Sorter<T>>;
|
|
1559
|
-
|
|
1560
|
-
declare type LocalConfig<T> = Readonly<{
|
|
1561
|
-
debounceMs?: number;
|
|
1562
|
-
filterFn?: Predicate<T>;
|
|
1563
|
-
limit?: number;
|
|
1564
|
-
searchFn?: (items: readonly T[], query: string, tone: number) => readonly T[];
|
|
1565
|
-
searchTone?: number;
|
|
1566
|
-
sortFn?: Sorter<T>;
|
|
1567
|
-
}>;
|
|
1568
|
-
|
|
1569
|
-
/**
|
|
1570
|
-
* Checks if the first argument is less than the second argument.
|
|
1571
|
-
*
|
|
1572
|
-
* @example
|
|
1573
|
-
* ```ts
|
|
1574
|
-
* lt(3, 5); // true
|
|
1575
|
-
* lt(5, 3); // false
|
|
1576
|
-
* lt(5, 5); // false
|
|
1577
|
-
* ```
|
|
1578
|
-
*
|
|
1579
|
-
* @param a - The first argument to compare.
|
|
1580
|
-
* @param b - The second argument to compare.
|
|
1581
|
-
*
|
|
1582
|
-
* @returns `true` if `a` is less than `b`, otherwise `false`.
|
|
1583
|
-
*/
|
|
1584
|
-
export declare function lt(a: unknown, b: unknown): boolean;
|
|
1585
|
-
|
|
1586
|
-
/**
|
|
1587
|
-
* Transforms an array by applying a callback function to each of its elements.
|
|
1588
|
-
*
|
|
1589
|
-
* @example
|
|
1590
|
-
* ```ts
|
|
1591
|
-
* const arr = [1, 2, 3];
|
|
1592
|
-
* map(arr, x => x * 2); // [2, 4, 6]
|
|
1593
|
-
* map(arr, async x => x * 2); // Promise<[2, 4, 6]>
|
|
1594
|
-
* ```
|
|
1595
|
-
*
|
|
1596
|
-
* @param array - The array to be transformed.
|
|
1597
|
-
* @param callback - The function to invoke for each element in the array.
|
|
1598
|
-
*
|
|
1599
|
-
* @return The transformed array, either as a synchronous result or a Promise if lazy is set.
|
|
1600
|
-
*
|
|
1601
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
1602
|
-
*/
|
|
1603
|
-
export declare function map<T, R, C extends CallbackDynamic<T, R>>(array: T[], callback: C): ResultArray<C>;
|
|
1604
|
-
|
|
1605
|
-
export declare namespace map {
|
|
1606
|
-
var fp: boolean;
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
/**
|
|
1610
|
-
* Finds the maximum item in an array.
|
|
1611
|
-
*
|
|
1612
|
-
* @description
|
|
1613
|
-
* This function can be used to find the maximum number, string, or any other type of item in an array.
|
|
1614
|
-
*
|
|
1615
|
-
* @example
|
|
1616
|
-
* ```ts
|
|
1617
|
-
* max([1, 2, 3]); // 3
|
|
1618
|
-
* max([{ value: 1 }, { value: 2 }, { value: 3 }], item => item.value); // 3
|
|
1619
|
-
* max(['apple', 'banana', 'cherry']); // 'cherry'
|
|
1620
|
-
* max([new Date('2023-01-01'), new Date('2022-01-01')]); // 2023-01-01
|
|
1621
|
-
* ```
|
|
1622
|
-
*
|
|
1623
|
-
* @param array - The array to be searched.
|
|
1624
|
-
* @param [callback] - (optional) The function to invoke for each element in the array to determine its value.
|
|
1625
|
-
*
|
|
1626
|
-
* @return The item with the maximum value as determined by the callback function.
|
|
1627
|
-
*
|
|
1628
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
1629
|
-
*/
|
|
1630
|
-
export declare function max<T>(array: T[], callback?: (item: T) => string | number | Date): T | undefined;
|
|
1631
|
-
|
|
1632
|
-
/**
|
|
1633
|
-
* Returns the median of an array of numbers.
|
|
1634
|
-
*
|
|
1635
|
-
* @example
|
|
1636
|
-
* ```ts
|
|
1637
|
-
* median([1, 2, 3, 4, 100]); // 3
|
|
1638
|
-
* median([1, 2, 3, 4, 5], (n) => n * 2); // 6
|
|
1639
|
-
* median([]); // undefined
|
|
1640
|
-
* median([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); // 5.5
|
|
1641
|
-
* median([new Date(2020-01-01), new Date(2020-01-02), new Date(2020-01-31)]) // 2020-01-02
|
|
1642
|
-
* ```
|
|
1643
|
-
*
|
|
1644
|
-
* @param arr - The array of numbers.
|
|
1645
|
-
* @param callback - (optional) A callback function to map the numbers.
|
|
1646
|
-
* @returns The median of the numbers.
|
|
1647
|
-
*/
|
|
1648
|
-
export declare function median<T>(arr: T[], callback?: (item: T) => number | Date): number | Date | undefined;
|
|
1649
|
-
|
|
1650
|
-
/**
|
|
1651
|
-
* Creates a function that memorizes the result of the provided function.
|
|
1652
|
-
* Supports expiration (TTL) and limited cache size (LRU).
|
|
1653
|
-
*
|
|
1654
|
-
* @example
|
|
1655
|
-
* ```ts
|
|
1656
|
-
* const add = (x, y) => x + y;
|
|
1657
|
-
* const memoizedAdd = memo(add, { ttl: 5000, maxSize: 10 });
|
|
1658
|
-
*
|
|
1659
|
-
* memoizedAdd(1, 2); // 3 (caches the result)
|
|
1660
|
-
* memoizedAdd(1, 2); // 3 (from cache)
|
|
1661
|
-
* ```
|
|
1662
|
-
*
|
|
1663
|
-
* @param fn - The function to memorize.
|
|
1664
|
-
* @param options - Memoization options.
|
|
1665
|
-
* @param [options.ttl] - (optional) time-to-live (TTL) for cache expiration (in milliseconds).
|
|
1666
|
-
* @param [options.maxSize] - (optional) maximum cache size (LRU eviction).
|
|
1667
|
-
* @param [options.resolver] - (optional) custom function to resolve the cache key.
|
|
1668
|
-
*
|
|
1669
|
-
* @returns A new function that memorizes the input function.
|
|
1670
|
-
*/
|
|
1671
|
-
export declare function memo<T extends Fn>(fn: T, { ttl, maxSize, resolver }?: MemoizeOptions<T>): (...args: Parameters<T>) => ReturnType<T>;
|
|
1672
|
-
|
|
1673
|
-
declare type MemoizeOptions<T extends Fn> = {
|
|
1674
|
-
ttl?: number;
|
|
1675
|
-
maxSize?: number;
|
|
1676
|
-
resolver?: (...args: Parameters<T>) => string;
|
|
1677
|
-
};
|
|
1678
|
-
|
|
1679
|
-
declare type Merge<T extends Obj[]> = T extends [infer First, ...infer Rest] ? First extends Obj ? Rest extends Obj[] ? DeepMerge<First, Merge<Rest>> : First : Obj : Obj;
|
|
1680
|
-
|
|
1681
|
-
/**
|
|
1682
|
-
* Merges multiple objects based on a specified merge strategy.
|
|
1683
|
-
*
|
|
1684
|
-
* @example
|
|
1685
|
-
* ```ts
|
|
1686
|
-
* const obj1 = { a: 1, b: { x: 10, y: "hello" }, c: [1] };
|
|
1687
|
-
* const obj2 = { b: { y: 20, z: true }, c: [2] };
|
|
1688
|
-
* const obj3 = { d: false, c: [3] };
|
|
1689
|
-
*
|
|
1690
|
-
* merge("deep", obj1, obj2, obj3); // { a: 1, b: { x: 10, y: 20, z: true }, c: [1, 2, 3], d: false }
|
|
1691
|
-
* merge("shallow", obj1, obj2, obj3); // { a: 1, b: { y: 20, z: true }, c: [3], d: false }
|
|
1692
|
-
* ```
|
|
1693
|
-
*
|
|
1694
|
-
* @param [strategy='deep'] - The merging strategy to use.
|
|
1695
|
-
* @param items - The objects to merge.
|
|
1696
|
-
* @returns A new merged object.
|
|
1697
|
-
*/
|
|
1698
|
-
export declare function merge<T extends Obj[]>(strategy?: MergeStrategy, ...items: [...T]): Merge<T>;
|
|
1699
|
-
|
|
1700
|
-
declare type MergeStrategy = 'deep' | 'shallow' | 'lastWins' | 'arrayConcat' | 'arrayReplace' | ((target: any, source: any) => any);
|
|
1701
|
-
|
|
1702
|
-
export declare type Meta = Readonly<{
|
|
1703
|
-
end: number;
|
|
1704
|
-
isEmpty: boolean;
|
|
1705
|
-
isFirst: boolean;
|
|
1706
|
-
isLast: boolean;
|
|
1707
|
-
limit: number;
|
|
1708
|
-
page: number;
|
|
1709
|
-
pages: number;
|
|
1710
|
-
start: number;
|
|
1711
|
-
total: number;
|
|
1712
|
-
}>;
|
|
1713
|
-
|
|
1714
|
-
/**
|
|
1715
|
-
* Finds the minimum item in an array.
|
|
1716
|
-
*
|
|
1717
|
-
* @description
|
|
1718
|
-
* This function can be used to find the minimum number, string, or any other type of item in an array.
|
|
1719
|
-
*
|
|
1720
|
-
* @example
|
|
1721
|
-
* ```ts
|
|
1722
|
-
* min([1, 2, 3]); // 1
|
|
1723
|
-
* min([{ value: 1 }, { value: 2 }, { value: 3 }], item => item.value); // 1
|
|
1724
|
-
* min(['apple', 'banana', 'cherry']); // 'apple'
|
|
1725
|
-
* min([new Date('2023-01-01'), new Date('2022-01-01')]); // 2022-01-01
|
|
1726
|
-
* ```
|
|
1727
|
-
*
|
|
1728
|
-
* @param array - The array to be searched.
|
|
1729
|
-
* @param [callback] - (optional) The function to invoke for each element in the array to determine its value.
|
|
1730
|
-
*
|
|
1731
|
-
* @return The item with the minimum value as determined by the callback function.
|
|
1732
|
-
*
|
|
1733
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
1734
|
-
*/
|
|
1735
|
-
export declare function min<T>(array: T[], callback?: (item: T) => string | number | Date): T | undefined;
|
|
1736
|
-
|
|
1737
|
-
/**
|
|
1738
|
-
* Represents a monetary amount with currency.
|
|
1739
|
-
* Amount is stored as bigint (minor units/cents) for precision.
|
|
1740
|
-
*/
|
|
1741
|
-
export declare type Money = {
|
|
1742
|
-
readonly amount: bigint;
|
|
1743
|
-
readonly currency: string;
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
|
-
/**
|
|
1747
|
-
* Multiplies a number by a scalar with precision handling for financial calculations.
|
|
1748
|
-
* Supports both regular numbers and bigint for exact precision.
|
|
1749
|
-
*
|
|
1750
|
-
* @example
|
|
1751
|
-
* ```ts
|
|
1752
|
-
* multiply(10, 5); // 50
|
|
1753
|
-
* multiply(0.1, 3); // 0.3 (precision-safe)
|
|
1754
|
-
* multiply(100n, 5n); // 500n
|
|
1755
|
-
* ```
|
|
1756
|
-
*
|
|
1757
|
-
* @param a - Number to multiply
|
|
1758
|
-
* @param b - Multiplier
|
|
1759
|
-
* @returns Product of a and b
|
|
1760
|
-
*/
|
|
1761
|
-
export declare function multiply(a: number, b: number): number;
|
|
1762
|
-
|
|
1763
|
-
export declare function multiply(a: bigint, b: bigint): bigint;
|
|
1764
|
-
|
|
1765
|
-
export declare type Obj = Record<string, any>;
|
|
1766
|
-
|
|
1767
|
-
/**
|
|
1768
|
-
* Create a function that runs once and returns the first result.
|
|
1769
|
-
*
|
|
1770
|
-
* @example
|
|
1771
|
-
* ```ts
|
|
1772
|
-
* const onceRandom = once(() => Math.random())
|
|
1773
|
-
* onceRandom() // 0.3
|
|
1774
|
-
* onceRandom() // 0.3
|
|
1775
|
-
*
|
|
1776
|
-
* onceRandom.reset()
|
|
1777
|
-
*
|
|
1778
|
-
* onceRandom() // 0.2
|
|
1779
|
-
* onceRandom() // 0.2
|
|
1780
|
-
* ```
|
|
1781
|
-
*
|
|
1782
|
-
* @param fn - The function to wrap.
|
|
1783
|
-
*
|
|
1784
|
-
* @returns A function that can only be called once.
|
|
1785
|
-
*/
|
|
1786
|
-
export declare const once: <T extends Fn>(fn: T) => T & {
|
|
1787
|
-
reset: () => void;
|
|
1788
|
-
};
|
|
1789
|
-
|
|
1790
|
-
/**
|
|
1791
|
-
* Processes an array with an async callback with controlled parallelism.
|
|
1792
|
-
* Similar to Promise.all, but limits how many items are processed concurrently.
|
|
1793
|
-
* Returns an ordered array of results.
|
|
1794
|
-
*
|
|
1795
|
-
* @example
|
|
1796
|
-
* ```ts
|
|
1797
|
-
* // Process 3 items at a time
|
|
1798
|
-
* const results = await parallel(3, [1, 2, 3, 4, 5], async (n) => {
|
|
1799
|
-
* await delay(100);
|
|
1800
|
-
* return n * 2;
|
|
1801
|
-
* });
|
|
1802
|
-
* // [2, 4, 6, 8, 10]
|
|
1803
|
-
*
|
|
1804
|
-
* // With abort signal
|
|
1805
|
-
* const controller = new AbortController();
|
|
1806
|
-
* const results = await parallel(2, items, async (item) => {
|
|
1807
|
-
* return processItem(item);
|
|
1808
|
-
* }, controller.signal);
|
|
1809
|
-
* ```
|
|
1810
|
-
*
|
|
1811
|
-
* @param limit - Maximum number of concurrent operations (must be >= 1)
|
|
1812
|
-
* @param array - Array of items to process
|
|
1813
|
-
* @param callback - Async function to process each item
|
|
1814
|
-
* @param signal - Optional AbortSignal to cancel processing
|
|
1815
|
-
* @returns Promise resolving to an ordered array of results
|
|
1816
|
-
* @throws {Error} If limit is less than 1
|
|
1817
|
-
* @throws {DOMException} If aborted via signal
|
|
1818
|
-
*/
|
|
1819
|
-
export declare function parallel<T, R>(limit: number, array: T[], callback: (item: T, index: number, array: T[]) => Promise<R>, signal?: AbortSignal): Promise<R[]>;
|
|
1820
|
-
|
|
1821
|
-
/**
|
|
1822
|
-
* Parses a JSON string and returns the resulting object.
|
|
1823
|
-
*
|
|
1824
|
-
* @example
|
|
1825
|
-
* ```ts
|
|
1826
|
-
* const json = '{"a":1,"b":2,"c":3}';
|
|
1827
|
-
* const result = parseJSON<Record<string, number>>(json, {
|
|
1828
|
-
* defaultValue: { a: 0, b: 0, c: 0 },
|
|
1829
|
-
* validator: (value) => Object.values(value).every(v => typeof v === 'number'),
|
|
1830
|
-
* errorHandler: (err) => console.warn('Parsing failed:', err.message),
|
|
1831
|
-
* silent: true
|
|
1832
|
-
* });
|
|
1833
|
-
* console.log(result); // { a: 1, b: 2, c: 3 }
|
|
1834
|
-
* ```
|
|
1835
|
-
*
|
|
1836
|
-
* @template T - The expected type of the parsed JSON.
|
|
1837
|
-
* @param json - The JSON string to parse. If not a string, it is returned as is.
|
|
1838
|
-
* @param options - Configuration options for parsing.
|
|
1839
|
-
*
|
|
1840
|
-
* @returns The parsed object if successful, otherwise the default value.
|
|
1841
|
-
*/
|
|
1842
|
-
export declare function parseJSON<T extends JSONValue>(json: unknown, options?: ParseJSONOptions<T>): T | undefined;
|
|
1843
|
-
|
|
1844
|
-
declare type ParseJSONOptions<T> = {
|
|
1845
|
-
defaultValue?: T;
|
|
1846
|
-
reviver?: (key: string, value: any) => any;
|
|
1847
|
-
validator?: (value: any) => boolean;
|
|
1848
|
-
silent?: boolean;
|
|
1849
|
-
};
|
|
1850
|
-
|
|
1851
|
-
/**
|
|
1852
|
-
* Converts a string to Pascal case.
|
|
1853
|
-
*
|
|
1854
|
-
* @example
|
|
1855
|
-
* ```ts
|
|
1856
|
-
* const text = 'Hello World';
|
|
1857
|
-
* pascalCase(text) // 'HelloWorld';
|
|
1858
|
-
* ```
|
|
1859
|
-
*
|
|
1860
|
-
* @param str - The string to convert.
|
|
1861
|
-
*
|
|
1862
|
-
* @returns The converted string.
|
|
1863
|
-
*/
|
|
1864
|
-
export declare function pascalCase(str: string): string;
|
|
1865
|
-
|
|
1866
|
-
/**
|
|
1867
|
-
* Retrieves the value at a given path of the object. If the value is undefined, the default value is returned.
|
|
1868
|
-
*
|
|
1869
|
-
* @example
|
|
1870
|
-
* ```ts
|
|
1871
|
-
* const obj = { a: { b: { c: 3 } }, d: [1, 2, 3] };
|
|
1872
|
-
*
|
|
1873
|
-
* getValue(obj, 'a.b.c'); // 3
|
|
1874
|
-
* getValue(obj, 'a.b.d', 'default'); // 'default'
|
|
1875
|
-
* getValue(obj, 'd[1]', undefined, { allowArrayIndex: true }); // 2
|
|
1876
|
-
* getValue(obj, 'e.f.g', 'default', { throwOnMissing: true }); // throws Error
|
|
1877
|
-
* ```
|
|
1878
|
-
*
|
|
1879
|
-
* @template T - The type of the object to query.
|
|
1880
|
-
* @template P - The type of the path string.
|
|
1881
|
-
* @param item - The object to query.
|
|
1882
|
-
* @param path - The path of the property to get.
|
|
1883
|
-
* @param [defaultValue] - The value returned for undefined resolved values.
|
|
1884
|
-
* @param [options] - Additional options for value retrieval.
|
|
1885
|
-
*
|
|
1886
|
-
* @returns The resolved value.
|
|
1887
|
-
*
|
|
1888
|
-
* @throws If throwOnMissing is true and the path doesn't exist.
|
|
1889
|
-
*/
|
|
1890
|
-
export declare function path<T extends Obj, P extends string>(item: T, path: P, defaultValue?: unknown, options?: PathOptions): PathValue<T, P> | undefined;
|
|
1891
|
-
|
|
1892
|
-
declare type PathOptions = {
|
|
1893
|
-
throwOnMissing?: boolean;
|
|
1894
|
-
allowArrayIndex?: boolean;
|
|
1895
|
-
};
|
|
1896
|
-
|
|
1897
|
-
declare type PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? PathValue<T[Key], Rest> : undefined : P extends keyof T ? T[P] : undefined;
|
|
1898
|
-
|
|
1899
|
-
/**
|
|
1900
|
-
* Picks the first element from an array that satisfies a predicate function
|
|
1901
|
-
*
|
|
1902
|
-
* @example
|
|
1903
|
-
* ```ts
|
|
1904
|
-
* const arr = [1, 2, 3, 4];
|
|
1905
|
-
* pick(arr, x => x * x, x => x > 2) // 9
|
|
1906
|
-
* await pick(arr, async x => x * x, x => x > 2) // 9
|
|
1907
|
-
* ```
|
|
1908
|
-
*
|
|
1909
|
-
* @param array - The array to search.
|
|
1910
|
-
* @param callback - A function that is called for each element in the array.
|
|
1911
|
-
* @param predicate - A function that is called to validate each element in the array.
|
|
1912
|
-
*
|
|
1913
|
-
* @return The first element that satisfies the predicate, or undefined if no such element is found.
|
|
1914
|
-
*
|
|
1915
|
-
* @throws {TypeError} If the first argument is not an array.
|
|
1916
|
-
*/
|
|
1917
|
-
export declare function pick<T, R = T>(array: T[], callback: (item: T, index: number, array: T[]) => R, predicate?: (item: T, index: number, array: T[]) => boolean): R | undefined;
|
|
1918
|
-
|
|
1919
|
-
export declare namespace pick {
|
|
1920
|
-
var fp: boolean;
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
/**
|
|
1924
|
-
* Pipes multiple functions into a single function. It starts from the leftmost function and proceeds to the right.
|
|
1925
|
-
*
|
|
1926
|
-
* @example
|
|
1927
|
-
* ```ts
|
|
1928
|
-
* const add = (x) => x + 2;
|
|
1929
|
-
* const multiply = (x) => x * 3;
|
|
1930
|
-
* const subtract = (x) => x - 4;
|
|
1931
|
-
* const pipedFn = pipe(subtract, multiply, add);
|
|
1932
|
-
*
|
|
1933
|
-
* pipedFn(5); // ((5-4) * 3) + 2 = 5
|
|
1934
|
-
* ```
|
|
1935
|
-
*
|
|
1936
|
-
* @example
|
|
1937
|
-
* ```ts
|
|
1938
|
-
* const square = async (x) => x * x;
|
|
1939
|
-
* const add = async (x) => x + 2;
|
|
1940
|
-
* const pipedFn = pipe(square, add);
|
|
1941
|
-
*
|
|
1942
|
-
* await pipedFn(4); // (4 * 4) + 2 = 18
|
|
1943
|
-
* ```
|
|
1944
|
-
*
|
|
1945
|
-
* @param fns - List of functions to be piped.
|
|
1946
|
-
*
|
|
1947
|
-
* @returns A new function that is the pipe of the input functions.
|
|
1948
|
-
*/
|
|
1949
|
-
export declare function pipe<T extends FnDynamic[]>(...fns: T): PipeReturn<T>;
|
|
1950
|
-
|
|
1951
|
-
declare type PipeReturn<T extends FnDynamic[]> = (...args: FirstParameters<T>) => LastReturnType<T> extends Promise<any> ? Promise<Awaited<LastReturnType<T>>> : LastReturnType<T>;
|
|
1952
|
-
|
|
1953
|
-
/**
|
|
1954
|
-
* Creates a promise pool that limits the number of concurrent promises.
|
|
1955
|
-
* Useful for rate limiting API calls or controlling resource usage.
|
|
1956
|
-
*
|
|
1957
|
-
* @example
|
|
1958
|
-
* ```ts
|
|
1959
|
-
* const requestPool = pool(3);
|
|
1960
|
-
*
|
|
1961
|
-
* const results = await Promise.all([
|
|
1962
|
-
* requestPool(() => fetch('/api/1')),
|
|
1963
|
-
* requestPool(() => fetch('/api/2')),
|
|
1964
|
-
* requestPool(() => fetch('/api/3')),
|
|
1965
|
-
* requestPool(() => fetch('/api/4')), // Will wait for one of the above to finish
|
|
1966
|
-
* ]);
|
|
1967
|
-
* ```
|
|
1968
|
-
*
|
|
1969
|
-
* @param limit - Maximum number of concurrent promises
|
|
1970
|
-
* @returns Function that accepts a promise-returning function and executes it when a slot is available
|
|
1971
|
-
*/
|
|
1972
|
-
export declare function pool(limit: number): <T>(fn: () => Promise<T>) => Promise<T>;
|
|
1973
|
-
|
|
1974
|
-
export declare type Predicate<T> = (value: T, index: number, array: readonly T[]) => boolean;
|
|
1975
|
-
|
|
1976
|
-
/**
|
|
1977
|
-
* Creates a Promise that can be aborted using an AbortController.
|
|
1978
|
-
*
|
|
1979
|
-
* @example
|
|
1980
|
-
* ```ts
|
|
1981
|
-
* const slowFn = () => new Promise(resolve => setTimeout(() => resolve('slow'), 10000));
|
|
1982
|
-
* const fastFn = () => new Promise(resolve => setTimeout(() => resolve('fast'), 5000));
|
|
1983
|
-
*
|
|
1984
|
-
* predict(slowFn); // rejects after 7 seconds
|
|
1985
|
-
* predict(fastFn); // resolves with 'fast' after 5 seconds
|
|
1986
|
-
* ```
|
|
1987
|
-
*
|
|
1988
|
-
* @param fn - The function to execute, which receives an AbortSignal.
|
|
1989
|
-
* @param options - The options for the abortable function.
|
|
1990
|
-
* @param [options.signal] - The AbortSignal to use for aborting the Promise.
|
|
1991
|
-
* @param [options.timeout=7000] - The timeout in milliseconds after which the Promise will be aborted.
|
|
1992
|
-
*
|
|
1993
|
-
* @returns - A Promise that resolves with the result of the callback or rejects if aborted.
|
|
1994
|
-
*/
|
|
1995
|
-
export declare function predict<T>(fn: (signal: AbortSignal) => Promise<T>, options?: {
|
|
1996
|
-
signal?: AbortSignal;
|
|
1997
|
-
timeout?: number;
|
|
1998
|
-
}): Promise<T>;
|
|
1999
|
-
|
|
2000
|
-
export declare type Primitive = string | number | boolean;
|
|
2001
|
-
|
|
2002
|
-
/**
|
|
2003
|
-
* Creates a new Proxy for the given object that invokes functions when properties are accessed or modified.
|
|
2004
|
-
|
|
2005
|
-
* @example
|
|
2006
|
-
* ```ts
|
|
2007
|
-
* const obj = { a: 1, b: 2 };
|
|
2008
|
-
* const log = (prop, curr, prev, target) => console.log(`Property '${prop}' changed from ${prev} to ${curr}`);
|
|
2009
|
-
* const proxyObj = proxy(obj, { set: log });
|
|
2010
|
-
* proxyObj.a = 3; // logs 'Property 'a' changed from 1 to 3'
|
|
2011
|
-
* ```
|
|
2012
|
-
*
|
|
2013
|
-
* @param item - The object to observe.
|
|
2014
|
-
* @param options - Configuration options for the proxy.
|
|
2015
|
-
* @param [options.set] - A function to call when a property is set. It receives the property name, current value, previous value, and the target object.
|
|
2016
|
-
* @param [options.get] - A function to call when a property is accessed. It receives the property name, value, and the target object.
|
|
2017
|
-
* @param [options.deep] - If true, the proxy will also apply to nested objects.
|
|
2018
|
-
* @param [options.watch] - An array of property names to watch. If provided, only these properties will trigger the set and get functions.
|
|
2019
|
-
*
|
|
2020
|
-
* @returns A new Proxy for the given object.
|
|
2021
|
-
*/
|
|
2022
|
-
export declare function proxy<T extends Obj>(item: T, options: ProxyOptions<T>): T;
|
|
2023
|
-
|
|
2024
|
-
declare type ProxyOptions<T> = {
|
|
2025
|
-
set?: <K extends PropertyKey>(prop: K, curr: unknown, prev: unknown, target: T) => unknown;
|
|
2026
|
-
get?: <K extends PropertyKey>(prop: K, val: unknown, target: T) => unknown;
|
|
2027
|
-
deep?: boolean;
|
|
2028
|
-
watch?: (keyof T)[];
|
|
2029
|
-
};
|
|
2030
|
-
|
|
2031
|
-
/**
|
|
2032
|
-
* Removes all nullable and empty values from strings, arrays, or objects.
|
|
2033
|
-
*
|
|
2034
|
-
* - For strings: Removes leading/trailing whitespace and returns undefined if empty
|
|
2035
|
-
* - For arrays: Recursively removes null, undefined, empty strings, and empty objects/arrays
|
|
2036
|
-
* - For objects: Recursively removes properties with null, undefined, empty strings, and empty objects/arrays
|
|
2037
|
-
*
|
|
2038
|
-
* @example
|
|
2039
|
-
* ```ts
|
|
2040
|
-
* prune(' hello '); // 'hello'
|
|
2041
|
-
* prune(' '); // undefined
|
|
2042
|
-
* prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]
|
|
2043
|
-
* prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }
|
|
2044
|
-
* prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }
|
|
2045
|
-
* ```
|
|
2046
|
-
*
|
|
2047
|
-
* @param value - The value to prune (can be string, array, object, or any other type)
|
|
2048
|
-
* @returns The pruned value, or undefined if the result would be empty
|
|
2049
|
-
*/
|
|
2050
|
-
export declare function prune<T>(value: T): T | undefined;
|
|
2051
|
-
|
|
2052
|
-
/**
|
|
2053
|
-
* Creates a promise queue that processes promises sequentially with optional concurrency limit.
|
|
2054
|
-
*
|
|
2055
|
-
* @example
|
|
2056
|
-
* ```ts
|
|
2057
|
-
* const requestQueue = queue({ concurrency: 2 });
|
|
2058
|
-
*
|
|
2059
|
-
* requestQueue.add(() => fetch('/api/1'));
|
|
2060
|
-
* requestQueue.add(() => fetch('/api/2'));
|
|
2061
|
-
* requestQueue.add(() => fetch('/api/3'));
|
|
2062
|
-
*
|
|
2063
|
-
* await requestQueue.onIdle(); // Wait for all tasks to complete
|
|
2064
|
-
* ```
|
|
2065
|
-
*
|
|
2066
|
-
* @param options - Queue configuration
|
|
2067
|
-
* @param options.concurrency - Maximum number of concurrent promises (default: 1)
|
|
2068
|
-
* @returns Queue instance with add, onIdle, and clear methods
|
|
2069
|
-
*/
|
|
2070
|
-
export declare function queue(options?: {
|
|
2071
|
-
concurrency?: number;
|
|
2072
|
-
}): {
|
|
2073
|
-
/**
|
|
2074
|
-
* Adds a promise-returning function to the queue
|
|
2075
|
-
*/
|
|
2076
|
-
add: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
2077
|
-
/**
|
|
2078
|
-
* Clears all pending tasks from the queue
|
|
2079
|
-
*/
|
|
2080
|
-
clear: () => void;
|
|
2081
|
-
/**
|
|
2082
|
-
* Returns a promise that resolves when the queue becomes idle
|
|
2083
|
-
*/
|
|
2084
|
-
onIdle: () => Promise<void>;
|
|
2085
|
-
/**
|
|
2086
|
-
* Returns the number of currently active promises
|
|
2087
|
-
*/
|
|
2088
|
-
readonly pending: number;
|
|
2089
|
-
/**
|
|
2090
|
-
* Returns the current size of the queue
|
|
2091
|
-
*/
|
|
2092
|
-
readonly size: number;
|
|
2093
|
-
};
|
|
2094
|
-
|
|
2095
|
-
/**
|
|
2096
|
-
* Race multiple promises but with a guaranteed minimum delay.
|
|
2097
|
-
* Useful for showing loading states for at least a minimum duration.
|
|
2098
|
-
*
|
|
2099
|
-
* @example
|
|
2100
|
-
* ```ts
|
|
2101
|
-
* // Show loading spinner for at least 500ms
|
|
2102
|
-
* const result = await race(
|
|
2103
|
-
* fetchData(),
|
|
2104
|
-
* 500
|
|
2105
|
-
* );
|
|
2106
|
-
*
|
|
2107
|
-
* // With multiple promises
|
|
2108
|
-
* const result = await race(
|
|
2109
|
-
* [fetch('/api/1'), fetch('/api/2')],
|
|
2110
|
-
* 1000
|
|
2111
|
-
* );
|
|
2112
|
-
* ```
|
|
2113
|
-
*
|
|
2114
|
-
* @param promises - Single promise or array of promises to race
|
|
2115
|
-
* @param minDelay - Minimum delay in milliseconds before resolving
|
|
2116
|
-
* @returns Promise that resolves with the first result after the minimum delay
|
|
2117
|
-
*/
|
|
2118
|
-
export declare function race<T>(promises: Promise<T> | Promise<T>[], minDelay: number): Promise<T>;
|
|
2119
|
-
|
|
2120
|
-
/**
|
|
2121
|
-
* Generates a random integer between two values, inclusive.
|
|
2122
|
-
*
|
|
2123
|
-
* @example
|
|
2124
|
-
* ```ts
|
|
2125
|
-
* random(1, 10); // a random integer between 1 and 10
|
|
2126
|
-
* ```
|
|
2127
|
-
*
|
|
2128
|
-
* @param min - The minimum value.
|
|
2129
|
-
* @param max - The maximum value.
|
|
2130
|
-
* @returns A random integer between min and max.
|
|
2131
|
-
*/
|
|
2132
|
-
export declare function random(min: number, max: number): number;
|
|
2133
|
-
|
|
2134
|
-
/**
|
|
2135
|
-
* Creates an array of numbers progressing from start up to, but not including, end. A step is used to specify the difference between each number in the array.
|
|
2136
|
-
*
|
|
2137
|
-
* @example
|
|
2138
|
-
* ```ts
|
|
2139
|
-
* const start = 0;
|
|
2140
|
-
* const stop = 10;
|
|
2141
|
-
* const step = 2;
|
|
2142
|
-
*
|
|
2143
|
-
* range(start, stop, step) // [0, 2, 4, 6, 8];
|
|
2144
|
-
* ```
|
|
2145
|
-
*
|
|
2146
|
-
* @param start - The start of the range.
|
|
2147
|
-
* @param stop - The end of the range.
|
|
2148
|
-
* @param step - The value to increment or decrement by.
|
|
2149
|
-
*
|
|
2150
|
-
* @returns The range of numbers.
|
|
2151
|
-
*
|
|
2152
|
-
* @throws {TypeError} If start, stop, or step are not finite numbers.
|
|
2153
|
-
* @throws {Error} If step is 0 or if range exceeds maximum size.
|
|
2154
|
-
*/
|
|
2155
|
-
export declare function range(start: number, stop: number, step: number): number[];
|
|
2156
|
-
|
|
2157
|
-
/**
|
|
2158
|
-
* Creates an array of numbers progressing from min to max with a specified number of steps.
|
|
2159
|
-
*
|
|
2160
|
-
* @example
|
|
2161
|
-
* ```ts
|
|
2162
|
-
* const min = 0;
|
|
2163
|
-
* const max = 10;
|
|
2164
|
-
* const steps = 5;
|
|
2165
|
-
*
|
|
2166
|
-
* rate(min, max, steps) // [0, 2.5, 5, 7.5, 10];
|
|
2167
|
-
* ```
|
|
2168
|
-
*
|
|
2169
|
-
* @param min - The start of the range.
|
|
2170
|
-
* @param max - The end of the range.
|
|
2171
|
-
* @param [steps=5] - The number of steps between min and max.
|
|
2172
|
-
*
|
|
2173
|
-
* @returns The range of numbers.
|
|
2174
|
-
*/
|
|
2175
|
-
export declare function rate(min: number, max: number, steps?: number): number[];
|
|
2176
|
-
|
|
2177
|
-
/**
|
|
2178
|
-
* Reduces an array to a single value by applying a callback function
|
|
2179
|
-
* to each element in the array, passing the accumulated result and
|
|
2180
|
-
* the current element as arguments. Supports both synchronous and
|
|
2181
|
-
* asynchronous callback functions.
|
|
2182
|
-
*
|
|
2183
|
-
* @example
|
|
2184
|
-
* ```ts
|
|
2185
|
-
* const arr = [1, 2, 3];
|
|
2186
|
-
* reduce(arr, (acc, curr) => acc + curr, 0); // 10
|
|
2187
|
-
* await reduce(arr, async (acc, curr) => acc + curr, 0); // 10
|
|
2188
|
-
* ```
|
|
2189
|
-
*
|
|
2190
|
-
* @param array - The array to reduce.
|
|
2191
|
-
* @param callback - The callback function to apply to each element.
|
|
2192
|
-
* @param initialValue - The initial value for the accumulator.
|
|
2193
|
-
*
|
|
2194
|
-
* @returns The reduced value, or a Promise that resolves to the reduced value if the callback is asynchronous.
|
|
2195
|
-
*
|
|
2196
|
-
* @throws {TypeError} If the first argument is not an array.
|
|
2197
|
-
*/
|
|
2198
|
-
export declare function reduce<T, R, C extends Callback_2<R, T>>(array: T[], callback: C, initialValue: R): Result<C>;
|
|
2199
|
-
|
|
2200
|
-
export declare namespace reduce {
|
|
2201
|
-
var fn: boolean;
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
declare type RemoteConfig<T, F, S> = Readonly<{
|
|
2205
|
-
debounceMs?: number;
|
|
2206
|
-
fetch: (q: RemoteQuery<F, S>) => Promise<RemoteResult<T>>;
|
|
2207
|
-
initialFilter?: F;
|
|
2208
|
-
initialSort?: S;
|
|
2209
|
-
limit?: number;
|
|
2210
|
-
}>;
|
|
2211
|
-
|
|
2212
|
-
export declare type RemoteList<T, F, S> = {
|
|
2213
|
-
readonly current: readonly T[];
|
|
2214
|
-
readonly meta: RemoteMeta;
|
|
2215
|
-
subscribe(listener: () => void): () => void;
|
|
2216
|
-
goTo(page: number): Promise<void>;
|
|
2217
|
-
invalidate?(): void;
|
|
2218
|
-
next(): Promise<void>;
|
|
2219
|
-
prev(): Promise<void>;
|
|
2220
|
-
refresh(): Promise<void>;
|
|
2221
|
-
reset(): Promise<void>;
|
|
2222
|
-
search(query: string, opts?: {
|
|
2223
|
-
immediate?: boolean;
|
|
2224
|
-
}): Promise<void>;
|
|
2225
|
-
setFilter(filter: F): Promise<void>;
|
|
2226
|
-
setLimit(n: number): Promise<void>;
|
|
2227
|
-
setSort(sort?: S): Promise<void>;
|
|
2228
|
-
batch(mutator: (ctx: {
|
|
2229
|
-
setLimit(n: number): void;
|
|
2230
|
-
setFilter(f: F): void;
|
|
2231
|
-
setSort(s?: S): void;
|
|
2232
|
-
setQuery(q: string): void;
|
|
2233
|
-
setData?(d: readonly T[]): void;
|
|
2234
|
-
goTo(p: number): void;
|
|
2235
|
-
}) => void): Promise<void>;
|
|
2236
|
-
};
|
|
2237
|
-
|
|
2238
|
-
export declare function remoteList<T, F = Record<string, unknown>, S = {
|
|
2239
|
-
key?: string;
|
|
2240
|
-
dir?: 'asc' | 'desc';
|
|
2241
|
-
}>(cfg: RemoteConfig<T, F, S>): RemoteList<T, F, S>;
|
|
2242
|
-
|
|
2243
|
-
export declare type RemoteMeta = Readonly<{
|
|
2244
|
-
end: number;
|
|
2245
|
-
error: string | null;
|
|
2246
|
-
isEmpty: boolean;
|
|
2247
|
-
isFirst: boolean;
|
|
2248
|
-
isLast: boolean;
|
|
2249
|
-
limit: number;
|
|
2250
|
-
loading: boolean;
|
|
2251
|
-
page: number;
|
|
2252
|
-
pages: number;
|
|
2253
|
-
start: number;
|
|
2254
|
-
total: number;
|
|
2255
|
-
}>;
|
|
2256
|
-
|
|
2257
|
-
declare type RemoteQuery<F, S> = Readonly<{
|
|
2258
|
-
filter?: F;
|
|
2259
|
-
limit: number;
|
|
2260
|
-
page: number;
|
|
2261
|
-
search?: string;
|
|
2262
|
-
sort?: S;
|
|
2263
|
-
}>;
|
|
2264
|
-
|
|
2265
|
-
declare type RemoteResult<T> = Readonly<{
|
|
2266
|
-
items: readonly T[];
|
|
2267
|
-
total: number;
|
|
2268
|
-
}>;
|
|
2269
|
-
|
|
2270
|
-
declare type RemoveFirstParameter<T extends Fn> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
2271
|
-
|
|
2272
|
-
export declare type Result<C extends FnDynamic> = C extends FnAsync ? Promise<Awaited<ReturnType<C>>> : ReturnType<C>;
|
|
2273
|
-
|
|
2274
|
-
export declare type ResultArray<C extends FnDynamic> = C extends FnAsync ? Promise<Awaited<ReturnType<C>>[]> : ReturnType<C>[];
|
|
2275
|
-
|
|
2276
|
-
/**
|
|
2277
|
-
* Retries an asynchronous function a specified number of times with delay and optional exponential backoff.
|
|
2278
|
-
*
|
|
2279
|
-
* @example
|
|
2280
|
-
* ```ts
|
|
2281
|
-
* retry(() => fetchData(), { times: 3, delay: 1000, backoff: 2, signal: abortSignal })
|
|
2282
|
-
* .then(result => console.log(result))
|
|
2283
|
-
* .catch(error => console.error(error));
|
|
2284
|
-
* ```
|
|
2285
|
-
*
|
|
2286
|
-
* @param fn - The asynchronous function to retry.
|
|
2287
|
-
* @param options - (optional) Options for retrying the function.
|
|
2288
|
-
* @param [options.times=3] - The number of retry attempts.
|
|
2289
|
-
* @param [options.delay=250] - The delay in milliseconds between retries.
|
|
2290
|
-
* @param [options.backoff=1] - Exponential backoff factor (default: 1 → no backoff).
|
|
2291
|
-
* @param [options.signal] - `AbortSignal` to allow canceling retries.
|
|
2292
|
-
*
|
|
2293
|
-
* @returns The result of the asynchronous function.
|
|
2294
|
-
*/
|
|
2295
|
-
export declare function retry<T>(fn: () => Promise<T>, { times, delay, backoff, signal, }?: {
|
|
2296
|
-
times?: number;
|
|
2297
|
-
delay?: number;
|
|
2298
|
-
backoff?: number | ((attempt: number, delay: number) => number);
|
|
2299
|
-
signal?: AbortSignal;
|
|
2300
|
-
}): Promise<T>;
|
|
2301
|
-
|
|
2302
|
-
/**
|
|
2303
|
-
* Rounds a number to a specified number of decimal places.
|
|
2304
|
-
*
|
|
2305
|
-
* The `precision` argument is limited to be within the range of -323 to +292 to avoid NaN results.
|
|
2306
|
-
*
|
|
2307
|
-
* @example
|
|
2308
|
-
* ```ts
|
|
2309
|
-
* round(123.456) // 123
|
|
2310
|
-
* round(123.456, -1) // 120
|
|
2311
|
-
* round(123.456, 1, Math.ceil) // 123.5
|
|
2312
|
-
* round(123.456, 1, Math.floor) // 123.4
|
|
2313
|
-
* ```
|
|
2314
|
-
*
|
|
2315
|
-
* @param value - The number to round.
|
|
2316
|
-
* @param precision - The number of decimal places to round to.
|
|
2317
|
-
* @param [parser] - (optional) function to convert the number to a value.
|
|
2318
|
-
*
|
|
2319
|
-
* @returns The rounded number.
|
|
2320
|
-
*/
|
|
2321
|
-
export declare function round(value: number, precision?: number, parser?: (value: number) => number): number;
|
|
2322
|
-
|
|
2323
|
-
/**
|
|
2324
|
-
* Performs a search on an array of objects, checking all values for a match with the search string.
|
|
2325
|
-
*
|
|
2326
|
-
* @example
|
|
2327
|
-
* ```ts
|
|
2328
|
-
* const data = [{ name: 'John Doe', age: 25 }, { name: 'Jane Doe', age: 30 }];
|
|
2329
|
-
* search(data, 'doe', 0.5); // [{ name: 'John Doe', age: 25 }, { name: 'Jane Doe', age: 30 }]
|
|
2330
|
-
* ```
|
|
2331
|
-
*
|
|
2332
|
-
* @param array - The array of objects to search.
|
|
2333
|
-
* @param query - The string to search for.
|
|
2334
|
-
* @param [tone=0.25] - Degree of similarity between 0 and 1.
|
|
2335
|
-
*
|
|
2336
|
-
* @returns The filtered array of objects that match the search string.
|
|
2337
|
-
*
|
|
2338
|
-
* @throws {Error} If input values are invalid.
|
|
2339
|
-
*/
|
|
2340
|
-
export declare function search<T>(array: T[], query: string, tone?: number): T[];
|
|
2341
|
-
|
|
2342
|
-
/**
|
|
2343
|
-
* Recursively checks if an object contains a value similar to the search string.
|
|
2344
|
-
*
|
|
2345
|
-
* @example
|
|
2346
|
-
* ```ts
|
|
2347
|
-
* const obj = { a: 'hello', b: { c: 'world' }, d: [1, 2, 3] };
|
|
2348
|
-
*
|
|
2349
|
-
* seek(obj, 'hello'); // true
|
|
2350
|
-
* seek(obj, 'world'); // true
|
|
2351
|
-
* seek(obj, 'foo'); // false
|
|
2352
|
-
* seek(obj, 'hello', 0.5); // true
|
|
2353
|
-
* seek(obj, 'hello', 0.8); // true
|
|
2354
|
-
* seek(obj, 'hello', 1); // true
|
|
2355
|
-
* seek(obj, 'hello', 1.5); // false
|
|
2356
|
-
* seek(obj, 'hello', -1); // false
|
|
2357
|
-
* seek(obj, 'hello', 0); // false
|
|
2358
|
-
* ```
|
|
2359
|
-
*
|
|
2360
|
-
* @param item - The object to search within.
|
|
2361
|
-
* @param query - The search string.
|
|
2362
|
-
* @param [tone=1] - The similarity threshold.
|
|
2363
|
-
*
|
|
2364
|
-
* @returns Whether the object contains a matching value.
|
|
2365
|
-
*/
|
|
2366
|
-
export declare function seek<T>(item: T, query: string, tone?: number): boolean;
|
|
2367
|
-
|
|
2368
|
-
/**
|
|
2369
|
-
* Selects elements from an array based on a callback function and an optional predicate function.
|
|
2370
|
-
*
|
|
2371
|
-
* @example
|
|
2372
|
-
* ```ts
|
|
2373
|
-
* const arr = [1, 2, 3, 4];
|
|
2374
|
-
* select(arr, x => x * x, x => x > 2) // [9, 16]
|
|
2375
|
-
* await select(arr, async x => x * x, x => x > 2) // [9, 16]
|
|
2376
|
-
* ```
|
|
2377
|
-
*
|
|
2378
|
-
* @param array - The array to select from.
|
|
2379
|
-
* @param callback - The function to map the values.
|
|
2380
|
-
* @param [predicate] - (optional) The function to filter the values.
|
|
2381
|
-
*
|
|
2382
|
-
* @returns A new array with the selected values.
|
|
2383
|
-
*
|
|
2384
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
2385
|
-
*/
|
|
2386
|
-
export declare function select<T, R, C extends CallbackDynamic<T, R>>(array: T[], callback: C, predicate?: Predicate<T>): ResultArray<C>;
|
|
2387
|
-
|
|
2388
|
-
export declare namespace select {
|
|
2389
|
-
var fp: boolean;
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
export declare type Selector<T> = keyof T | ((item: T) => Primitive);
|
|
2393
|
-
|
|
2394
|
-
/**
|
|
2395
|
-
* Shifts the elements of an array to the left by a specified number of positions.
|
|
2396
|
-
*
|
|
2397
|
-
* @example
|
|
2398
|
-
* ```ts
|
|
2399
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
2400
|
-
* shift(arr, 2); // [3, 4, 5]
|
|
2401
|
-
* shift(arr, 2, true); // [3, 4, 5, 1, 2]
|
|
2402
|
-
* ```
|
|
2403
|
-
* @param array - The array to shift.
|
|
2404
|
-
* @param positions - The number of positions to shift the array.
|
|
2405
|
-
* @param rotate - If `true`, the elements that are shifted out will be added to the end of the array.
|
|
2406
|
-
*
|
|
2407
|
-
* @returns A new array with the elements shifted.
|
|
2408
|
-
*
|
|
2409
|
-
* @throws {TypeError} If the first argument is not an array, or the second argument is not a number.
|
|
2410
|
-
*/
|
|
2411
|
-
export declare function shift<T>(array: T[], positions: number, rotate?: boolean): T[];
|
|
2412
|
-
|
|
2413
|
-
export declare namespace shift {
|
|
2414
|
-
var fp: boolean;
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
/**
|
|
2418
|
-
* Shuffles an array randomly.
|
|
2419
|
-
*
|
|
2420
|
-
* @example
|
|
2421
|
-
* ```ts
|
|
2422
|
-
* const arr = [1, 2, 3, 4];
|
|
2423
|
-
* shuffle(arr); // a shuffled version of the array
|
|
2424
|
-
* ```
|
|
2425
|
-
*
|
|
2426
|
-
* @param array - The array to shuffle.
|
|
2427
|
-
*
|
|
2428
|
-
* @returns A new shuffled array.
|
|
2429
|
-
*
|
|
2430
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
2431
|
-
*/
|
|
2432
|
-
export declare function shuffle<T>(array: T[]): T[];
|
|
2433
|
-
|
|
2434
|
-
/**
|
|
2435
|
-
* Calculate the similarity between two strings using the Levenshtein distance algorithm.
|
|
2436
|
-
*
|
|
2437
|
-
* @example
|
|
2438
|
-
* ```ts
|
|
2439
|
-
* similarity('abc', 'abc') // 1
|
|
2440
|
-
* similarity('a', 'b') // 0
|
|
2441
|
-
* similarity('ab', 'ac') // 0.5
|
|
2442
|
-
* similarity('doe', 'John Doe') // 0.25
|
|
2443
|
-
* similarity('abc', 'axc') // 0.6666666666666667
|
|
2444
|
-
* similarity('kitten', 'sitting') // 0.5714285714285714
|
|
2445
|
-
* ```
|
|
2446
|
-
*
|
|
2447
|
-
* @param str1 - The first string.
|
|
2448
|
-
* @param str2 - The second string.
|
|
2449
|
-
*
|
|
2450
|
-
* @returns A number between 0 and 1 representing the similarity between the two strings.
|
|
2451
|
-
*/
|
|
2452
|
-
export declare function similarity(str1: unknown, str2: unknown): number;
|
|
2453
|
-
|
|
2454
|
-
/**
|
|
2455
|
-
* Creates a Promise that resolves after a specified amount of time.
|
|
2456
|
-
*
|
|
2457
|
-
* @example
|
|
2458
|
-
* ```ts
|
|
2459
|
-
* sleep(1000).then(() => console.log('Hello, world!')); // logs 'Hello, world!' after 1 second
|
|
2460
|
-
* ```
|
|
2461
|
-
*
|
|
2462
|
-
* @param timeout - The number of milliseconds to wait before resolving the Promise.
|
|
2463
|
-
*
|
|
2464
|
-
* @returns A Promise that resolves after the specified time.
|
|
2465
|
-
*
|
|
2466
|
-
* @throws {TypeError} If timeout is not a non-negative number.
|
|
2467
|
-
*/
|
|
2468
|
-
export declare function sleep(timeout: number): Promise<void>;
|
|
2469
|
-
|
|
2470
|
-
/**
|
|
2471
|
-
* Converts a string to snake case.
|
|
2472
|
-
*
|
|
2473
|
-
* @example
|
|
2474
|
-
* ```ts
|
|
2475
|
-
* const text = 'Hello World';
|
|
2476
|
-
* toSnakeCase(text) // 'hello_world';
|
|
2477
|
-
* ```
|
|
2478
|
-
*
|
|
2479
|
-
* @param str - The string to convert.
|
|
2480
|
-
*
|
|
2481
|
-
* @returns The converted string.
|
|
2482
|
-
*/
|
|
2483
|
-
export declare function snakeCase(str: string): string;
|
|
2484
|
-
|
|
2485
|
-
/**
|
|
2486
|
-
* Checks if at least one element in the array satisfies the provided predicate function.
|
|
2487
|
-
*
|
|
2488
|
-
* @example
|
|
2489
|
-
* ```ts
|
|
2490
|
-
* some([1, 2, 3], (n) => n === 2) // true
|
|
2491
|
-
* some([1, 2, 3], (n) => n === 4) // false
|
|
2492
|
-
* ```
|
|
2493
|
-
*
|
|
2494
|
-
* @param array - The array to be checked.
|
|
2495
|
-
* @param predicate - The function to test each element of the array.
|
|
2496
|
-
*
|
|
2497
|
-
* @returns `true` if at least one element satisfies the predicate, otherwise `false`.
|
|
2498
|
-
*
|
|
2499
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
2500
|
-
*/
|
|
2501
|
-
export declare function some<T>(array: T[], predicate: Predicate<T>): boolean;
|
|
2502
|
-
|
|
2503
|
-
export declare namespace some {
|
|
2504
|
-
var fp: boolean;
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
/**
|
|
2508
|
-
* Sorts an array of objects by a specific key in ascending order.
|
|
2509
|
-
*
|
|
2510
|
-
* @example
|
|
2511
|
-
* ```ts
|
|
2512
|
-
* const data = [{ a: 2 }, { a: 3 }, { a: 1 }];
|
|
2513
|
-
* sort(data, (item) => item.a); // [{ a: 1 }, { a: 2 }, { a: 3 }]
|
|
2514
|
-
* ```
|
|
2515
|
-
*
|
|
2516
|
-
* @param array - The array of objects to sort.
|
|
2517
|
-
* @param selector - A function that extracts the key to sort by.
|
|
2518
|
-
* @param desc - A boolean indicating whether to sort in descending order (default: false).
|
|
2519
|
-
*
|
|
2520
|
-
* @returns A new array sorted by the specified key.
|
|
2521
|
-
*
|
|
2522
|
-
* @throws {TypeError} If the provided array is not an array.
|
|
2523
|
-
*/
|
|
2524
|
-
export declare const sort: {
|
|
2525
|
-
<T>(array: T[], selector: (item: T) => any, desc?: boolean): T[];
|
|
2526
|
-
fp: boolean;
|
|
2527
|
-
};
|
|
2528
|
-
|
|
2529
|
-
export declare type Sorter<T> = (a: T, b: T) => number;
|
|
2530
|
-
|
|
2531
|
-
/**
|
|
2532
|
-
* Replaces the first element in an array that satisfies the provided predicate function with a new value.
|
|
2533
|
-
*
|
|
2534
|
-
* @example
|
|
2535
|
-
* ```ts
|
|
2536
|
-
* substitute([1, 2, 3], (n) => n === 2, 4) // [1, 4, 3]
|
|
2537
|
-
* ```
|
|
2538
|
-
*
|
|
2539
|
-
* @param array - The array to search.
|
|
2540
|
-
* @param predicate - A function to test each element of the array.
|
|
2541
|
-
* @param value - The new value to replace the found element.
|
|
2542
|
-
*
|
|
2543
|
-
* @return A new array with the replaced value.
|
|
2544
|
-
*
|
|
2545
|
-
* @throws {TypeError} If the first argument is not an array.
|
|
2546
|
-
*/
|
|
2547
|
-
export declare function substitute<T>(array: T[], predicate: Predicate<T>, value: T): T[];
|
|
2548
|
-
|
|
2549
|
-
export declare namespace substitute {
|
|
2550
|
-
var fn: boolean;
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
/**
|
|
2554
|
-
* Subtracts one number from another with precision handling for financial calculations.
|
|
2555
|
-
* Supports both regular numbers and bigint for exact precision.
|
|
2556
|
-
*
|
|
2557
|
-
* @example
|
|
2558
|
-
* ```ts
|
|
2559
|
-
* subtract(20, 10); // 10
|
|
2560
|
-
* subtract(0.3, 0.1); // 0.2 (precision-safe)
|
|
2561
|
-
* subtract(300n, 100n); // 200n
|
|
2562
|
-
* ```
|
|
2563
|
-
*
|
|
2564
|
-
* @param a - Number to subtract from
|
|
2565
|
-
* @param b - Number to subtract
|
|
2566
|
-
* @returns Difference of a and b
|
|
2567
|
-
*/
|
|
2568
|
-
export declare function subtract(a: number, b: number): number;
|
|
2569
|
-
|
|
2570
|
-
export declare function subtract(a: bigint, b: bigint): bigint;
|
|
2571
|
-
|
|
2572
|
-
/**
|
|
2573
|
-
* Sum numbers in an array or numbers mapped by a callback function.
|
|
2574
|
-
*
|
|
2575
|
-
* @example
|
|
2576
|
-
* ```ts
|
|
2577
|
-
* sum([1, 2, 3]) // 6
|
|
2578
|
-
* sum([{value: 1}, {value: 2}, {value: 3}], (item) => item.value) // 6
|
|
2579
|
-
* sum(['apple', 'banana', 'cherry']) // TypeError
|
|
2580
|
-
* ```
|
|
2581
|
-
*
|
|
2582
|
-
* @param array - The array to sum.
|
|
2583
|
-
* @param callback - An optional callback function to map the values.
|
|
2584
|
-
*
|
|
2585
|
-
* @returns The sum of the numbers in the array or the sum of the mapped values.
|
|
2586
|
-
*/
|
|
2587
|
-
export declare function sum<T>(array: T[], callback?: (item: T) => number): number | undefined;
|
|
2588
|
-
|
|
2589
|
-
declare type SyncCallback<R, T> = (prev: R, curr: T, index: number, array: T[]) => R;
|
|
2590
|
-
|
|
2591
|
-
/** biome-ignore-all lint/suspicious/noExplicitAny: - */
|
|
2592
|
-
/**
|
|
2593
|
-
* Curries a function, allowing it to be called with partial arguments.
|
|
2594
|
-
*
|
|
2595
|
-
* @example
|
|
2596
|
-
* ```ts
|
|
2597
|
-
* const add = (a: number, b: number) => a + b;
|
|
2598
|
-
* const curriedAdd = curry(add);
|
|
2599
|
-
* curriedAdd(1)(2) // 3;
|
|
2600
|
-
* ```
|
|
2601
|
-
*
|
|
2602
|
-
* @param fn - The function to curry.
|
|
2603
|
-
* @param arity - The number of arguments the function expects. Defaults to the function's length.
|
|
2604
|
-
*
|
|
2605
|
-
* @returns A curried version of the function.
|
|
2606
|
-
*/
|
|
2607
|
-
declare type Take<N extends number, T extends readonly unknown[], Acc extends readonly unknown[] = []> = Acc['length'] extends N ? Acc : T extends readonly [infer H, ...infer R] ? Take<N, R, readonly [...Acc, H]> : Acc;
|
|
2608
|
-
|
|
2609
|
-
/**
|
|
2610
|
-
* Throttles a function. By default, leading and trailing are both true (lodash-like behavior).
|
|
2611
|
-
* The function is invoked at the leading edge and trailing edge of the throttle period.
|
|
2612
|
-
*
|
|
2613
|
-
* Example:
|
|
2614
|
-
* const fn = () => ...
|
|
2615
|
-
* const t = throttle(fn, 700);
|
|
2616
|
-
* const leadingOnly = throttle(fn, 700, { trailing: false });
|
|
2617
|
-
*/
|
|
2618
|
-
export declare function throttle<T extends Fn>(fn: T, delay?: number, options?: ThrottleOptions): Throttled<T>;
|
|
2619
|
-
|
|
2620
|
-
export declare type Throttled<T extends Fn> = ((this: ThisParameterType<T>, ...args: Parameters<T>) => void) & {
|
|
2621
|
-
cancel(): void;
|
|
2622
|
-
flush(): ReturnType<T> | undefined;
|
|
2623
|
-
pending(): boolean;
|
|
2624
|
-
};
|
|
2625
|
-
|
|
2626
|
-
export declare type ThrottleOptions = {
|
|
2627
|
-
leading?: boolean;
|
|
2628
|
-
trailing?: boolean;
|
|
2629
|
-
};
|
|
2630
|
-
|
|
2631
|
-
/**
|
|
2632
|
-
* Calculates the remaining time until a target date.
|
|
2633
|
-
*
|
|
2634
|
-
* @example
|
|
2635
|
-
* ```ts
|
|
2636
|
-
* timeDiff(new Date(Date.now() + 1000 * 60 * 60 * 24 * 5)); // { value: 5, unit: 'DAY' }
|
|
2637
|
-
* timeDiff(new Date(Date.now() - 1000 * 60 * 60 * 24 * 3), 'past'); // { value: 3, unit: 'DAY' }
|
|
2638
|
-
* timeDiff(new Date(Date.now() + 1000 * 60 * 60 * 24 * 31)); // { value: 1, unit: 'MONTH' }
|
|
2639
|
-
* timeDiff(new Date(Date.now() + 1000 * 60 * 60 * 24 * 365)); // { value: 1, unit: 'YEAR' }
|
|
2640
|
-
* ```
|
|
2641
|
-
*
|
|
2642
|
-
* @param a - The target date (Date object or ISO string).
|
|
2643
|
-
* @param b - The target date (Date object or ISO string).
|
|
2644
|
-
* @param allowedUnits - (optional) array of units to filter the result. If provided, only these units will be considered.
|
|
2645
|
-
*
|
|
2646
|
-
* @returns An object containing the remaining time and its unit ('DAY', 'HOUR', or 'MINUTE').
|
|
2647
|
-
*/
|
|
2648
|
-
export declare function timeDiff(a: Date | string, b?: Date | string, allowedUnits?: TimeUnit[]): TimeResult;
|
|
2649
|
-
|
|
2650
|
-
export declare namespace timeDiff {
|
|
2651
|
-
var defaultUnits: (units: TimeUnit[]) => void;
|
|
2652
|
-
}
|
|
2653
|
-
|
|
2654
|
-
export declare type TimeDirection = 'FUTURE' | 'PAST';
|
|
2655
|
-
|
|
2656
|
-
export declare type TimeResult = {
|
|
2657
|
-
unit: TimeUnit;
|
|
2658
|
-
value: number;
|
|
2659
|
-
};
|
|
2660
|
-
|
|
2661
|
-
export declare type TimeUnit = 'YEAR' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | 'MINUTE' | 'SECOND' | 'INVALID_DATE';
|
|
2662
|
-
|
|
2663
|
-
/**
|
|
2664
|
-
* Truncates a string if it is longer than the given maximum string length. The last characters of the truncated string are replaced with the ellipsis sign "…".
|
|
2665
|
-
*
|
|
2666
|
-
* @example
|
|
2667
|
-
* ```ts
|
|
2668
|
-
* const text = 'Hello World';
|
|
2669
|
-
* truncate(text, 5); // 'Hello…'
|
|
2670
|
-
* truncate(text, 3, true); // 'Hello…'
|
|
2671
|
-
* truncate(text, 5, true, '...'); // 'Hello...'
|
|
2672
|
-
* ```
|
|
2673
|
-
*
|
|
2674
|
-
* @param str - The string to truncate.
|
|
2675
|
-
* @param limit - The maximum string length.
|
|
2676
|
-
* @param completeWords - If true, the string is truncated to the nearest word, instead of character.
|
|
2677
|
-
* @param ellipsis - The characters to end the truncated string with.
|
|
2678
|
-
*
|
|
2679
|
-
* @returns The truncated string.
|
|
2680
|
-
*
|
|
2681
|
-
* @throws {TypeError} If str is not a string or limit is not a positive number.
|
|
2682
|
-
*/
|
|
2683
|
-
export declare function truncate(str: string, limit?: number, completeWords?: boolean, ellipsis?: string): string;
|
|
2684
|
-
|
|
2685
|
-
/**
|
|
2686
|
-
* Returns the type of the given argument.
|
|
2687
|
-
*
|
|
2688
|
-
* @example
|
|
2689
|
-
* ```ts
|
|
2690
|
-
* typeOf(null); // 'null'
|
|
2691
|
-
* typeOf(undefined); // 'undefined'
|
|
2692
|
-
* typeOf(NaN); // 'nan'
|
|
2693
|
-
* typeOf(async function() {}); // 'promise'
|
|
2694
|
-
* typeOf(123); // 'number'
|
|
2695
|
-
* typeOf('abc'); // 'string'
|
|
2696
|
-
* typeOf({}); // 'object'
|
|
2697
|
-
* typeOf([]); // 'array'
|
|
2698
|
-
* typeOf(() => {}); // 'function'
|
|
2699
|
-
* typeOf(new Date()); // 'date'
|
|
2700
|
-
* typeOf(new Error()); // 'error'
|
|
2701
|
-
* typeOf(new Map()); // 'map'
|
|
2702
|
-
* typeOf(new Set()); // 'set'
|
|
2703
|
-
* typeOf(new WeakMap()); // 'weakmap'
|
|
2704
|
-
* typeOf(new WeakSet()); // 'weakset'
|
|
2705
|
-
* typeOf(new RegExp('')); // 'regexp'
|
|
2706
|
-
* ```
|
|
2707
|
-
*
|
|
2708
|
-
* @param arg - The argument whose type is to be determined.
|
|
2709
|
-
*
|
|
2710
|
-
* @returns The type of the argument.
|
|
2711
|
-
*/
|
|
2712
|
-
export declare function typeOf(arg: unknown): ArgType;
|
|
2713
|
-
|
|
2714
|
-
/**
|
|
2715
|
-
* Creates a new array with duplicate values removed.
|
|
2716
|
-
*
|
|
2717
|
-
* @example
|
|
2718
|
-
* ```ts
|
|
2719
|
-
* uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]
|
|
2720
|
-
* const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];
|
|
2721
|
-
* uniq(arrObj, 'id'); // [{ id: 1 }, { id: 2 }, { id: 3 }]
|
|
2722
|
-
* uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]
|
|
2723
|
-
* ```
|
|
2724
|
-
*
|
|
2725
|
-
* @param array - The array to process.
|
|
2726
|
-
* @param [selector] - The key(s) to compare objects or a function to generate comparison values.
|
|
2727
|
-
|
|
2728
|
-
* @returns A new duplicate-free array.
|
|
2729
|
-
|
|
2730
|
-
* @throws {TypeError} - If the input is not an array or if the key is invalid.
|
|
2731
|
-
*/
|
|
2732
|
-
export declare function uniq<T>(array: T[], selector?: Selector<T>): T[];
|
|
2733
|
-
|
|
2734
|
-
export declare namespace uniq {
|
|
2735
|
-
var fp: boolean;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
/**
|
|
2739
|
-
* Generates a unique identifier.
|
|
2740
|
-
*
|
|
2741
|
-
* @example
|
|
2742
|
-
* ```ts
|
|
2743
|
-
* uuid(); // a unique identifier, e.g., '22a746d0-08be-4aff-bbc2-4deddf0914e0'
|
|
2744
|
-
* ```
|
|
2745
|
-
*
|
|
2746
|
-
* @returns A unique identifier.
|
|
2747
|
-
*/
|
|
2748
|
-
export declare function uuid(): string;
|
|
2749
|
-
|
|
2750
|
-
/**
|
|
2751
|
-
* Returns an array of values for an object's properties
|
|
2752
|
-
*
|
|
2753
|
-
* @example
|
|
2754
|
-
* ```ts
|
|
2755
|
-
* const obj = { a: 1, b: 2, c: 3 };
|
|
2756
|
-
* toValues(obj); // [1, 2, 3]
|
|
2757
|
-
* ```
|
|
2758
|
-
*
|
|
2759
|
-
* @param item - The object whose property values are to be returned.
|
|
2760
|
-
*
|
|
2761
|
-
* @returns an array of the object's own enumerable string-keyed property values.
|
|
2762
|
-
*/
|
|
2763
|
-
export declare function values<T extends Obj, K extends keyof T>(item: T): T[K][];
|
|
2764
|
-
|
|
2765
|
-
/**
|
|
2766
|
-
* Waits for a condition to become true by polling.
|
|
2767
|
-
* Useful for waiting for DOM elements, API states, or other conditions.
|
|
2768
|
-
*
|
|
2769
|
-
* @example
|
|
2770
|
-
* ```ts
|
|
2771
|
-
* // Wait for an element to appear
|
|
2772
|
-
* await waitFor(() => document.querySelector('#myElement') !== null);
|
|
2773
|
-
*
|
|
2774
|
-
* // Wait for API to be ready
|
|
2775
|
-
* await waitFor(
|
|
2776
|
-
* async () => {
|
|
2777
|
-
* const res = await fetch('/api/health');
|
|
2778
|
-
* return res.ok;
|
|
2779
|
-
* },
|
|
2780
|
-
* { timeout: 30000, interval: 1000 }
|
|
2781
|
-
* );
|
|
2782
|
-
* ```
|
|
2783
|
-
*
|
|
2784
|
-
* @param condition - Function that returns true when condition is met
|
|
2785
|
-
* @param options - Configuration options
|
|
2786
|
-
* @param options.timeout - Maximum time to wait in ms (default: 5000)
|
|
2787
|
-
* @param options.interval - Polling interval in ms (default: 100)
|
|
2788
|
-
* @param options.signal - AbortSignal to cancel waiting
|
|
2789
|
-
* @returns Promise that resolves when condition becomes true
|
|
2790
|
-
* @throws {Error} If timeout is reached
|
|
2791
|
-
* @throws {DOMException} If aborted via signal
|
|
2792
|
-
*/
|
|
2793
|
-
export declare function waitFor(condition: () => boolean | Promise<boolean>, options?: {
|
|
2794
|
-
timeout?: number;
|
|
2795
|
-
interval?: number;
|
|
2796
|
-
signal?: AbortSignal;
|
|
2797
|
-
}): Promise<void>;
|
|
2798
|
-
|
|
2799
|
-
/**
|
|
2800
|
-
* Creates a function that runs the provided callback in a web worker with specified dependencies.
|
|
2801
|
-
*
|
|
2802
|
-
* @example
|
|
2803
|
-
* const sum = worker(({ _ }) => (...args) => _.sum([...args]), ['https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js']);
|
|
2804
|
-
* await sum(1, 2); // 3
|
|
2805
|
-
*
|
|
2806
|
-
* @param callback - A function that receives the worker's `self` and performs work.
|
|
2807
|
-
* @param dependencies - (optional) array of URLs to scripts that the worker should import.
|
|
2808
|
-
*
|
|
2809
|
-
* @returns A function that takes the arguments for the callback and returns a promise with the result.
|
|
2810
|
-
*/
|
|
2811
|
-
export declare function worker<T extends (...args: any) => any, R = Awaited<ReturnType<T>>>(callback: (self: any) => T, dependencies?: string[]): (...args: Parameters<T>) => Promise<R>;
|
|
2812
|
-
|
|
2813
|
-
export { }
|
|
1
|
+
export * from './array/chunk';
|
|
2
|
+
export * from './array/contains';
|
|
3
|
+
export * from './array/fold';
|
|
4
|
+
export * from './array/group';
|
|
5
|
+
export * from './array/keyBy';
|
|
6
|
+
export * from './array/list';
|
|
7
|
+
export * from './array/pick';
|
|
8
|
+
export * from './array/remoteList';
|
|
9
|
+
export * from './array/replace';
|
|
10
|
+
export * from './array/rotate';
|
|
11
|
+
export * from './array/search';
|
|
12
|
+
export * from './array/select';
|
|
13
|
+
export * from './array/sort';
|
|
14
|
+
export * from './array/toggle';
|
|
15
|
+
export * from './array/uniq';
|
|
16
|
+
export * from './async/attempt';
|
|
17
|
+
export * from './async/defer';
|
|
18
|
+
export * from './async/parallel';
|
|
19
|
+
export * from './async/scheduler';
|
|
20
|
+
export * from './async/pool';
|
|
21
|
+
export * from './async/queue';
|
|
22
|
+
export * from './async/race';
|
|
23
|
+
export * from './async/retry';
|
|
24
|
+
export * from './async/sleep';
|
|
25
|
+
export * from './async/waitFor';
|
|
26
|
+
export * from './date/expires';
|
|
27
|
+
export * from './date/interval';
|
|
28
|
+
export * from './date/timeDiff';
|
|
29
|
+
export * from './function/assert';
|
|
30
|
+
export * from './function/assertParams';
|
|
31
|
+
export * from './function/compare';
|
|
32
|
+
export * from './function/compareBy';
|
|
33
|
+
export * from './function/compose';
|
|
34
|
+
export * from './function/curry';
|
|
35
|
+
export * from './function/debounce';
|
|
36
|
+
export * from './function/fp';
|
|
37
|
+
export * from './function/memo';
|
|
38
|
+
export * from './function/once';
|
|
39
|
+
export * from './function/pipe';
|
|
40
|
+
export * from './function/throttle';
|
|
41
|
+
export * from './math/abs';
|
|
42
|
+
export * from './math/allocate';
|
|
43
|
+
export * from './math/average';
|
|
44
|
+
export * from './math/clamp';
|
|
45
|
+
export * from './math/distribute';
|
|
46
|
+
export * from './math/linspace';
|
|
47
|
+
export * from './math/max';
|
|
48
|
+
export * from './math/median';
|
|
49
|
+
export * from './math/min';
|
|
50
|
+
export * from './math/percent';
|
|
51
|
+
export * from './math/range';
|
|
52
|
+
export * from './math/round';
|
|
53
|
+
export * from './math/sum';
|
|
54
|
+
export * from './money/currency';
|
|
55
|
+
export * from './money/exchange';
|
|
56
|
+
export * from './money/types';
|
|
57
|
+
export * from './object/stash';
|
|
58
|
+
export * from './object/diff';
|
|
59
|
+
export * from './object/merge';
|
|
60
|
+
export * from './object/parseJSON';
|
|
61
|
+
export * from './object/path';
|
|
62
|
+
export * from './object/proxy';
|
|
63
|
+
export * from './object/prune';
|
|
64
|
+
export * from './object/seek';
|
|
65
|
+
export * from './random/draw';
|
|
66
|
+
export * from './random/random';
|
|
67
|
+
export * from './random/shuffle';
|
|
68
|
+
export * from './random/uuid';
|
|
69
|
+
export * from './string/camelCase';
|
|
70
|
+
export * from './string/kebabCase';
|
|
71
|
+
export * from './string/pascalCase';
|
|
72
|
+
export * from './string/similarity';
|
|
73
|
+
export * from './string/snakeCase';
|
|
74
|
+
export * from './string/truncate';
|
|
75
|
+
export * from './typed/is';
|
|
76
|
+
export * from './types';
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|