litus 1.4.0 → 1.6.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 +11 -8
- package/dist/index.cjs.js +1460 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +778 -0
- package/dist/index.esm.js +1380 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +9 -6
- package/dist/cjs/arr/chunk.d.ts +0 -1
- package/dist/cjs/arr/chunk.js +0 -12
- package/dist/cjs/arr/chunk.js.map +0 -1
- package/dist/cjs/arr/fill.d.ts +0 -1
- package/dist/cjs/arr/fill.js +0 -9
- package/dist/cjs/arr/fill.js.map +0 -1
- package/dist/cjs/arr/find.d.ts +0 -2
- package/dist/cjs/arr/find.js +0 -9
- package/dist/cjs/arr/find.js.map +0 -1
- package/dist/cjs/arr/findAll.d.ts +0 -2
- package/dist/cjs/arr/findAll.js +0 -9
- package/dist/cjs/arr/findAll.js.map +0 -1
- package/dist/cjs/arr/findAllIdx.d.ts +0 -2
- package/dist/cjs/arr/findAllIdx.js +0 -17
- package/dist/cjs/arr/findAllIdx.js.map +0 -1
- package/dist/cjs/arr/findIdx.d.ts +0 -2
- package/dist/cjs/arr/findIdx.js +0 -13
- package/dist/cjs/arr/findIdx.js.map +0 -1
- package/dist/cjs/arr/from.d.ts +0 -1
- package/dist/cjs/arr/from.js +0 -13
- package/dist/cjs/arr/from.js.map +0 -1
- package/dist/cjs/arr/group.d.ts +0 -1
- package/dist/cjs/arr/group.js +0 -16
- package/dist/cjs/arr/group.js.map +0 -1
- package/dist/cjs/arr/groupBy.d.ts +0 -1
- package/dist/cjs/arr/groupBy.js +0 -9
- package/dist/cjs/arr/groupBy.js.map +0 -1
- package/dist/cjs/arr/index.d.ts +0 -17
- package/dist/cjs/arr/index.js +0 -34
- package/dist/cjs/arr/index.js.map +0 -1
- package/dist/cjs/arr/max.d.ts +0 -1
- package/dist/cjs/arr/max.js +0 -15
- package/dist/cjs/arr/max.js.map +0 -1
- package/dist/cjs/arr/min.d.ts +0 -1
- package/dist/cjs/arr/min.js +0 -9
- package/dist/cjs/arr/min.js.map +0 -1
- package/dist/cjs/arr/range.d.ts +0 -1
- package/dist/cjs/arr/range.js +0 -13
- package/dist/cjs/arr/range.js.map +0 -1
- package/dist/cjs/arr/sort.d.ts +0 -1
- package/dist/cjs/arr/sort.js +0 -21
- package/dist/cjs/arr/sort.js.map +0 -1
- package/dist/cjs/arr/transpose.d.ts +0 -2
- package/dist/cjs/arr/transpose.js +0 -15
- package/dist/cjs/arr/transpose.js.map +0 -1
- package/dist/cjs/arr/types.d.ts +0 -11
- package/dist/cjs/arr/types.js +0 -3
- package/dist/cjs/arr/types.js.map +0 -1
- package/dist/cjs/arr/union.d.ts +0 -1
- package/dist/cjs/arr/union.js +0 -8
- package/dist/cjs/arr/union.js.map +0 -1
- package/dist/cjs/arr/unique.d.ts +0 -2
- package/dist/cjs/arr/unique.js +0 -10
- package/dist/cjs/arr/unique.js.map +0 -1
- package/dist/cjs/arr/zip.d.ts +0 -1
- package/dist/cjs/arr/zip.js +0 -7
- package/dist/cjs/arr/zip.js.map +0 -1
- package/dist/cjs/func/apply.d.ts +0 -1
- package/dist/cjs/func/apply.js +0 -8
- package/dist/cjs/func/apply.js.map +0 -1
- package/dist/cjs/func/curry.d.ts +0 -2
- package/dist/cjs/func/curry.js +0 -17
- package/dist/cjs/func/curry.js.map +0 -1
- package/dist/cjs/func/debounce.d.ts +0 -1
- package/dist/cjs/func/debounce.js +0 -15
- package/dist/cjs/func/debounce.js.map +0 -1
- package/dist/cjs/func/index.d.ts +0 -6
- package/dist/cjs/func/index.js +0 -23
- package/dist/cjs/func/index.js.map +0 -1
- package/dist/cjs/func/memo.d.ts +0 -2
- package/dist/cjs/func/memo.js +0 -22
- package/dist/cjs/func/memo.js.map +0 -1
- package/dist/cjs/func/throttle.d.ts +0 -1
- package/dist/cjs/func/throttle.js +0 -19
- package/dist/cjs/func/throttle.js.map +0 -1
- package/dist/cjs/func/types.d.ts +0 -8
- package/dist/cjs/func/types.js +0 -3
- package/dist/cjs/func/types.js.map +0 -1
- package/dist/cjs/func/unapply.d.ts +0 -1
- package/dist/cjs/func/unapply.js +0 -8
- package/dist/cjs/func/unapply.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -15
- package/dist/cjs/index.js +0 -45
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/math/add.d.ts +0 -1
- package/dist/cjs/math/add.js +0 -8
- package/dist/cjs/math/add.js.map +0 -1
- package/dist/cjs/math/aprox.d.ts +0 -1
- package/dist/cjs/math/aprox.js +0 -9
- package/dist/cjs/math/aprox.js.map +0 -1
- package/dist/cjs/math/calc.d.ts +0 -3
- package/dist/cjs/math/calc.js +0 -23
- package/dist/cjs/math/calc.js.map +0 -1
- package/dist/cjs/math/cumsum.d.ts +0 -1
- package/dist/cjs/math/cumsum.js +0 -13
- package/dist/cjs/math/cumsum.js.map +0 -1
- package/dist/cjs/math/divide.d.ts +0 -1
- package/dist/cjs/math/divide.js +0 -6
- package/dist/cjs/math/divide.js.map +0 -1
- package/dist/cjs/math/inRange.d.ts +0 -1
- package/dist/cjs/math/inRange.js +0 -11
- package/dist/cjs/math/inRange.js.map +0 -1
- package/dist/cjs/math/index.d.ts +0 -16
- package/dist/cjs/math/index.js +0 -33
- package/dist/cjs/math/index.js.map +0 -1
- package/dist/cjs/math/interp.d.ts +0 -1
- package/dist/cjs/math/interp.js +0 -22
- package/dist/cjs/math/interp.js.map +0 -1
- package/dist/cjs/math/mean.d.ts +0 -1
- package/dist/cjs/math/mean.js +0 -16
- package/dist/cjs/math/mean.js.map +0 -1
- package/dist/cjs/math/median.d.ts +0 -1
- package/dist/cjs/math/median.js +0 -9
- package/dist/cjs/math/median.js.map +0 -1
- package/dist/cjs/math/mod.d.ts +0 -1
- package/dist/cjs/math/mod.js +0 -9
- package/dist/cjs/math/mod.js.map +0 -1
- package/dist/cjs/math/multiply.d.ts +0 -1
- package/dist/cjs/math/multiply.js +0 -7
- package/dist/cjs/math/multiply.js.map +0 -1
- package/dist/cjs/math/percentile.d.ts +0 -2
- package/dist/cjs/math/percentile.js +0 -49
- package/dist/cjs/math/percentile.js.map +0 -1
- package/dist/cjs/math/pow.d.ts +0 -1
- package/dist/cjs/math/pow.js +0 -6
- package/dist/cjs/math/pow.js.map +0 -1
- package/dist/cjs/math/round.d.ts +0 -2
- package/dist/cjs/math/round.js +0 -15
- package/dist/cjs/math/round.js.map +0 -1
- package/dist/cjs/math/subtract.d.ts +0 -1
- package/dist/cjs/math/subtract.js +0 -6
- package/dist/cjs/math/subtract.js.map +0 -1
- package/dist/cjs/math/sum.d.ts +0 -1
- package/dist/cjs/math/sum.js +0 -8
- package/dist/cjs/math/sum.js.map +0 -1
- package/dist/cjs/math/types.d.ts +0 -4
- package/dist/cjs/math/types.js +0 -3
- package/dist/cjs/math/types.js.map +0 -1
- package/dist/cjs/obj/copy.d.ts +0 -1
- package/dist/cjs/obj/copy.js +0 -16
- package/dist/cjs/obj/copy.js.map +0 -1
- package/dist/cjs/obj/entries.d.ts +0 -2
- package/dist/cjs/obj/entries.js +0 -5
- package/dist/cjs/obj/entries.js.map +0 -1
- package/dist/cjs/obj/equal.d.ts +0 -1
- package/dist/cjs/obj/equal.js +0 -30
- package/dist/cjs/obj/equal.js.map +0 -1
- package/dist/cjs/obj/get.d.ts +0 -1
- package/dist/cjs/obj/get.js +0 -19
- package/dist/cjs/obj/get.js.map +0 -1
- package/dist/cjs/obj/has.d.ts +0 -1
- package/dist/cjs/obj/has.js +0 -8
- package/dist/cjs/obj/has.js.map +0 -1
- package/dist/cjs/obj/index.d.ts +0 -11
- package/dist/cjs/obj/index.js +0 -28
- package/dist/cjs/obj/index.js.map +0 -1
- package/dist/cjs/obj/isObj.d.ts +0 -1
- package/dist/cjs/obj/isObj.js +0 -8
- package/dist/cjs/obj/isObj.js.map +0 -1
- package/dist/cjs/obj/keys.d.ts +0 -2
- package/dist/cjs/obj/keys.js +0 -5
- package/dist/cjs/obj/keys.js.map +0 -1
- package/dist/cjs/obj/merge.d.ts +0 -1
- package/dist/cjs/obj/merge.js +0 -9
- package/dist/cjs/obj/merge.js.map +0 -1
- package/dist/cjs/obj/omit.d.ts +0 -1
- package/dist/cjs/obj/omit.js +0 -13
- package/dist/cjs/obj/omit.js.map +0 -1
- package/dist/cjs/obj/pick.d.ts +0 -1
- package/dist/cjs/obj/pick.js +0 -13
- package/dist/cjs/obj/pick.js.map +0 -1
- package/dist/cjs/obj/types.d.ts +0 -4
- package/dist/cjs/obj/types.js +0 -3
- package/dist/cjs/obj/types.js.map +0 -1
- package/dist/cjs/obj/vals.d.ts +0 -2
- package/dist/cjs/obj/vals.js +0 -5
- package/dist/cjs/obj/vals.js.map +0 -1
- package/dist/cjs/str/_words.d.ts +0 -1
- package/dist/cjs/str/_words.js +0 -13
- package/dist/cjs/str/_words.js.map +0 -1
- package/dist/cjs/str/camel.d.ts +0 -1
- package/dist/cjs/str/camel.js +0 -15
- package/dist/cjs/str/camel.js.map +0 -1
- package/dist/cjs/str/capitalize.d.ts +0 -1
- package/dist/cjs/str/capitalize.js +0 -8
- package/dist/cjs/str/capitalize.js.map +0 -1
- package/dist/cjs/str/index.d.ts +0 -7
- package/dist/cjs/str/index.js +0 -24
- package/dist/cjs/str/index.js.map +0 -1
- package/dist/cjs/str/kebab.d.ts +0 -1
- package/dist/cjs/str/kebab.js +0 -11
- package/dist/cjs/str/kebab.js.map +0 -1
- package/dist/cjs/str/pascal.d.ts +0 -1
- package/dist/cjs/str/pascal.js +0 -10
- package/dist/cjs/str/pascal.js.map +0 -1
- package/dist/cjs/str/snake.d.ts +0 -1
- package/dist/cjs/str/snake.js +0 -11
- package/dist/cjs/str/snake.js.map +0 -1
- package/dist/cjs/str/template.d.ts +0 -1
- package/dist/cjs/str/template.js +0 -11
- package/dist/cjs/str/template.js.map +0 -1
- package/dist/cjs/str/trim.d.ts +0 -1
- package/dist/cjs/str/trim.js +0 -9
- package/dist/cjs/str/trim.js.map +0 -1
- package/dist/cjs/time/index.d.ts +0 -16
- package/dist/cjs/time/index.js +0 -59
- package/dist/cjs/time/index.js.map +0 -1
- package/dist/cjs/time/types.d.ts +0 -4
- package/dist/cjs/time/types.js +0 -3
- package/dist/cjs/time/types.js.map +0 -1
- package/dist/cjs/types/index.d.ts +0 -1
- package/dist/cjs/types/index.js +0 -18
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/primitives.d.ts +0 -4
- package/dist/cjs/types/primitives.js +0 -3
- package/dist/cjs/types/primitives.js.map +0 -1
- package/dist/esm/arr/chunk.d.ts +0 -1
- package/dist/esm/arr/chunk.js +0 -8
- package/dist/esm/arr/chunk.js.map +0 -1
- package/dist/esm/arr/fill.d.ts +0 -1
- package/dist/esm/arr/fill.js +0 -5
- package/dist/esm/arr/fill.js.map +0 -1
- package/dist/esm/arr/find.d.ts +0 -2
- package/dist/esm/arr/find.js +0 -5
- package/dist/esm/arr/find.js.map +0 -1
- package/dist/esm/arr/findAll.d.ts +0 -2
- package/dist/esm/arr/findAll.js +0 -5
- package/dist/esm/arr/findAll.js.map +0 -1
- package/dist/esm/arr/findAllIdx.d.ts +0 -2
- package/dist/esm/arr/findAllIdx.js +0 -13
- package/dist/esm/arr/findAllIdx.js.map +0 -1
- package/dist/esm/arr/findIdx.d.ts +0 -2
- package/dist/esm/arr/findIdx.js +0 -9
- package/dist/esm/arr/findIdx.js.map +0 -1
- package/dist/esm/arr/from.d.ts +0 -1
- package/dist/esm/arr/from.js +0 -9
- package/dist/esm/arr/from.js.map +0 -1
- package/dist/esm/arr/group.d.ts +0 -1
- package/dist/esm/arr/group.js +0 -12
- package/dist/esm/arr/group.js.map +0 -1
- package/dist/esm/arr/groupBy.d.ts +0 -1
- package/dist/esm/arr/groupBy.js +0 -5
- package/dist/esm/arr/groupBy.js.map +0 -1
- package/dist/esm/arr/index.d.ts +0 -17
- package/dist/esm/arr/index.js +0 -18
- package/dist/esm/arr/index.js.map +0 -1
- package/dist/esm/arr/max.d.ts +0 -1
- package/dist/esm/arr/max.js +0 -11
- package/dist/esm/arr/max.js.map +0 -1
- package/dist/esm/arr/min.d.ts +0 -1
- package/dist/esm/arr/min.js +0 -5
- package/dist/esm/arr/min.js.map +0 -1
- package/dist/esm/arr/range.d.ts +0 -1
- package/dist/esm/arr/range.js +0 -9
- package/dist/esm/arr/range.js.map +0 -1
- package/dist/esm/arr/sort.d.ts +0 -1
- package/dist/esm/arr/sort.js +0 -17
- package/dist/esm/arr/sort.js.map +0 -1
- package/dist/esm/arr/transpose.d.ts +0 -2
- package/dist/esm/arr/transpose.js +0 -11
- package/dist/esm/arr/transpose.js.map +0 -1
- package/dist/esm/arr/types.d.ts +0 -11
- package/dist/esm/arr/types.js +0 -2
- package/dist/esm/arr/types.js.map +0 -1
- package/dist/esm/arr/union.d.ts +0 -1
- package/dist/esm/arr/union.js +0 -5
- package/dist/esm/arr/union.js.map +0 -1
- package/dist/esm/arr/unique.d.ts +0 -2
- package/dist/esm/arr/unique.js +0 -6
- package/dist/esm/arr/unique.js.map +0 -1
- package/dist/esm/arr/zip.d.ts +0 -1
- package/dist/esm/arr/zip.js +0 -4
- package/dist/esm/arr/zip.js.map +0 -1
- package/dist/esm/func/apply.d.ts +0 -1
- package/dist/esm/func/apply.js +0 -4
- package/dist/esm/func/apply.js.map +0 -1
- package/dist/esm/func/curry.d.ts +0 -2
- package/dist/esm/func/curry.js +0 -13
- package/dist/esm/func/curry.js.map +0 -1
- package/dist/esm/func/debounce.d.ts +0 -1
- package/dist/esm/func/debounce.js +0 -11
- package/dist/esm/func/debounce.js.map +0 -1
- package/dist/esm/func/index.d.ts +0 -6
- package/dist/esm/func/index.js +0 -7
- package/dist/esm/func/index.js.map +0 -1
- package/dist/esm/func/memo.d.ts +0 -2
- package/dist/esm/func/memo.js +0 -18
- package/dist/esm/func/memo.js.map +0 -1
- package/dist/esm/func/throttle.d.ts +0 -1
- package/dist/esm/func/throttle.js +0 -15
- package/dist/esm/func/throttle.js.map +0 -1
- package/dist/esm/func/types.d.ts +0 -8
- package/dist/esm/func/types.js +0 -2
- package/dist/esm/func/types.js.map +0 -1
- package/dist/esm/func/unapply.d.ts +0 -1
- package/dist/esm/func/unapply.js +0 -4
- package/dist/esm/func/unapply.js.map +0 -1
- package/dist/esm/index.d.ts +0 -15
- package/dist/esm/index.js +0 -16
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/math/add.d.ts +0 -1
- package/dist/esm/math/add.js +0 -5
- package/dist/esm/math/add.js.map +0 -1
- package/dist/esm/math/aprox.d.ts +0 -1
- package/dist/esm/math/aprox.js +0 -5
- package/dist/esm/math/aprox.js.map +0 -1
- package/dist/esm/math/calc.d.ts +0 -3
- package/dist/esm/math/calc.js +0 -19
- package/dist/esm/math/calc.js.map +0 -1
- package/dist/esm/math/cumsum.d.ts +0 -1
- package/dist/esm/math/cumsum.js +0 -9
- package/dist/esm/math/cumsum.js.map +0 -1
- package/dist/esm/math/divide.d.ts +0 -1
- package/dist/esm/math/divide.js +0 -3
- package/dist/esm/math/divide.js.map +0 -1
- package/dist/esm/math/inRange.d.ts +0 -1
- package/dist/esm/math/inRange.js +0 -7
- package/dist/esm/math/inRange.js.map +0 -1
- package/dist/esm/math/index.d.ts +0 -16
- package/dist/esm/math/index.js +0 -17
- package/dist/esm/math/index.js.map +0 -1
- package/dist/esm/math/interp.d.ts +0 -1
- package/dist/esm/math/interp.js +0 -18
- package/dist/esm/math/interp.js.map +0 -1
- package/dist/esm/math/mean.d.ts +0 -1
- package/dist/esm/math/mean.js +0 -12
- package/dist/esm/math/mean.js.map +0 -1
- package/dist/esm/math/median.d.ts +0 -1
- package/dist/esm/math/median.js +0 -5
- package/dist/esm/math/median.js.map +0 -1
- package/dist/esm/math/mod.d.ts +0 -1
- package/dist/esm/math/mod.js +0 -6
- package/dist/esm/math/mod.js.map +0 -1
- package/dist/esm/math/multiply.d.ts +0 -1
- package/dist/esm/math/multiply.js +0 -4
- package/dist/esm/math/multiply.js.map +0 -1
- package/dist/esm/math/percentile.d.ts +0 -2
- package/dist/esm/math/percentile.js +0 -45
- package/dist/esm/math/percentile.js.map +0 -1
- package/dist/esm/math/pow.d.ts +0 -1
- package/dist/esm/math/pow.js +0 -3
- package/dist/esm/math/pow.js.map +0 -1
- package/dist/esm/math/round.d.ts +0 -2
- package/dist/esm/math/round.js +0 -11
- package/dist/esm/math/round.js.map +0 -1
- package/dist/esm/math/subtract.d.ts +0 -1
- package/dist/esm/math/subtract.js +0 -3
- package/dist/esm/math/subtract.js.map +0 -1
- package/dist/esm/math/sum.d.ts +0 -1
- package/dist/esm/math/sum.js +0 -4
- package/dist/esm/math/sum.js.map +0 -1
- package/dist/esm/math/types.d.ts +0 -4
- package/dist/esm/math/types.js +0 -2
- package/dist/esm/math/types.js.map +0 -1
- package/dist/esm/obj/copy.d.ts +0 -1
- package/dist/esm/obj/copy.js +0 -12
- package/dist/esm/obj/copy.js.map +0 -1
- package/dist/esm/obj/entries.d.ts +0 -2
- package/dist/esm/obj/entries.js +0 -2
- package/dist/esm/obj/entries.js.map +0 -1
- package/dist/esm/obj/equal.d.ts +0 -1
- package/dist/esm/obj/equal.js +0 -27
- package/dist/esm/obj/equal.js.map +0 -1
- package/dist/esm/obj/get.d.ts +0 -1
- package/dist/esm/obj/get.js +0 -15
- package/dist/esm/obj/get.js.map +0 -1
- package/dist/esm/obj/has.d.ts +0 -1
- package/dist/esm/obj/has.js +0 -4
- package/dist/esm/obj/has.js.map +0 -1
- package/dist/esm/obj/index.d.ts +0 -11
- package/dist/esm/obj/index.js +0 -12
- package/dist/esm/obj/index.js.map +0 -1
- package/dist/esm/obj/isObj.d.ts +0 -1
- package/dist/esm/obj/isObj.js +0 -4
- package/dist/esm/obj/isObj.js.map +0 -1
- package/dist/esm/obj/keys.d.ts +0 -2
- package/dist/esm/obj/keys.js +0 -2
- package/dist/esm/obj/keys.js.map +0 -1
- package/dist/esm/obj/merge.d.ts +0 -1
- package/dist/esm/obj/merge.js +0 -5
- package/dist/esm/obj/merge.js.map +0 -1
- package/dist/esm/obj/omit.d.ts +0 -1
- package/dist/esm/obj/omit.js +0 -9
- package/dist/esm/obj/omit.js.map +0 -1
- package/dist/esm/obj/pick.d.ts +0 -1
- package/dist/esm/obj/pick.js +0 -9
- package/dist/esm/obj/pick.js.map +0 -1
- package/dist/esm/obj/types.d.ts +0 -4
- package/dist/esm/obj/types.js +0 -2
- package/dist/esm/obj/types.js.map +0 -1
- package/dist/esm/obj/vals.d.ts +0 -2
- package/dist/esm/obj/vals.js +0 -2
- package/dist/esm/obj/vals.js.map +0 -1
- package/dist/esm/str/_words.d.ts +0 -1
- package/dist/esm/str/_words.js +0 -9
- package/dist/esm/str/_words.js.map +0 -1
- package/dist/esm/str/camel.d.ts +0 -1
- package/dist/esm/str/camel.js +0 -11
- package/dist/esm/str/camel.js.map +0 -1
- package/dist/esm/str/capitalize.d.ts +0 -1
- package/dist/esm/str/capitalize.js +0 -4
- package/dist/esm/str/capitalize.js.map +0 -1
- package/dist/esm/str/index.d.ts +0 -7
- package/dist/esm/str/index.js +0 -8
- package/dist/esm/str/index.js.map +0 -1
- package/dist/esm/str/kebab.d.ts +0 -1
- package/dist/esm/str/kebab.js +0 -7
- package/dist/esm/str/kebab.js.map +0 -1
- package/dist/esm/str/pascal.d.ts +0 -1
- package/dist/esm/str/pascal.js +0 -6
- package/dist/esm/str/pascal.js.map +0 -1
- package/dist/esm/str/snake.d.ts +0 -1
- package/dist/esm/str/snake.js +0 -7
- package/dist/esm/str/snake.js.map +0 -1
- package/dist/esm/str/template.d.ts +0 -1
- package/dist/esm/str/template.js +0 -7
- package/dist/esm/str/template.js.map +0 -1
- package/dist/esm/str/trim.d.ts +0 -1
- package/dist/esm/str/trim.js +0 -5
- package/dist/esm/str/trim.js.map +0 -1
- package/dist/esm/time/index.d.ts +0 -16
- package/dist/esm/time/index.js +0 -55
- package/dist/esm/time/index.js.map +0 -1
- package/dist/esm/time/types.d.ts +0 -4
- package/dist/esm/time/types.js +0 -2
- package/dist/esm/time/types.js.map +0 -1
- package/dist/esm/types/index.d.ts +0 -1
- package/dist/esm/types/index.js +0 -2
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/primitives.d.ts +0 -4
- package/dist/esm/types/primitives.js +0 -2
- package/dist/esm/types/primitives.js.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary search for insertion index in a sorted array using a custom accessor
|
|
3
|
+
* @param arr Sorted array to search
|
|
4
|
+
* @param target Value to search for
|
|
5
|
+
* @param getVal Function to extract comparison value from each element
|
|
6
|
+
* @param start Start index (inclusive)
|
|
7
|
+
* @param end End index (exclusive)
|
|
8
|
+
* @returns Index to insert target to maintain order
|
|
9
|
+
*/
|
|
10
|
+
declare const binSearch: <T>(arr: T[], target: number, getVal: (el: T) => number, start?: number, end?: number) => number;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Splits an array into multiple chunks of a specified size
|
|
14
|
+
* @param arr Array to split
|
|
15
|
+
* @param size Size of each chunk
|
|
16
|
+
* @returns Array of chunks
|
|
17
|
+
*/
|
|
18
|
+
declare const chunk: <T>(arr: T[], size: number) => T[][];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Counts occurrences of items in an array, grouped by key
|
|
22
|
+
* @param arr Array to count occurrences
|
|
23
|
+
* @param getKey Function to extract group ids
|
|
24
|
+
* @returns Object mapping each key to its count
|
|
25
|
+
*/
|
|
26
|
+
declare const countBy: <T, K extends PropertyKey>(arr: T[], getKey: (obj: T) => K) => Record<K, number>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Creates array of size `n` filled with the specified value
|
|
30
|
+
* @param n Array size
|
|
31
|
+
* @param val Value to fill the array with
|
|
32
|
+
* @returns Array containing `val` repeated `n` times
|
|
33
|
+
*/
|
|
34
|
+
declare const fill: <T>(n: number, val: T) => T[];
|
|
35
|
+
|
|
36
|
+
type Predicate<T, R = boolean> = (val: T, idx: number, arr: T[]) => R;
|
|
37
|
+
type Tuple<T, N extends number, R extends T[] = []> = R["length"] extends N ? R : Tuple<T, N, [...R, T]>;
|
|
38
|
+
type ConvertTuple<T extends unknown[], ToType> = {
|
|
39
|
+
[K in keyof T]: ToType;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Finds the first element that matches the given predicate
|
|
44
|
+
* @param arr Array to search in
|
|
45
|
+
* @param predicate Function to test each element
|
|
46
|
+
* @param from Start index (inclusive). Default: 0
|
|
47
|
+
* @param to End index (exclusive). Default: arr.length
|
|
48
|
+
* @returns First matching element, or undefined if none found
|
|
49
|
+
*/
|
|
50
|
+
declare const find: <T>(arr: T[], predicate: Predicate<T, boolean>, from?: number, to?: number) => T | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Finds the index of the first element that matches the given predicate
|
|
54
|
+
* @param arr Array to search in
|
|
55
|
+
* @param predicate Function to test each element
|
|
56
|
+
* @param from Start index (inclusive). Default: 0
|
|
57
|
+
* @param to End index (exclusive). Default: arr.length
|
|
58
|
+
* @returns Index of the first matching element, or -1 if none found
|
|
59
|
+
*/
|
|
60
|
+
declare const findIdx: <T>(arr: T[], predicate: Predicate<T, boolean>, from?: number, to?: number) => number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Finds all elements that match the given predicate
|
|
64
|
+
* @param arr Array to search in
|
|
65
|
+
* @param predicate Function to test each element
|
|
66
|
+
* @param from Start index (inclusive). Default: 0
|
|
67
|
+
* @param to End index (exclusive). Default: arr.length
|
|
68
|
+
* @param limit Maximum number of matches to return. Default: arr.length
|
|
69
|
+
* @returns Array of matching elements
|
|
70
|
+
*/
|
|
71
|
+
declare const findAll: <T>(arr: T[], predicate: Predicate<T, boolean>, from?: number, to?: number, limit?: number) => T[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Finds indices of all elements that match the given predicate
|
|
75
|
+
* @param arr Array to search in
|
|
76
|
+
* @param predicate Function to test each element
|
|
77
|
+
* @param from Start index (inclusive). Default: 0
|
|
78
|
+
* @param to End index (exclusive). Default: arr.length
|
|
79
|
+
* @param limit Maximum number of indices to return. Default: arr.length
|
|
80
|
+
* @returns Array of matching indices
|
|
81
|
+
*/
|
|
82
|
+
declare const findAllIdx: <T>(arr: T[], predicate: Predicate<T, boolean>, from?: number, to?: number, limit?: number) => number[];
|
|
83
|
+
|
|
84
|
+
type First<A extends readonly [] | readonly unknown[]> = A extends readonly [infer F, ...unknown[]] ? F : A extends readonly [] ? undefined : A extends readonly [...infer F, infer L, unknown] ? First<[...F, L]> : A[number];
|
|
85
|
+
/**
|
|
86
|
+
* Gets the first element of an array
|
|
87
|
+
* @param arr The array
|
|
88
|
+
* @returns The first element
|
|
89
|
+
*/
|
|
90
|
+
declare const first: <A extends readonly [] | readonly unknown[]>(arr: A) => First<A>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Creates an array of size `n`, filling each element using the map function
|
|
94
|
+
* @param n Size of the array to create
|
|
95
|
+
* @param mapFn Function that maps each index to an array element
|
|
96
|
+
* @returns Array of mapped values
|
|
97
|
+
*/
|
|
98
|
+
declare const from: <T>(n: number, mapFn: (i: number) => T) => T[];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Groups array items into an object by a key
|
|
102
|
+
* @param arr Array to group
|
|
103
|
+
* @param getKey Function to extract the group key from each item
|
|
104
|
+
* @returns Object with keys as group ids and values as arrays of grouped items
|
|
105
|
+
*/
|
|
106
|
+
declare const group: <T, K extends PropertyKey>(arr: T[], getKey: (obj: T) => K) => Record<K, T[]>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Use `group` instead
|
|
110
|
+
*/
|
|
111
|
+
declare const groupBy: <T extends object, K extends keyof T>(arr: T[], key: T[K] extends PropertyKey ? K : never) => Record<PropertyKey & T[K], T[]>;
|
|
112
|
+
|
|
113
|
+
type Last<A extends readonly [] | readonly unknown[]> = A extends readonly [...unknown[], infer L] ? L : A extends readonly [] ? undefined : A extends readonly [unknown, infer F, ...infer L] ? Last<[F, ...L]> : A[number];
|
|
114
|
+
/**
|
|
115
|
+
* Gets the last element of an array
|
|
116
|
+
* @param arr The array
|
|
117
|
+
* @returns The last element
|
|
118
|
+
*/
|
|
119
|
+
declare const last: <A extends readonly [] | readonly unknown[]>(arr: A) => Last<A>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Returns the element with the maximum value based on the provided map function
|
|
123
|
+
* @param arr Array to search in
|
|
124
|
+
* @param fn Function to extract the value for comparison
|
|
125
|
+
* @returns Element with the maximum value
|
|
126
|
+
*/
|
|
127
|
+
declare const max: <T>(arr: T[], fn: (val: T) => number) => T;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Returns the element with the minimum value based on the provided map function
|
|
131
|
+
* @param arr Array to search in
|
|
132
|
+
* @param fn Function to extract the value for comparison
|
|
133
|
+
* @returns Element with the minimum value
|
|
134
|
+
*/
|
|
135
|
+
declare const min: <T>(arr: T[], fn: (val: T) => number) => T;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Creates an array of numbers from `a` up to `b` incremented by `step`
|
|
139
|
+
* @param a Start of the range (inclusive)
|
|
140
|
+
* @param b End of the range (exclusive)
|
|
141
|
+
* @param step Step between elements. Default: 1
|
|
142
|
+
* @returns Array of numbers in the specified range
|
|
143
|
+
*/
|
|
144
|
+
declare const range: (a: number, b: number, step?: number) => number[];
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Sorts an array in-place based on a mapping function
|
|
148
|
+
* @param arr Array to sort
|
|
149
|
+
* @param mapFn Function to map each element to a sortable value
|
|
150
|
+
* @returns Sorted array in-place
|
|
151
|
+
*/
|
|
152
|
+
declare const sort: <T>(arr: T[], mapFn: (el: T) => number | string) => T[];
|
|
153
|
+
|
|
154
|
+
type Transpose<T extends unknown[][]> = T[number] extends infer U ? {
|
|
155
|
+
[K in keyof U]: {
|
|
156
|
+
[J in keyof T]: T[J][K & keyof T[J]];
|
|
157
|
+
};
|
|
158
|
+
} : never;
|
|
159
|
+
/**
|
|
160
|
+
* Transposes a 2D array (matrix), switching its rows and columns
|
|
161
|
+
* @param matrix The 2D array to transpose
|
|
162
|
+
* @returns Transposed matrix
|
|
163
|
+
*/
|
|
164
|
+
declare const transpose: <T extends unknown[][]>(matrix: T) => Transpose<T>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Creates a set containing unique values from all provided arrays
|
|
168
|
+
* @param arrs Arrays to union
|
|
169
|
+
* @returns Set of unique values
|
|
170
|
+
*/
|
|
171
|
+
declare const union: <T>(...arrs: T[][]) => Set<T>;
|
|
172
|
+
|
|
173
|
+
type Literal = boolean | number | string;
|
|
174
|
+
type Nullish = null | undefined;
|
|
175
|
+
type Primitive = Literal | bigint | symbol;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Creates array of unique values from the input array, preserving their order
|
|
179
|
+
* @param arr Array of primitive values
|
|
180
|
+
* @returns Array of unique values
|
|
181
|
+
*/
|
|
182
|
+
declare const unique: <T extends Primitive>(arr: T[]) => T[];
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Creates an array of grouped elements, where each group contains the elements
|
|
186
|
+
* at the corresponding index from the input arrays
|
|
187
|
+
* @param arrays Arrays to process
|
|
188
|
+
* @returns Array of grouped elements
|
|
189
|
+
*/
|
|
190
|
+
declare const zip: <T extends unknown[][]>(...args: T) => Transpose<T>;
|
|
191
|
+
|
|
192
|
+
type index$5_First<A extends readonly [] | readonly unknown[]> = First<A>;
|
|
193
|
+
type index$5_Last<A extends readonly [] | readonly unknown[]> = Last<A>;
|
|
194
|
+
type index$5_Transpose<T extends unknown[][]> = Transpose<T>;
|
|
195
|
+
declare const index$5_binSearch: typeof binSearch;
|
|
196
|
+
declare const index$5_chunk: typeof chunk;
|
|
197
|
+
declare const index$5_countBy: typeof countBy;
|
|
198
|
+
declare const index$5_fill: typeof fill;
|
|
199
|
+
declare const index$5_find: typeof find;
|
|
200
|
+
declare const index$5_findAll: typeof findAll;
|
|
201
|
+
declare const index$5_findAllIdx: typeof findAllIdx;
|
|
202
|
+
declare const index$5_findIdx: typeof findIdx;
|
|
203
|
+
declare const index$5_first: typeof first;
|
|
204
|
+
declare const index$5_from: typeof from;
|
|
205
|
+
declare const index$5_group: typeof group;
|
|
206
|
+
declare const index$5_groupBy: typeof groupBy;
|
|
207
|
+
declare const index$5_last: typeof last;
|
|
208
|
+
declare const index$5_max: typeof max;
|
|
209
|
+
declare const index$5_min: typeof min;
|
|
210
|
+
declare const index$5_range: typeof range;
|
|
211
|
+
declare const index$5_sort: typeof sort;
|
|
212
|
+
declare const index$5_transpose: typeof transpose;
|
|
213
|
+
declare const index$5_union: typeof union;
|
|
214
|
+
declare const index$5_unique: typeof unique;
|
|
215
|
+
declare const index$5_zip: typeof zip;
|
|
216
|
+
declare namespace index$5 {
|
|
217
|
+
export { index$5_binSearch as binSearch, index$5_chunk as chunk, index$5_countBy as countBy, index$5_fill as fill, index$5_find as find, index$5_findAll as findAll, index$5_findAllIdx as findAllIdx, index$5_findIdx as findIdx, index$5_first as first, index$5_from as from, index$5_group as group, index$5_groupBy as groupBy, index$5_last as last, index$5_max as max, index$5_min as min, index$5_range as range, index$5_sort as sort, index$5_transpose as transpose, index$5_union as union, index$5_unique as unique, index$5_zip as zip };
|
|
218
|
+
export type { index$5_First as First, index$5_Last as Last, index$5_Transpose as Transpose };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Transforms a function with spread arguments into one with array argument
|
|
223
|
+
* @param fn Function accepting spread arguments
|
|
224
|
+
* @returns Function accepting an array of arguments
|
|
225
|
+
*/
|
|
226
|
+
declare const apply: <T extends unknown[], R>(fn: (...args: T) => R) => (arg: T) => R;
|
|
227
|
+
|
|
228
|
+
type CurryArgs<T extends unknown[]> = T extends [...infer Ti, unknown] ? CurryArgs<Ti> | T : [];
|
|
229
|
+
type CurryRest<T extends unknown[], A extends CurryArgs<T>> = T extends [
|
|
230
|
+
unknown,
|
|
231
|
+
...infer Ti
|
|
232
|
+
] ? A extends [unknown, ...infer Ai extends CurryArgs<Ti>] ? CurryRest<Ti, Ai> : T : [];
|
|
233
|
+
type CurryFnRes<R, T extends unknown[], A extends CurryArgs<T>> = CurryRest<T, A> extends [] ? R : CurryFn<R, CurryRest<T, A>>;
|
|
234
|
+
type CurryFn<R, T extends unknown[]> = <A extends CurryArgs<T>>(...args: A) => CurryFnRes<R, T, A>;
|
|
235
|
+
/**
|
|
236
|
+
* Creates a curried version of a function, allowing partial application of arguments
|
|
237
|
+
* @param fn Function to curry
|
|
238
|
+
* @param arity Number of arguments the function expects. Default: fn.length
|
|
239
|
+
* @returns Curried function
|
|
240
|
+
*/
|
|
241
|
+
declare const curry: <R, T extends unknown[]>(fn: (...args: T) => R, arity?: number) => CurryFn<R, T>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Creates a debounced version of a function that delays invoking until after the specified delay.
|
|
245
|
+
* Only the last call within the delay period is executed
|
|
246
|
+
* @param fn Function to debounce
|
|
247
|
+
* @param delay Delay in milliseconds. Default: 100
|
|
248
|
+
* @returns Debounced function
|
|
249
|
+
*/
|
|
250
|
+
declare const debounce: <A extends unknown[]>(fn: (...args: A) => void, delay?: number) => (...args: A) => void;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Returns the input value unchanged
|
|
254
|
+
* @param value Value to return
|
|
255
|
+
* @returns Same value provided as input
|
|
256
|
+
*/
|
|
257
|
+
declare const identity: <T>(x: T) => T;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Creates a memoized version of a function, caching its output for faster repeated calls.
|
|
261
|
+
* Optionally accepts a custom cache key generator and a TTL (time-to-live) in milliseconds
|
|
262
|
+
* @param fn Function to memoize
|
|
263
|
+
* @param idFn Function to generate a cache key from arguments. Default: JSON.stringify
|
|
264
|
+
* @param ttl Optional cache expiration time in milliseconds. Default: 0 (no expiration)
|
|
265
|
+
* @returns Memoized function
|
|
266
|
+
*/
|
|
267
|
+
declare const memo: <T extends unknown[], R>(fn: (...args: T) => R, idFn?: (arg: T) => Primitive, ttl?: number) => (...args: T) => R;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Performs no operation
|
|
271
|
+
*/
|
|
272
|
+
declare const noop: () => void;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Ensures the provided function is executed only once
|
|
276
|
+
* Subsequent calls return the result of the first execution
|
|
277
|
+
* @param fn Function to execute only once
|
|
278
|
+
* @returns Function that invokes `fn` only once
|
|
279
|
+
*/
|
|
280
|
+
declare const once: <T>(fn: () => T) => () => T;
|
|
281
|
+
|
|
282
|
+
type UnaryFn = (arg: any) => unknown;
|
|
283
|
+
|
|
284
|
+
type FirstFnArg<T> = T extends [(arg: infer A) => unknown, ...unknown[]] ? A : never;
|
|
285
|
+
type LastFnReturn<T> = T extends [...unknown[], (arg: unknown) => infer R] ? R : never;
|
|
286
|
+
type PipeOps<T extends UnaryFn[] = UnaryFn[]> = T extends [
|
|
287
|
+
infer F1 extends UnaryFn,
|
|
288
|
+
infer F2 extends UnaryFn,
|
|
289
|
+
...infer Rest extends UnaryFn[]
|
|
290
|
+
] ? F2 extends (arg: ReturnType<F1>) => unknown ? [F1, ...PipeOps<[F2, ...Rest]>] : [] : T extends [UnaryFn] ? T : [];
|
|
291
|
+
type PipedFn<T extends UnaryFn[]> = (arg: FirstFnArg<T>) => LastFnReturn<T>;
|
|
292
|
+
/**
|
|
293
|
+
* Creates a function by composing multiple unary functions from left to right.
|
|
294
|
+
* The output of each function is passed as the input to the next
|
|
295
|
+
* @param fns Sequence of unary functions to compose
|
|
296
|
+
* @returns Composed function from left to right
|
|
297
|
+
*/
|
|
298
|
+
declare const pipe: <T extends UnaryFn[]>(...fns: PipeOps<T>) => PipedFn<T>;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Creates a throttled version of the given function that only executes once per specified interval
|
|
302
|
+
* @param fn Function to throttle
|
|
303
|
+
* @param interval Minimum time (ms) between calls. Default: 100
|
|
304
|
+
* @returns Throttled function
|
|
305
|
+
*/
|
|
306
|
+
declare const throttle: <A extends unknown[]>(fn: (...args: A) => void, interval?: number) => (...args: A) => void;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Transforms a function with array argument into one with spread arguments
|
|
310
|
+
* @param fn Function accepting an array of arguments
|
|
311
|
+
* @returns Function accepting spread arguments
|
|
312
|
+
*/
|
|
313
|
+
declare const unapply: <T extends unknown[], R>(fn: (arg: T) => R) => (...args: T) => R;
|
|
314
|
+
|
|
315
|
+
type index$4_CurryFn<R, T extends unknown[]> = CurryFn<R, T>;
|
|
316
|
+
type index$4_PipedFn<T extends UnaryFn[]> = PipedFn<T>;
|
|
317
|
+
declare const index$4_apply: typeof apply;
|
|
318
|
+
declare const index$4_curry: typeof curry;
|
|
319
|
+
declare const index$4_debounce: typeof debounce;
|
|
320
|
+
declare const index$4_identity: typeof identity;
|
|
321
|
+
declare const index$4_memo: typeof memo;
|
|
322
|
+
declare const index$4_noop: typeof noop;
|
|
323
|
+
declare const index$4_once: typeof once;
|
|
324
|
+
declare const index$4_pipe: typeof pipe;
|
|
325
|
+
declare const index$4_throttle: typeof throttle;
|
|
326
|
+
declare const index$4_unapply: typeof unapply;
|
|
327
|
+
declare namespace index$4 {
|
|
328
|
+
export { index$4_apply as apply, index$4_curry as curry, index$4_debounce as debounce, index$4_identity as identity, index$4_memo as memo, index$4_noop as noop, index$4_once as once, index$4_pipe as pipe, index$4_throttle as throttle, index$4_unapply as unapply };
|
|
329
|
+
export type { index$4_CurryFn as CurryFn, index$4_PipedFn as PipedFn };
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
type Quantity = number[] | number;
|
|
333
|
+
type QuantityT<T extends Quantity> = T extends number ? number : number[];
|
|
334
|
+
|
|
335
|
+
type Calc<A extends Quantity[]> = A extends number[] ? number : number[];
|
|
336
|
+
/**
|
|
337
|
+
* Creates a function that applies the given operation to any combination of scalars and vectors
|
|
338
|
+
* @template T Tuple or array of numbers for the operation
|
|
339
|
+
* @param opFn Operation function to apply to the inputs
|
|
340
|
+
* @returns Function that takes quantities (scalars or vectors) and returns the calculated result
|
|
341
|
+
* @example
|
|
342
|
+
* const fn = calc((a, b, c) => a * b + c);
|
|
343
|
+
* fn([1, 2], 3, 4); // [7, 10]
|
|
344
|
+
*/
|
|
345
|
+
declare const calc: <T extends number[]>(opFn: (...nums: T) => number) => <A extends ConvertTuple<T, Quantity>>(...q: A) => Calc<A>;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Calculates the sum of given quantities (vectors or scalars)
|
|
349
|
+
* @param q Quantities to add
|
|
350
|
+
* @returns Sum of the input quantities
|
|
351
|
+
* @example
|
|
352
|
+
* add([-4, 1, 0, 3], 5); // [1, 6, 5, 8]
|
|
353
|
+
* add([1, 2], [3, 4]); // [4, 6]
|
|
354
|
+
*/
|
|
355
|
+
declare const add: <A extends Quantity[]>(...q: A) => Calc<A>;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Compares if two numbers are approximately equal using a custom precision
|
|
359
|
+
* @param a First number to compare
|
|
360
|
+
* @param b Second number to compare
|
|
361
|
+
* @param precision Number of decimal places to consider. Default: 4
|
|
362
|
+
* @returns True if numbers are approximately equal, false otherwise
|
|
363
|
+
*/
|
|
364
|
+
declare const aprox: (a: number, b: number, precision?: number) => boolean;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Clamps a number between a minimum and maximum value
|
|
368
|
+
*
|
|
369
|
+
* @param x - The number to clamp
|
|
370
|
+
* @param min - The lower bound
|
|
371
|
+
* @param max - The upper bound
|
|
372
|
+
* @returns The clamped value
|
|
373
|
+
*/
|
|
374
|
+
declare const clamp: (x: number, min: number, max: number) => number;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Calculates the cumulative sum of an array of numbers
|
|
378
|
+
* @param arr Array of numbers to sum
|
|
379
|
+
* @returns Array of cumulative sums
|
|
380
|
+
*/
|
|
381
|
+
declare const cumsum: (arr: number[]) => number[];
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Calculates the division of two quantities (vectors or scalars)
|
|
385
|
+
* @param a Dividend number or array
|
|
386
|
+
* @param b Divisor number or array
|
|
387
|
+
* @returns Division of the input quantities
|
|
388
|
+
* @example
|
|
389
|
+
* divide([-4, 1, 0, 3], 2); // [-2, 0.5, 0, 1.5]
|
|
390
|
+
* divide([1, 2], [3, 4]); // [1 / 3, 0.5]
|
|
391
|
+
*/
|
|
392
|
+
declare const divide: <A extends [a: Quantity, b: Quantity]>(...q: A) => Calc<A>;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Calculates the linear interpolation of monotonic increasing points (xp, fp) at given x values
|
|
396
|
+
* @param x Points to interpolate
|
|
397
|
+
* @param xp Known x-coordinates (must be increasing)
|
|
398
|
+
* @param fp Known y-coordinates (must be increasing, same size as xp)
|
|
399
|
+
* @returns Interpolated values at each x
|
|
400
|
+
*/
|
|
401
|
+
declare const interp: (x: number[], xp: number[], fp: number[]) => number[];
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Checks if a number is within a half-open range [a, b)
|
|
405
|
+
* @param n The number to check
|
|
406
|
+
* @param a Start of the range (inclusive)
|
|
407
|
+
* @param b End of the range (exclusive). Default: 0
|
|
408
|
+
* @returns True if n is in [a, b), false otherwise
|
|
409
|
+
*/
|
|
410
|
+
declare const inRange: (n: number, a: number, b?: number) => boolean;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Calculates the mean (average) of an array of numbers. Supports optional weighted mean
|
|
414
|
+
* @param arr Array of numbers
|
|
415
|
+
* @param weights Optional array of weights
|
|
416
|
+
* @returns Mean of the given numbers
|
|
417
|
+
*/
|
|
418
|
+
declare const mean: (arr: number[], weights?: number[]) => number;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Calculates the median of an array of numbers
|
|
422
|
+
* @param arr Array of numbers
|
|
423
|
+
* @param weights Optional array of weights
|
|
424
|
+
* @returns Median of the given numbers
|
|
425
|
+
*/
|
|
426
|
+
declare const median: (arr: number[], weights?: number[]) => number;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Calculates the modulo of two quantities (vectors or scalars)
|
|
430
|
+
* @param x Dividend number or array
|
|
431
|
+
* @param modulo Divisor number or array
|
|
432
|
+
* @returns Remainder of division
|
|
433
|
+
* @example
|
|
434
|
+
* mod(5, 3); // 2
|
|
435
|
+
* mod([2, 3, 4], 3); // [2, 0, 1]
|
|
436
|
+
* mod([4, 5], [2, 3]); // [0, 2]
|
|
437
|
+
*/
|
|
438
|
+
declare const mod: <A extends [x: Quantity, modulo: Quantity]>(...q: A) => Calc<A>;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Calculates the multiplication of given quantities (vectors or scalars)
|
|
442
|
+
* @param q Quantities to multiply
|
|
443
|
+
* @returns Product of the input quantities
|
|
444
|
+
* @example
|
|
445
|
+
* multiply([-4, 1, 0, 3], 3); // => [-12, 3, 0, 9]
|
|
446
|
+
* multiply([1, 2], [3, 4]); // => [3, 8]
|
|
447
|
+
*/
|
|
448
|
+
declare const multiply: <A extends Quantity[]>(...q: A) => Calc<A>;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Calculates the given percentile(s) of an array of numbers
|
|
452
|
+
* Supports both linear interpolation and weighted percentiles
|
|
453
|
+
* @param x Array of numbers
|
|
454
|
+
* @param p Percentile number or array to compute (0–100)
|
|
455
|
+
* @param weights Optional array of weights (same size as x)
|
|
456
|
+
* @returns Computed percentile value(s)
|
|
457
|
+
*/
|
|
458
|
+
declare const percentile: <T extends Quantity>(x: number[], p: T, weights?: number[]) => QuantityT<T>;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Calculates the exponentiation of two quantities (vectors or scalars)
|
|
462
|
+
* @param base Base number or array
|
|
463
|
+
* @param exp Exponent number or array
|
|
464
|
+
* @returns base raised to the power of exp
|
|
465
|
+
*/
|
|
466
|
+
declare const pow: <A extends [base: Quantity, exp: Quantity]>(...q: A) => Calc<A>;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Rounds a quantity (vector or scalar) to the specified number of decimal places
|
|
470
|
+
* @param q Number or array to round
|
|
471
|
+
* @param precision Number of decimal places to round to. Default: 0
|
|
472
|
+
* @returns Rounded quantity
|
|
473
|
+
*/
|
|
474
|
+
declare const round: <T extends Quantity>(q: T, precision?: number) => T;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Calculates the subtraction of two quantities (vectors or scalars)
|
|
478
|
+
* @param a Minuend number or array
|
|
479
|
+
* @param b Subtrahend number or array
|
|
480
|
+
* @returns Subtraction of `b` from `a`
|
|
481
|
+
*/
|
|
482
|
+
declare const subtract: <A extends [a: Quantity, b: Quantity]>(...q: A) => Calc<A>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Calculates the sum of an array of numbers
|
|
486
|
+
* @param arr Numbers to sum
|
|
487
|
+
* @returns Sum of all numbers in the array
|
|
488
|
+
*/
|
|
489
|
+
declare const sum: (arr: number[]) => number;
|
|
490
|
+
|
|
491
|
+
type index$3_Calc<A extends Quantity[]> = Calc<A>;
|
|
492
|
+
declare const index$3_add: typeof add;
|
|
493
|
+
declare const index$3_aprox: typeof aprox;
|
|
494
|
+
declare const index$3_calc: typeof calc;
|
|
495
|
+
declare const index$3_clamp: typeof clamp;
|
|
496
|
+
declare const index$3_cumsum: typeof cumsum;
|
|
497
|
+
declare const index$3_divide: typeof divide;
|
|
498
|
+
declare const index$3_inRange: typeof inRange;
|
|
499
|
+
declare const index$3_interp: typeof interp;
|
|
500
|
+
declare const index$3_mean: typeof mean;
|
|
501
|
+
declare const index$3_median: typeof median;
|
|
502
|
+
declare const index$3_mod: typeof mod;
|
|
503
|
+
declare const index$3_multiply: typeof multiply;
|
|
504
|
+
declare const index$3_percentile: typeof percentile;
|
|
505
|
+
declare const index$3_pow: typeof pow;
|
|
506
|
+
declare const index$3_round: typeof round;
|
|
507
|
+
declare const index$3_subtract: typeof subtract;
|
|
508
|
+
declare const index$3_sum: typeof sum;
|
|
509
|
+
declare namespace index$3 {
|
|
510
|
+
export { index$3_add as add, index$3_aprox as aprox, index$3_calc as calc, index$3_clamp as clamp, index$3_cumsum as cumsum, index$3_divide as divide, index$3_inRange as inRange, index$3_interp as interp, index$3_mean as mean, index$3_median as median, index$3_mod as mod, index$3_multiply as multiply, index$3_percentile as percentile, index$3_pow as pow, index$3_round as round, index$3_subtract as subtract, index$3_sum as sum };
|
|
511
|
+
export type { index$3_Calc as Calc };
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Creates a deep copy of the provided object or array
|
|
516
|
+
* @param obj Object or array to copy
|
|
517
|
+
* @returns Deep copy of the input
|
|
518
|
+
*/
|
|
519
|
+
declare const copy: <T>(obj: T) => T;
|
|
520
|
+
|
|
521
|
+
type Entry<T extends object> = [Key<T>, Val<T>];
|
|
522
|
+
type Key<T extends object> = keyof T;
|
|
523
|
+
type Val<T extends object> = T[keyof T];
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Retrieves a strongly-typed array of the entries (key, value) of an object
|
|
527
|
+
* @param obj Object whose entries are to be retrieved
|
|
528
|
+
* @returns Array of key-value pairs from the object
|
|
529
|
+
*/
|
|
530
|
+
declare const entries: <T extends object>(obj: T) => Entry<T>[];
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Performs a deep comparison between multiple objects to determine if they are equal
|
|
534
|
+
* @param objs Objects to compare
|
|
535
|
+
* @returns True if all objects are deeply equal, false otherwise
|
|
536
|
+
*/
|
|
537
|
+
declare const equal: (...args: unknown[]) => boolean;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Gets a value at a nested path of an object or array
|
|
541
|
+
* @param obj Source object
|
|
542
|
+
* @param path Dot-separated path string
|
|
543
|
+
* @param fallback Value to return if the path is not found
|
|
544
|
+
* @returns Value at the specified path or the fallback
|
|
545
|
+
*/
|
|
546
|
+
declare const get: <T>(obj: object, path: string, fallback?: T | undefined) => T;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Checks if an object has all specified properties
|
|
550
|
+
* @param obj Object to check
|
|
551
|
+
* @param keys Property keys to look for
|
|
552
|
+
* @returns True if all keys exist on the object, false otherwise
|
|
553
|
+
*/
|
|
554
|
+
declare const has: <K extends PropertyKey>(obj: object, ...keys: K[]) => obj is Record<K, unknown>;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Checks if the provided value is a non-null object
|
|
558
|
+
* @param el Value to check
|
|
559
|
+
* @returns True if `el` is a non-null object, otherwise false
|
|
560
|
+
*/
|
|
561
|
+
declare const isObj: (el: unknown) => el is object;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Retrieves a strongly-typed array of the keys of an object
|
|
565
|
+
* @param obj Object whose keys are to be retrieved
|
|
566
|
+
* @returns Array of the object's keys
|
|
567
|
+
*/
|
|
568
|
+
declare const keys: <T extends object>(obj: T) => (keyof T)[];
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Creates a strongly-typed object from the shallow merge of deep copies of two objects
|
|
572
|
+
* If both objects have the same property, the value from the second object overwrites the first
|
|
573
|
+
* @param a First object to merge
|
|
574
|
+
* @param b Second object to merge
|
|
575
|
+
* @returns The merged object with properties from both a and b
|
|
576
|
+
*/
|
|
577
|
+
declare const merge: <A extends object, B extends object>(a: A, b: B) => A & B;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Creates a deep copy of an object without the specified keys
|
|
581
|
+
* @param obj Source object
|
|
582
|
+
* @param keys Array of keys to omit from the result
|
|
583
|
+
* @returns New object without the specified keys
|
|
584
|
+
*/
|
|
585
|
+
declare const omit: <T, K extends keyof T>(obj: T, keys: K[]) => Omit<T, K>;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Creates a deep copy of an object with only the specified keys
|
|
589
|
+
* @param obj Source object
|
|
590
|
+
* @param keys Array of keys to pick from the object
|
|
591
|
+
* @returns New object with only the picked keys
|
|
592
|
+
*/
|
|
593
|
+
declare const pick: <T, K extends keyof T>(obj: T, keys: K[]) => Pick<T, K>;
|
|
594
|
+
|
|
595
|
+
type SetPath<Obj extends object, P extends string, Val> = P extends `${infer K}.${infer Rest}` ? {
|
|
596
|
+
[Key in K | keyof Obj]: Key extends K ? Rest extends [] ? Val : SetPath<Key extends keyof Obj ? Obj[Key] extends object ? Obj[Key] : object : object, Rest, Val> : Key extends keyof Obj ? Obj[Key] : never;
|
|
597
|
+
} : Obj;
|
|
598
|
+
/**
|
|
599
|
+
* Sets a value at a nested path of an object, creating nested objects if needed
|
|
600
|
+
* @param obj Target object to modify
|
|
601
|
+
* @param path Dot-separated string path where the value should be set
|
|
602
|
+
* @param value Value to set at the specified path
|
|
603
|
+
* @returns Modified object with the value set at the given path
|
|
604
|
+
*/
|
|
605
|
+
declare const set: <T extends object, P extends string, V>(obj: T, path: P, value: V) => SetPath<T, P, V>;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Retrieves a strongly-typed array of the values of an object
|
|
609
|
+
* @param obj Source object
|
|
610
|
+
* @returns Array of the object's values
|
|
611
|
+
*/
|
|
612
|
+
declare const vals: <T extends object>(obj: T) => Val<T>[];
|
|
613
|
+
|
|
614
|
+
type index$2_SetPath<Obj extends object, P extends string, Val> = SetPath<Obj, P, Val>;
|
|
615
|
+
declare const index$2_copy: typeof copy;
|
|
616
|
+
declare const index$2_entries: typeof entries;
|
|
617
|
+
declare const index$2_equal: typeof equal;
|
|
618
|
+
declare const index$2_get: typeof get;
|
|
619
|
+
declare const index$2_has: typeof has;
|
|
620
|
+
declare const index$2_isObj: typeof isObj;
|
|
621
|
+
declare const index$2_keys: typeof keys;
|
|
622
|
+
declare const index$2_merge: typeof merge;
|
|
623
|
+
declare const index$2_omit: typeof omit;
|
|
624
|
+
declare const index$2_pick: typeof pick;
|
|
625
|
+
declare const index$2_set: typeof set;
|
|
626
|
+
declare const index$2_vals: typeof vals;
|
|
627
|
+
declare namespace index$2 {
|
|
628
|
+
export { index$2_copy as copy, index$2_entries as entries, index$2_equal as equal, index$2_get as get, index$2_has as has, index$2_isObj as isObj, index$2_keys as keys, index$2_merge as merge, index$2_omit as omit, index$2_pick as pick, index$2_set as set, index$2_vals as vals };
|
|
629
|
+
export type { index$2_SetPath as SetPath };
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Returns a random integer between two numbers
|
|
634
|
+
* @param a Lower bound (inclusive)
|
|
635
|
+
* @param b Upper bound (exclusive). Default: 0
|
|
636
|
+
* @returns Random integer between a and b
|
|
637
|
+
*/
|
|
638
|
+
declare const randInt: (a: number, b?: number) => number;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Selects a random index based on the provided weights
|
|
642
|
+
* @param weights Array of non-negative weights
|
|
643
|
+
* @returns Selected index
|
|
644
|
+
*/
|
|
645
|
+
declare const randWeight: (weights: number[]) => number;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Samples elements from an array randomly, optionally using weights to influence selection
|
|
649
|
+
* @param data Array to sample from
|
|
650
|
+
* @param size Number of elements to sample
|
|
651
|
+
* @param weights Optional array of weights for weighted sampling
|
|
652
|
+
* @returns New array containing the sampled elements
|
|
653
|
+
*/
|
|
654
|
+
declare const sample: <T>(data: T[], size: number, weights?: number[] | undefined) => T[];
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Shuffles an array randomly, optionally using weights to influence the
|
|
658
|
+
* likelihood of selecting elements first
|
|
659
|
+
* @param data Array to shuffle
|
|
660
|
+
* @param weights Optional array of weights for weighted shuffling
|
|
661
|
+
* @returns New array with the elements shuffled
|
|
662
|
+
*/
|
|
663
|
+
declare const shuffle: <T>(data: T[], weights?: number[]) => T[];
|
|
664
|
+
|
|
665
|
+
declare const index$1_randInt: typeof randInt;
|
|
666
|
+
declare const index$1_randWeight: typeof randWeight;
|
|
667
|
+
declare const index$1_sample: typeof sample;
|
|
668
|
+
declare const index$1_shuffle: typeof shuffle;
|
|
669
|
+
declare namespace index$1 {
|
|
670
|
+
export {
|
|
671
|
+
index$1_randInt as randInt,
|
|
672
|
+
index$1_randWeight as randWeight,
|
|
673
|
+
index$1_sample as sample,
|
|
674
|
+
index$1_shuffle as shuffle,
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Converts a string to camelCase
|
|
680
|
+
* @param str String to convert
|
|
681
|
+
* @returns camelCase version of the input string
|
|
682
|
+
*/
|
|
683
|
+
declare const camel: (str: string) => string;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Capitalizes the first letter of a string and converts the rest to lowercase
|
|
687
|
+
* @param str String to capitalize
|
|
688
|
+
* @returns Capitalized string
|
|
689
|
+
*/
|
|
690
|
+
declare const capitalize: (str: string) => string;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Converts a string to kebab-case
|
|
694
|
+
* @param str String to convert
|
|
695
|
+
* @returns kebab-case version of the input string
|
|
696
|
+
*/
|
|
697
|
+
declare const kebab: (str: string) => string;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Converts a string to PascalCase
|
|
701
|
+
* @param str String to convert
|
|
702
|
+
* @returns PascalCase version of the input string
|
|
703
|
+
*/
|
|
704
|
+
declare const pascal: (str: string) => string;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Converts a string to snake_case
|
|
708
|
+
* @param str String to convert
|
|
709
|
+
* @returns snake_case version of the input string
|
|
710
|
+
*/
|
|
711
|
+
declare const snake: (str: string) => string;
|
|
712
|
+
|
|
713
|
+
type Split<S extends string, D extends string> = S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : [S];
|
|
714
|
+
/**
|
|
715
|
+
* Splits a string by the specified delimiter and returns a typed array
|
|
716
|
+
*
|
|
717
|
+
* @param str - The string to split
|
|
718
|
+
* @param delimiter - The delimiter to split by
|
|
719
|
+
* @returns The array (tuple) of substrings
|
|
720
|
+
*/
|
|
721
|
+
declare const split: <S extends string, D extends string>(str: S, delimiter: D) => Split<S, D>;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Replaces placeholders in the format `{{path.to.value}}` within a string
|
|
725
|
+
* with corresponding values from the provided data object
|
|
726
|
+
* @param str String containing placeholders to replace
|
|
727
|
+
* @param data Object with values for the placeholders
|
|
728
|
+
* @returns String with placeholders replaced by their values
|
|
729
|
+
*/
|
|
730
|
+
declare const template: (str: string, data: object) => string;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Removes leading and trailing whitespace or specified characters from a string
|
|
734
|
+
* @param str String to trim
|
|
735
|
+
* @param chars Optional characters to trim from the string. Default: whitespace
|
|
736
|
+
* @returns Trimmed string
|
|
737
|
+
*/
|
|
738
|
+
declare const trim: (str: string, chars?: string) => string;
|
|
739
|
+
|
|
740
|
+
type index_Split<S extends string, D extends string> = Split<S, D>;
|
|
741
|
+
declare const index_camel: typeof camel;
|
|
742
|
+
declare const index_capitalize: typeof capitalize;
|
|
743
|
+
declare const index_kebab: typeof kebab;
|
|
744
|
+
declare const index_pascal: typeof pascal;
|
|
745
|
+
declare const index_snake: typeof snake;
|
|
746
|
+
declare const index_split: typeof split;
|
|
747
|
+
declare const index_template: typeof template;
|
|
748
|
+
declare const index_trim: typeof trim;
|
|
749
|
+
declare namespace index {
|
|
750
|
+
export { index_camel as camel, index_capitalize as capitalize, index_kebab as kebab, index_pascal as pascal, index_snake as snake, index_split as split, index_template as template, index_trim as trim };
|
|
751
|
+
export type { index_Split as Split };
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
type TimeFormat = "date" | "full" | "time";
|
|
755
|
+
type TimeFormatOptions = Record<TimeFormat, Intl.DateTimeFormatOptions>;
|
|
756
|
+
type TimeUnit = "d" | "h" | "m" | "ms" | "s";
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* @deprecated Time module is deprecated and may be removed in future releases
|
|
760
|
+
*/
|
|
761
|
+
declare class Time {
|
|
762
|
+
static UNITS: Record<TimeUnit, number>;
|
|
763
|
+
static formatOptions: TimeFormatOptions;
|
|
764
|
+
static locales?: Intl.LocalesArgument;
|
|
765
|
+
private readonly date;
|
|
766
|
+
constructor(val?: number, unit?: TimeUnit);
|
|
767
|
+
static convert(val: number, from: TimeUnit, to?: TimeUnit): number;
|
|
768
|
+
add(val: number, unit?: TimeUnit): number;
|
|
769
|
+
format(mode?: TimeFormat, local?: Intl.LocalesArgument, opts?: Intl.DateTimeFormatOptions): string;
|
|
770
|
+
get(unit?: TimeUnit): number;
|
|
771
|
+
getDayTime(unit?: TimeUnit): number;
|
|
772
|
+
set(val: number, unit?: TimeUnit): number;
|
|
773
|
+
setDayTime(val: number, unit?: TimeUnit): number;
|
|
774
|
+
toDate(): Date;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
export { Time, add, apply, aprox, index$5 as arr, binSearch, calc, camel, capitalize, chunk, clamp, copy, countBy, cumsum, curry, debounce, divide, entries, equal, fill, find, findAll, findAllIdx, findIdx, first, from, index$4 as func, get, group, groupBy, has, identity, inRange, interp, isObj, kebab, keys, last, index$3 as math, max, mean, median, memo, merge, min, mod, multiply, noop, index$2 as obj, omit, once, pascal, percentile, pick, pipe, pow, index$1 as rand, randInt, randWeight, range, round, sample, set, shuffle, snake, sort, split, index as str, subtract, sum, template, throttle, transpose, trim, unapply, union, unique, vals, zip };
|
|
778
|
+
export type { Calc, ConvertTuple, CurryFn, Entry, First, Key, Last, Literal, Nullish, PipedFn, Predicate, Primitive, Quantity, QuantityT, SetPath, Split, TimeFormat, TimeFormatOptions, TimeUnit, Transpose, Tuple, Val };
|