fp-pack 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +664 -0
- package/dist/fp-pack-stream.umd.js +2 -0
- package/dist/fp-pack-stream.umd.js.map +1 -0
- package/dist/fp-pack.umd.js +2 -0
- package/dist/fp-pack.umd.js.map +1 -0
- package/dist/implement/array/append.d.ts +7 -0
- package/dist/implement/array/append.d.ts.map +1 -0
- package/dist/implement/array/append.mjs +9 -0
- package/dist/implement/array/append.mjs.map +1 -0
- package/dist/implement/array/chunk.d.ts +7 -0
- package/dist/implement/array/chunk.d.ts.map +1 -0
- package/dist/implement/array/chunk.mjs +15 -0
- package/dist/implement/array/chunk.mjs.map +1 -0
- package/dist/implement/array/concat.d.ts +7 -0
- package/dist/implement/array/concat.d.ts.map +1 -0
- package/dist/implement/array/concat.mjs +9 -0
- package/dist/implement/array/concat.mjs.map +1 -0
- package/dist/implement/array/drop.d.ts +7 -0
- package/dist/implement/array/drop.d.ts.map +1 -0
- package/dist/implement/array/drop.mjs +10 -0
- package/dist/implement/array/drop.mjs.map +1 -0
- package/dist/implement/array/dropWhile.d.ts +7 -0
- package/dist/implement/array/dropWhile.d.ts.map +1 -0
- package/dist/implement/array/dropWhile.mjs +13 -0
- package/dist/implement/array/dropWhile.mjs.map +1 -0
- package/dist/implement/array/every.d.ts +7 -0
- package/dist/implement/array/every.d.ts.map +1 -0
- package/dist/implement/array/every.mjs +9 -0
- package/dist/implement/array/every.mjs.map +1 -0
- package/dist/implement/array/filter.d.ts +7 -0
- package/dist/implement/array/filter.d.ts.map +1 -0
- package/dist/implement/array/filter.mjs +9 -0
- package/dist/implement/array/filter.mjs.map +1 -0
- package/dist/implement/array/find.d.ts +7 -0
- package/dist/implement/array/find.d.ts.map +1 -0
- package/dist/implement/array/find.mjs +9 -0
- package/dist/implement/array/find.mjs.map +1 -0
- package/dist/implement/array/flatMap.d.ts +7 -0
- package/dist/implement/array/flatMap.d.ts.map +1 -0
- package/dist/implement/array/flatMap.mjs +9 -0
- package/dist/implement/array/flatMap.mjs.map +1 -0
- package/dist/implement/array/flatten.d.ts +6 -0
- package/dist/implement/array/flatten.d.ts.map +1 -0
- package/dist/implement/array/flatten.mjs +7 -0
- package/dist/implement/array/flatten.mjs.map +1 -0
- package/dist/implement/array/flattenDeep.d.ts +6 -0
- package/dist/implement/array/flattenDeep.d.ts.map +1 -0
- package/dist/implement/array/flattenDeep.mjs +11 -0
- package/dist/implement/array/flattenDeep.mjs.map +1 -0
- package/dist/implement/array/groupBy.d.ts +7 -0
- package/dist/implement/array/groupBy.d.ts.map +1 -0
- package/dist/implement/array/groupBy.mjs +12 -0
- package/dist/implement/array/groupBy.mjs.map +1 -0
- package/dist/implement/array/head.d.ts +6 -0
- package/dist/implement/array/head.d.ts.map +1 -0
- package/dist/implement/array/head.mjs +7 -0
- package/dist/implement/array/head.mjs.map +1 -0
- package/dist/implement/array/index.d.ts +34 -0
- package/dist/implement/array/index.d.ts.map +1 -0
- package/dist/implement/array/init.d.ts +6 -0
- package/dist/implement/array/init.d.ts.map +1 -0
- package/dist/implement/array/init.mjs +7 -0
- package/dist/implement/array/init.mjs.map +1 -0
- package/dist/implement/array/last.d.ts +6 -0
- package/dist/implement/array/last.d.ts.map +1 -0
- package/dist/implement/array/last.mjs +8 -0
- package/dist/implement/array/last.mjs.map +1 -0
- package/dist/implement/array/map.d.ts +7 -0
- package/dist/implement/array/map.d.ts.map +1 -0
- package/dist/implement/array/map.mjs +9 -0
- package/dist/implement/array/map.mjs.map +1 -0
- package/dist/implement/array/partition.d.ts +7 -0
- package/dist/implement/array/partition.d.ts.map +1 -0
- package/dist/implement/array/partition.mjs +12 -0
- package/dist/implement/array/partition.mjs.map +1 -0
- package/dist/implement/array/prepend.d.ts +7 -0
- package/dist/implement/array/prepend.d.ts.map +1 -0
- package/dist/implement/array/prepend.mjs +9 -0
- package/dist/implement/array/prepend.mjs.map +1 -0
- package/dist/implement/array/range.d.ts +6 -0
- package/dist/implement/array/range.d.ts.map +1 -0
- package/dist/implement/array/range.mjs +12 -0
- package/dist/implement/array/range.mjs.map +1 -0
- package/dist/implement/array/reduce.d.ts +8 -0
- package/dist/implement/array/reduce.d.ts.map +1 -0
- package/dist/implement/array/reduce.mjs +9 -0
- package/dist/implement/array/reduce.mjs.map +1 -0
- package/dist/implement/array/scan.d.ts +8 -0
- package/dist/implement/array/scan.d.ts.map +1 -0
- package/dist/implement/array/scan.mjs +13 -0
- package/dist/implement/array/scan.mjs.map +1 -0
- package/dist/implement/array/some.d.ts +7 -0
- package/dist/implement/array/some.d.ts.map +1 -0
- package/dist/implement/array/some.mjs +11 -0
- package/dist/implement/array/some.mjs.map +1 -0
- package/dist/implement/array/sort.d.ts +7 -0
- package/dist/implement/array/sort.d.ts.map +1 -0
- package/dist/implement/array/sort.mjs +9 -0
- package/dist/implement/array/sort.mjs.map +1 -0
- package/dist/implement/array/sortBy.d.ts +7 -0
- package/dist/implement/array/sortBy.d.ts.map +1 -0
- package/dist/implement/array/sortBy.mjs +12 -0
- package/dist/implement/array/sortBy.mjs.map +1 -0
- package/dist/implement/array/tail.d.ts +6 -0
- package/dist/implement/array/tail.d.ts.map +1 -0
- package/dist/implement/array/tail.mjs +7 -0
- package/dist/implement/array/tail.mjs.map +1 -0
- package/dist/implement/array/take.d.ts +7 -0
- package/dist/implement/array/take.d.ts.map +1 -0
- package/dist/implement/array/take.mjs +9 -0
- package/dist/implement/array/take.mjs.map +1 -0
- package/dist/implement/array/takeWhile.d.ts +7 -0
- package/dist/implement/array/takeWhile.d.ts.map +1 -0
- package/dist/implement/array/takeWhile.mjs +15 -0
- package/dist/implement/array/takeWhile.mjs.map +1 -0
- package/dist/implement/array/uniq.d.ts +6 -0
- package/dist/implement/array/uniq.d.ts.map +1 -0
- package/dist/implement/array/uniq.mjs +10 -0
- package/dist/implement/array/uniq.mjs.map +1 -0
- package/dist/implement/array/uniqBy.d.ts +7 -0
- package/dist/implement/array/uniqBy.d.ts.map +1 -0
- package/dist/implement/array/uniqBy.mjs +14 -0
- package/dist/implement/array/uniqBy.mjs.map +1 -0
- package/dist/implement/array/unzip.d.ts +6 -0
- package/dist/implement/array/unzip.d.ts.map +1 -0
- package/dist/implement/array/unzip.mjs +10 -0
- package/dist/implement/array/unzip.mjs.map +1 -0
- package/dist/implement/array/zip.d.ts +7 -0
- package/dist/implement/array/zip.d.ts.map +1 -0
- package/dist/implement/array/zip.mjs +12 -0
- package/dist/implement/array/zip.mjs.map +1 -0
- package/dist/implement/array/zipIndex.d.ts +6 -0
- package/dist/implement/array/zipIndex.d.ts.map +1 -0
- package/dist/implement/array/zipIndex.mjs +7 -0
- package/dist/implement/array/zipIndex.mjs.map +1 -0
- package/dist/implement/array/zipWith.d.ts +8 -0
- package/dist/implement/array/zipWith.d.ts.map +1 -0
- package/dist/implement/array/zipWith.mjs +12 -0
- package/dist/implement/array/zipWith.mjs.map +1 -0
- package/dist/implement/async/debounce.d.ts +7 -0
- package/dist/implement/async/debounce.d.ts.map +1 -0
- package/dist/implement/async/debounce.mjs +16 -0
- package/dist/implement/async/debounce.mjs.map +1 -0
- package/dist/implement/async/debounceLeading.d.ts +7 -0
- package/dist/implement/async/debounceLeading.d.ts.map +1 -0
- package/dist/implement/async/debounceLeading.mjs +14 -0
- package/dist/implement/async/debounceLeading.mjs.map +1 -0
- package/dist/implement/async/debounceLeadingTrailing.d.ts +7 -0
- package/dist/implement/async/debounceLeadingTrailing.d.ts.map +1 -0
- package/dist/implement/async/debounceLeadingTrailing.mjs +19 -0
- package/dist/implement/async/debounceLeadingTrailing.mjs.map +1 -0
- package/dist/implement/async/delay.d.ts +4 -0
- package/dist/implement/async/delay.d.ts.map +1 -0
- package/dist/implement/async/delay.mjs +9 -0
- package/dist/implement/async/delay.mjs.map +1 -0
- package/dist/implement/async/index.d.ts +10 -0
- package/dist/implement/async/index.d.ts.map +1 -0
- package/dist/implement/async/pipeAsync.d.ts +14 -0
- package/dist/implement/async/pipeAsync.d.ts.map +1 -0
- package/dist/implement/async/pipeAsync.mjs +12 -0
- package/dist/implement/async/pipeAsync.mjs.map +1 -0
- package/dist/implement/async/pipeAsyncSideEffect.d.ts +21 -0
- package/dist/implement/async/pipeAsyncSideEffect.d.ts.map +1 -0
- package/dist/implement/async/pipeAsyncSideEffect.mjs +16 -0
- package/dist/implement/async/pipeAsyncSideEffect.mjs.map +1 -0
- package/dist/implement/async/retry.d.ts +7 -0
- package/dist/implement/async/retry.d.ts.map +1 -0
- package/dist/implement/async/retry.mjs +19 -0
- package/dist/implement/async/retry.mjs.map +1 -0
- package/dist/implement/async/throttle.d.ts +7 -0
- package/dist/implement/async/throttle.d.ts.map +1 -0
- package/dist/implement/async/throttle.mjs +18 -0
- package/dist/implement/async/throttle.mjs.map +1 -0
- package/dist/implement/async/timeout.d.ts +7 -0
- package/dist/implement/async/timeout.d.ts.map +1 -0
- package/dist/implement/async/timeout.mjs +16 -0
- package/dist/implement/async/timeout.mjs.map +1 -0
- package/dist/implement/composition/complement.d.ts +7 -0
- package/dist/implement/composition/complement.d.ts.map +1 -0
- package/dist/implement/composition/complement.mjs +7 -0
- package/dist/implement/composition/complement.mjs.map +1 -0
- package/dist/implement/composition/compose.d.ts +16 -0
- package/dist/implement/composition/compose.d.ts.map +1 -0
- package/dist/implement/composition/compose.mjs +7 -0
- package/dist/implement/composition/compose.mjs.map +1 -0
- package/dist/implement/composition/constant.d.ts +6 -0
- package/dist/implement/composition/constant.d.ts.map +1 -0
- package/dist/implement/composition/constant.mjs +7 -0
- package/dist/implement/composition/constant.mjs.map +1 -0
- package/dist/implement/composition/curry.d.ts +32 -0
- package/dist/implement/composition/curry.d.ts.map +1 -0
- package/dist/implement/composition/curry.mjs +8 -0
- package/dist/implement/composition/curry.mjs.map +1 -0
- package/dist/implement/composition/flip.d.ts +10 -0
- package/dist/implement/composition/flip.d.ts.map +1 -0
- package/dist/implement/composition/flip.mjs +10 -0
- package/dist/implement/composition/flip.mjs.map +1 -0
- package/dist/implement/composition/identity.d.ts +6 -0
- package/dist/implement/composition/identity.d.ts.map +1 -0
- package/dist/implement/composition/identity.mjs +7 -0
- package/dist/implement/composition/identity.mjs.map +1 -0
- package/dist/implement/composition/index.d.ts +16 -0
- package/dist/implement/composition/index.d.ts.map +1 -0
- package/dist/implement/composition/memoize.d.ts +7 -0
- package/dist/implement/composition/memoize.d.ts.map +1 -0
- package/dist/implement/composition/memoize.mjs +16 -0
- package/dist/implement/composition/memoize.mjs.map +1 -0
- package/dist/implement/composition/once.d.ts +7 -0
- package/dist/implement/composition/once.d.ts.map +1 -0
- package/dist/implement/composition/once.mjs +10 -0
- package/dist/implement/composition/once.mjs.map +1 -0
- package/dist/implement/composition/partial.d.ts +6 -0
- package/dist/implement/composition/partial.d.ts.map +1 -0
- package/dist/implement/composition/partial.mjs +10 -0
- package/dist/implement/composition/partial.mjs.map +1 -0
- package/dist/implement/composition/pipe.d.ts +13 -0
- package/dist/implement/composition/pipe.d.ts.map +1 -0
- package/dist/implement/composition/pipe.mjs +7 -0
- package/dist/implement/composition/pipe.mjs.map +1 -0
- package/dist/implement/composition/pipe.type-test.d.ts +20 -0
- package/dist/implement/composition/pipe.type-test.d.ts.map +1 -0
- package/dist/implement/composition/pipeSideEffect.d.ts +17 -0
- package/dist/implement/composition/pipeSideEffect.d.ts.map +1 -0
- package/dist/implement/composition/pipeSideEffect.mjs +16 -0
- package/dist/implement/composition/pipeSideEffect.mjs.map +1 -0
- package/dist/implement/composition/sideEffect.d.ts +18 -0
- package/dist/implement/composition/sideEffect.d.ts.map +1 -0
- package/dist/implement/composition/sideEffect.mjs +27 -0
- package/dist/implement/composition/sideEffect.mjs.map +1 -0
- package/dist/implement/composition/tap.d.ts +6 -0
- package/dist/implement/composition/tap.d.ts.map +1 -0
- package/dist/implement/composition/tap.mjs +7 -0
- package/dist/implement/composition/tap.mjs.map +1 -0
- package/dist/implement/control/cond.d.ts +6 -0
- package/dist/implement/control/cond.d.ts.map +1 -0
- package/dist/implement/control/cond.mjs +11 -0
- package/dist/implement/control/cond.mjs.map +1 -0
- package/dist/implement/control/guard.d.ts +8 -0
- package/dist/implement/control/guard.d.ts.map +1 -0
- package/dist/implement/control/guard.mjs +9 -0
- package/dist/implement/control/guard.mjs.map +1 -0
- package/dist/implement/control/ifElse.d.ts +18 -0
- package/dist/implement/control/ifElse.d.ts.map +1 -0
- package/dist/implement/control/ifElse.mjs +9 -0
- package/dist/implement/control/ifElse.mjs.map +1 -0
- package/dist/implement/control/index.d.ts +7 -0
- package/dist/implement/control/index.d.ts.map +1 -0
- package/dist/implement/control/tryCatch.d.ts +12 -0
- package/dist/implement/control/tryCatch.d.ts.map +1 -0
- package/dist/implement/control/tryCatch.mjs +14 -0
- package/dist/implement/control/tryCatch.mjs.map +1 -0
- package/dist/implement/control/unless.d.ts +9 -0
- package/dist/implement/control/unless.d.ts.map +1 -0
- package/dist/implement/control/unless.mjs +9 -0
- package/dist/implement/control/unless.mjs.map +1 -0
- package/dist/implement/control/when.d.ts +9 -0
- package/dist/implement/control/when.d.ts.map +1 -0
- package/dist/implement/control/when.mjs +9 -0
- package/dist/implement/control/when.mjs.map +1 -0
- package/dist/implement/debug/assert.d.ts +6 -0
- package/dist/implement/debug/assert.d.ts.map +1 -0
- package/dist/implement/debug/assert.mjs +10 -0
- package/dist/implement/debug/assert.mjs.map +1 -0
- package/dist/implement/debug/index.d.ts +4 -0
- package/dist/implement/debug/index.d.ts.map +1 -0
- package/dist/implement/debug/invariant.d.ts +6 -0
- package/dist/implement/debug/invariant.d.ts.map +1 -0
- package/dist/implement/debug/invariant.mjs +10 -0
- package/dist/implement/debug/invariant.mjs.map +1 -0
- package/dist/implement/debug/log.d.ts +4 -0
- package/dist/implement/debug/log.d.ts.map +1 -0
- package/dist/implement/debug/log.mjs +7 -0
- package/dist/implement/debug/log.mjs.map +1 -0
- package/dist/implement/equality/clamp.d.ts +7 -0
- package/dist/implement/equality/clamp.d.ts.map +1 -0
- package/dist/implement/equality/clamp.mjs +9 -0
- package/dist/implement/equality/clamp.mjs.map +1 -0
- package/dist/implement/equality/equals.d.ts +6 -0
- package/dist/implement/equality/equals.d.ts.map +1 -0
- package/dist/implement/equality/equals.mjs +59 -0
- package/dist/implement/equality/equals.mjs.map +1 -0
- package/dist/implement/equality/gt.d.ts +4 -0
- package/dist/implement/equality/gt.d.ts.map +1 -0
- package/dist/implement/equality/gt.mjs +7 -0
- package/dist/implement/equality/gt.mjs.map +1 -0
- package/dist/implement/equality/gte.d.ts +4 -0
- package/dist/implement/equality/gte.d.ts.map +1 -0
- package/dist/implement/equality/gte.mjs +7 -0
- package/dist/implement/equality/gte.mjs.map +1 -0
- package/dist/implement/equality/includes.d.ts +4 -0
- package/dist/implement/equality/includes.d.ts.map +1 -0
- package/dist/implement/equality/includes.mjs +15 -0
- package/dist/implement/equality/includes.mjs.map +1 -0
- package/dist/implement/equality/index.d.ts +11 -0
- package/dist/implement/equality/index.d.ts.map +1 -0
- package/dist/implement/equality/isEmpty.d.ts +4 -0
- package/dist/implement/equality/isEmpty.d.ts.map +1 -0
- package/dist/implement/equality/isEmpty.mjs +7 -0
- package/dist/implement/equality/isEmpty.mjs.map +1 -0
- package/dist/implement/equality/isNil.d.ts +4 -0
- package/dist/implement/equality/isNil.d.ts.map +1 -0
- package/dist/implement/equality/isNil.mjs +7 -0
- package/dist/implement/equality/isNil.mjs.map +1 -0
- package/dist/implement/equality/isType.d.ts +4 -0
- package/dist/implement/equality/isType.d.ts.map +1 -0
- package/dist/implement/equality/isType.mjs +13 -0
- package/dist/implement/equality/isType.mjs.map +1 -0
- package/dist/implement/equality/lt.d.ts +4 -0
- package/dist/implement/equality/lt.d.ts.map +1 -0
- package/dist/implement/equality/lt.mjs +7 -0
- package/dist/implement/equality/lt.mjs.map +1 -0
- package/dist/implement/equality/lte.d.ts +4 -0
- package/dist/implement/equality/lte.d.ts.map +1 -0
- package/dist/implement/equality/lte.mjs +7 -0
- package/dist/implement/equality/lte.mjs.map +1 -0
- package/dist/implement/math/add.d.ts +6 -0
- package/dist/implement/math/add.d.ts.map +1 -0
- package/dist/implement/math/add.mjs +9 -0
- package/dist/implement/math/add.mjs.map +1 -0
- package/dist/implement/math/ceil.d.ts +4 -0
- package/dist/implement/math/ceil.d.ts.map +1 -0
- package/dist/implement/math/ceil.mjs +7 -0
- package/dist/implement/math/ceil.mjs.map +1 -0
- package/dist/implement/math/div.d.ts +6 -0
- package/dist/implement/math/div.d.ts.map +1 -0
- package/dist/implement/math/div.mjs +9 -0
- package/dist/implement/math/div.mjs.map +1 -0
- package/dist/implement/math/floor.d.ts +4 -0
- package/dist/implement/math/floor.d.ts.map +1 -0
- package/dist/implement/math/floor.mjs +7 -0
- package/dist/implement/math/floor.mjs.map +1 -0
- package/dist/implement/math/index.d.ts +13 -0
- package/dist/implement/math/index.d.ts.map +1 -0
- package/dist/implement/math/max.d.ts +4 -0
- package/dist/implement/math/max.d.ts.map +1 -0
- package/dist/implement/math/max.mjs +7 -0
- package/dist/implement/math/max.mjs.map +1 -0
- package/dist/implement/math/mean.d.ts +4 -0
- package/dist/implement/math/mean.d.ts.map +1 -0
- package/dist/implement/math/mean.mjs +7 -0
- package/dist/implement/math/mean.mjs.map +1 -0
- package/dist/implement/math/min.d.ts +4 -0
- package/dist/implement/math/min.d.ts.map +1 -0
- package/dist/implement/math/min.mjs +7 -0
- package/dist/implement/math/min.mjs.map +1 -0
- package/dist/implement/math/mul.d.ts +6 -0
- package/dist/implement/math/mul.d.ts.map +1 -0
- package/dist/implement/math/mul.mjs +9 -0
- package/dist/implement/math/mul.mjs.map +1 -0
- package/dist/implement/math/randomInt.d.ts +6 -0
- package/dist/implement/math/randomInt.d.ts.map +1 -0
- package/dist/implement/math/randomInt.mjs +10 -0
- package/dist/implement/math/randomInt.mjs.map +1 -0
- package/dist/implement/math/round.d.ts +4 -0
- package/dist/implement/math/round.d.ts.map +1 -0
- package/dist/implement/math/round.mjs +7 -0
- package/dist/implement/math/round.mjs.map +1 -0
- package/dist/implement/math/sub.d.ts +6 -0
- package/dist/implement/math/sub.d.ts.map +1 -0
- package/dist/implement/math/sub.mjs +9 -0
- package/dist/implement/math/sub.mjs.map +1 -0
- package/dist/implement/math/sum.d.ts +4 -0
- package/dist/implement/math/sum.d.ts.map +1 -0
- package/dist/implement/math/sum.mjs +7 -0
- package/dist/implement/math/sum.mjs.map +1 -0
- package/dist/implement/nullable/fold.d.ts +8 -0
- package/dist/implement/nullable/fold.d.ts.map +1 -0
- package/dist/implement/nullable/fold.mjs +9 -0
- package/dist/implement/nullable/fold.mjs.map +1 -0
- package/dist/implement/nullable/getOrElse.d.ts +4 -0
- package/dist/implement/nullable/getOrElse.d.ts.map +1 -0
- package/dist/implement/nullable/getOrElse.mjs +7 -0
- package/dist/implement/nullable/getOrElse.mjs.map +1 -0
- package/dist/implement/nullable/index.d.ts +6 -0
- package/dist/implement/nullable/index.d.ts.map +1 -0
- package/dist/implement/nullable/mapMaybe.d.ts +4 -0
- package/dist/implement/nullable/mapMaybe.d.ts.map +1 -0
- package/dist/implement/nullable/mapMaybe.mjs +14 -0
- package/dist/implement/nullable/mapMaybe.mjs.map +1 -0
- package/dist/implement/nullable/maybe.d.ts +4 -0
- package/dist/implement/nullable/maybe.d.ts.map +1 -0
- package/dist/implement/nullable/maybe.mjs +7 -0
- package/dist/implement/nullable/maybe.mjs.map +1 -0
- package/dist/implement/nullable/result.d.ts +10 -0
- package/dist/implement/nullable/result.d.ts.map +1 -0
- package/dist/implement/nullable/result.mjs +11 -0
- package/dist/implement/nullable/result.mjs.map +1 -0
- package/dist/implement/object/assoc.d.ts +11 -0
- package/dist/implement/object/assoc.d.ts.map +1 -0
- package/dist/implement/object/assoc.mjs +16 -0
- package/dist/implement/object/assoc.mjs.map +1 -0
- package/dist/implement/object/assoc.type-test.d.ts +30 -0
- package/dist/implement/object/assoc.type-test.d.ts.map +1 -0
- package/dist/implement/object/assocPath.d.ts +9 -0
- package/dist/implement/object/assocPath.d.ts.map +1 -0
- package/dist/implement/object/assocPath.mjs +21 -0
- package/dist/implement/object/assocPath.mjs.map +1 -0
- package/dist/implement/object/dissoc.d.ts +7 -0
- package/dist/implement/object/dissoc.d.ts.map +1 -0
- package/dist/implement/object/dissoc.mjs +15 -0
- package/dist/implement/object/dissoc.mjs.map +1 -0
- package/dist/implement/object/dissocPath.d.ts +8 -0
- package/dist/implement/object/dissocPath.d.ts.map +1 -0
- package/dist/implement/object/dissocPath.mjs +33 -0
- package/dist/implement/object/dissocPath.mjs.map +1 -0
- package/dist/implement/object/entries.d.ts +6 -0
- package/dist/implement/object/entries.d.ts.map +1 -0
- package/dist/implement/object/entries.mjs +7 -0
- package/dist/implement/object/entries.mjs.map +1 -0
- package/dist/implement/object/evolve.d.ts +9 -0
- package/dist/implement/object/evolve.d.ts.map +1 -0
- package/dist/implement/object/evolve.mjs +14 -0
- package/dist/implement/object/evolve.mjs.map +1 -0
- package/dist/implement/object/has.d.ts +7 -0
- package/dist/implement/object/has.d.ts.map +1 -0
- package/dist/implement/object/has.mjs +9 -0
- package/dist/implement/object/has.mjs.map +1 -0
- package/dist/implement/object/hasPath.d.ts +6 -0
- package/dist/implement/object/hasPath.d.ts.map +1 -0
- package/dist/implement/object/hasPath.mjs +15 -0
- package/dist/implement/object/hasPath.mjs.map +1 -0
- package/dist/implement/object/index.d.ts +21 -0
- package/dist/implement/object/index.d.ts.map +1 -0
- package/dist/implement/object/keys.d.ts +6 -0
- package/dist/implement/object/keys.d.ts.map +1 -0
- package/dist/implement/object/keys.mjs +7 -0
- package/dist/implement/object/keys.mjs.map +1 -0
- package/dist/implement/object/mapValues.d.ts +6 -0
- package/dist/implement/object/mapValues.d.ts.map +1 -0
- package/dist/implement/object/mapValues.mjs +12 -0
- package/dist/implement/object/mapValues.mjs.map +1 -0
- package/dist/implement/object/merge.d.ts +7 -0
- package/dist/implement/object/merge.d.ts.map +1 -0
- package/dist/implement/object/merge.mjs +12 -0
- package/dist/implement/object/merge.mjs.map +1 -0
- package/dist/implement/object/mergeAll.d.ts +6 -0
- package/dist/implement/object/mergeAll.d.ts.map +1 -0
- package/dist/implement/object/mergeAll.mjs +10 -0
- package/dist/implement/object/mergeAll.mjs.map +1 -0
- package/dist/implement/object/mergeDeep.d.ts +7 -0
- package/dist/implement/object/mergeDeep.d.ts.map +1 -0
- package/dist/implement/object/mergeDeep.mjs +20 -0
- package/dist/implement/object/mergeDeep.mjs.map +1 -0
- package/dist/implement/object/omit.d.ts +7 -0
- package/dist/implement/object/omit.d.ts.map +1 -0
- package/dist/implement/object/omit.mjs +12 -0
- package/dist/implement/object/omit.mjs.map +1 -0
- package/dist/implement/object/path.d.ts +7 -0
- package/dist/implement/object/path.d.ts.map +1 -0
- package/dist/implement/object/path.mjs +9 -0
- package/dist/implement/object/path.mjs.map +1 -0
- package/dist/implement/object/pathOr.d.ts +8 -0
- package/dist/implement/object/pathOr.d.ts.map +1 -0
- package/dist/implement/object/pathOr.mjs +10 -0
- package/dist/implement/object/pathOr.mjs.map +1 -0
- package/dist/implement/object/pick.d.ts +7 -0
- package/dist/implement/object/pick.d.ts.map +1 -0
- package/dist/implement/object/pick.mjs +12 -0
- package/dist/implement/object/pick.mjs.map +1 -0
- package/dist/implement/object/prop.d.ts +7 -0
- package/dist/implement/object/prop.d.ts.map +1 -0
- package/dist/implement/object/prop.mjs +9 -0
- package/dist/implement/object/prop.mjs.map +1 -0
- package/dist/implement/object/propOr.d.ts +8 -0
- package/dist/implement/object/propOr.d.ts.map +1 -0
- package/dist/implement/object/propOr.mjs +10 -0
- package/dist/implement/object/propOr.mjs.map +1 -0
- package/dist/implement/object/values.d.ts +6 -0
- package/dist/implement/object/values.d.ts.map +1 -0
- package/dist/implement/object/values.mjs +7 -0
- package/dist/implement/object/values.mjs.map +1 -0
- package/dist/implement/string/endsWith.d.ts +5 -0
- package/dist/implement/string/endsWith.d.ts.map +1 -0
- package/dist/implement/string/endsWith.mjs +18 -0
- package/dist/implement/string/endsWith.mjs.map +1 -0
- package/dist/implement/string/index.d.ts +10 -0
- package/dist/implement/string/index.d.ts.map +1 -0
- package/dist/implement/string/join.d.ts +6 -0
- package/dist/implement/string/join.d.ts.map +1 -0
- package/dist/implement/string/join.mjs +9 -0
- package/dist/implement/string/join.mjs.map +1 -0
- package/dist/implement/string/match.d.ts +6 -0
- package/dist/implement/string/match.d.ts.map +1 -0
- package/dist/implement/string/match.mjs +9 -0
- package/dist/implement/string/match.mjs.map +1 -0
- package/dist/implement/string/replace.d.ts +7 -0
- package/dist/implement/string/replace.d.ts.map +1 -0
- package/dist/implement/string/replace.mjs +9 -0
- package/dist/implement/string/replace.mjs.map +1 -0
- package/dist/implement/string/split.d.ts +6 -0
- package/dist/implement/string/split.d.ts.map +1 -0
- package/dist/implement/string/split.mjs +9 -0
- package/dist/implement/string/split.mjs.map +1 -0
- package/dist/implement/string/startsWith.d.ts +5 -0
- package/dist/implement/string/startsWith.d.ts.map +1 -0
- package/dist/implement/string/startsWith.mjs +16 -0
- package/dist/implement/string/startsWith.mjs.map +1 -0
- package/dist/implement/string/toLower.d.ts +4 -0
- package/dist/implement/string/toLower.d.ts.map +1 -0
- package/dist/implement/string/toLower.mjs +7 -0
- package/dist/implement/string/toLower.mjs.map +1 -0
- package/dist/implement/string/toUpper.d.ts +4 -0
- package/dist/implement/string/toUpper.d.ts.map +1 -0
- package/dist/implement/string/toUpper.mjs +7 -0
- package/dist/implement/string/toUpper.mjs.map +1 -0
- package/dist/implement/string/trim.d.ts +4 -0
- package/dist/implement/string/trim.d.ts.map +1 -0
- package/dist/implement/string/trim.mjs +7 -0
- package/dist/implement/string/trim.mjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +247 -0
- package/dist/index.mjs.map +1 -0
- package/dist/skills/fp-pack.md +1644 -0
- package/dist/stream/append.d.ts +8 -0
- package/dist/stream/append.d.ts.map +1 -0
- package/dist/stream/append.mjs +23 -0
- package/dist/stream/append.mjs.map +1 -0
- package/dist/stream/chunk.d.ts +7 -0
- package/dist/stream/chunk.d.ts.map +1 -0
- package/dist/stream/chunk.mjs +37 -0
- package/dist/stream/chunk.mjs.map +1 -0
- package/dist/stream/concat.d.ts +8 -0
- package/dist/stream/concat.d.ts.map +1 -0
- package/dist/stream/concat.mjs +25 -0
- package/dist/stream/concat.mjs.map +1 -0
- package/dist/stream/drop.d.ts +8 -0
- package/dist/stream/drop.d.ts.map +1 -0
- package/dist/stream/drop.mjs +42 -0
- package/dist/stream/drop.mjs.map +1 -0
- package/dist/stream/dropWhile.d.ts +8 -0
- package/dist/stream/dropWhile.d.ts.map +1 -0
- package/dist/stream/dropWhile.mjs +23 -0
- package/dist/stream/dropWhile.mjs.map +1 -0
- package/dist/stream/every.d.ts +8 -0
- package/dist/stream/every.d.ts.map +1 -0
- package/dist/stream/every.mjs +24 -0
- package/dist/stream/every.mjs.map +1 -0
- package/dist/stream/filter.d.ts +8 -0
- package/dist/stream/filter.d.ts.map +1 -0
- package/dist/stream/filter.mjs +21 -0
- package/dist/stream/filter.mjs.map +1 -0
- package/dist/stream/find.d.ts +8 -0
- package/dist/stream/find.d.ts.map +1 -0
- package/dist/stream/find.mjs +23 -0
- package/dist/stream/find.mjs.map +1 -0
- package/dist/stream/flatMap.d.ts +8 -0
- package/dist/stream/flatMap.d.ts.map +1 -0
- package/dist/stream/flatMap.mjs +27 -0
- package/dist/stream/flatMap.mjs.map +1 -0
- package/dist/stream/flatten.d.ts +6 -0
- package/dist/stream/flatten.d.ts.map +1 -0
- package/dist/stream/flatten.mjs +23 -0
- package/dist/stream/flatten.mjs.map +1 -0
- package/dist/stream/flattenDeep.d.ts +6 -0
- package/dist/stream/flattenDeep.d.ts.map +1 -0
- package/dist/stream/flattenDeep.mjs +30 -0
- package/dist/stream/flattenDeep.mjs.map +1 -0
- package/dist/stream/index.d.ts +24 -0
- package/dist/stream/index.d.ts.map +1 -0
- package/dist/stream/index.mjs +49 -0
- package/dist/stream/index.mjs.map +1 -0
- package/dist/stream/map.d.ts +8 -0
- package/dist/stream/map.d.ts.map +1 -0
- package/dist/stream/map.mjs +21 -0
- package/dist/stream/map.mjs.map +1 -0
- package/dist/stream/prepend.d.ts +8 -0
- package/dist/stream/prepend.d.ts.map +1 -0
- package/dist/stream/prepend.mjs +23 -0
- package/dist/stream/prepend.mjs.map +1 -0
- package/dist/stream/range.d.ts +4 -0
- package/dist/stream/range.d.ts.map +1 -0
- package/dist/stream/range.mjs +17 -0
- package/dist/stream/range.mjs.map +1 -0
- package/dist/stream/reduce.d.ts +8 -0
- package/dist/stream/reduce.d.ts.map +1 -0
- package/dist/stream/reduce.mjs +24 -0
- package/dist/stream/reduce.mjs.map +1 -0
- package/dist/stream/scan.d.ts +8 -0
- package/dist/stream/scan.d.ts.map +1 -0
- package/dist/stream/scan.mjs +23 -0
- package/dist/stream/scan.mjs.map +1 -0
- package/dist/stream/some.d.ts +8 -0
- package/dist/stream/some.d.ts.map +1 -0
- package/dist/stream/some.mjs +24 -0
- package/dist/stream/some.mjs.map +1 -0
- package/dist/stream/take.d.ts +8 -0
- package/dist/stream/take.d.ts.map +1 -0
- package/dist/stream/take.mjs +30 -0
- package/dist/stream/take.mjs.map +1 -0
- package/dist/stream/takeWhile.d.ts +8 -0
- package/dist/stream/takeWhile.d.ts.map +1 -0
- package/dist/stream/takeWhile.mjs +27 -0
- package/dist/stream/takeWhile.mjs.map +1 -0
- package/dist/stream/toArray.d.ts +5 -0
- package/dist/stream/toArray.d.ts.map +1 -0
- package/dist/stream/toArray.mjs +19 -0
- package/dist/stream/toArray.mjs.map +1 -0
- package/dist/stream/toAsync.d.ts +6 -0
- package/dist/stream/toAsync.d.ts.map +1 -0
- package/dist/stream/toAsync.mjs +21 -0
- package/dist/stream/toAsync.mjs.map +1 -0
- package/dist/stream/utils.d.ts +12 -0
- package/dist/stream/utils.d.ts.map +1 -0
- package/dist/stream/utils.mjs +10 -0
- package/dist/stream/utils.mjs.map +1 -0
- package/dist/stream/zip.d.ts +8 -0
- package/dist/stream/zip.d.ts.map +1 -0
- package/dist/stream/zip.mjs +31 -0
- package/dist/stream/zip.mjs.map +1 -0
- package/dist/stream/zipWith.d.ts +8 -0
- package/dist/stream/zipWith.d.ts.map +1 -0
- package/dist/stream/zipWith.mjs +31 -0
- package/dist/stream/zipWith.mjs.map +1 -0
- package/package.json +87 -0
- package/src/implement/array/append.test.ts +13 -0
- package/src/implement/array/append.ts +16 -0
- package/src/implement/array/chunk.test.ts +23 -0
- package/src/implement/array/chunk.ts +25 -0
- package/src/implement/array/concat.test.ts +13 -0
- package/src/implement/array/concat.ts +16 -0
- package/src/implement/array/curried.test.ts +91 -0
- package/src/implement/array/drop.test.ts +22 -0
- package/src/implement/array/drop.ts +20 -0
- package/src/implement/array/dropWhile.test.ts +13 -0
- package/src/implement/array/dropWhile.ts +26 -0
- package/src/implement/array/every.test.ts +16 -0
- package/src/implement/array/every.ts +16 -0
- package/src/implement/array/filter.test.ts +16 -0
- package/src/implement/array/filter.ts +16 -0
- package/src/implement/array/find.test.ts +16 -0
- package/src/implement/array/find.ts +16 -0
- package/src/implement/array/flatMap.test.ts +13 -0
- package/src/implement/array/flatMap.ts +16 -0
- package/src/implement/array/flatten.test.ts +8 -0
- package/src/implement/array/flatten.ts +8 -0
- package/src/implement/array/flattenDeep.test.ts +13 -0
- package/src/implement/array/flattenDeep.ts +21 -0
- package/src/implement/array/groupBy.test.ts +13 -0
- package/src/implement/array/groupBy.ts +23 -0
- package/src/implement/array/head.test.ts +12 -0
- package/src/implement/array/head.ts +8 -0
- package/src/implement/array/index.ts +33 -0
- package/src/implement/array/init.test.ts +13 -0
- package/src/implement/array/init.ts +9 -0
- package/src/implement/array/last.test.ts +12 -0
- package/src/implement/array/last.ts +9 -0
- package/src/implement/array/map.test.ts +12 -0
- package/src/implement/array/map.ts +16 -0
- package/src/implement/array/partition.test.ts +14 -0
- package/src/implement/array/partition.ts +27 -0
- package/src/implement/array/prepend.test.ts +13 -0
- package/src/implement/array/prepend.ts +16 -0
- package/src/implement/array/range.test.ts +16 -0
- package/src/implement/array/range.ts +18 -0
- package/src/implement/array/reduce.test.ts +25 -0
- package/src/implement/array/reduce.ts +21 -0
- package/src/implement/array/scan.test.ts +13 -0
- package/src/implement/array/scan.ts +23 -0
- package/src/implement/array/some.test.ts +25 -0
- package/src/implement/array/some.ts +19 -0
- package/src/implement/array/sort.test.ts +25 -0
- package/src/implement/array/sort.ts +16 -0
- package/src/implement/array/sortBy.test.ts +28 -0
- package/src/implement/array/sortBy.ts +22 -0
- package/src/implement/array/tail.test.ts +13 -0
- package/src/implement/array/tail.ts +8 -0
- package/src/implement/array/take.test.ts +20 -0
- package/src/implement/array/take.ts +18 -0
- package/src/implement/array/takeWhile.test.ts +13 -0
- package/src/implement/array/takeWhile.ts +23 -0
- package/src/implement/array/uniq.test.ts +18 -0
- package/src/implement/array/uniq.ts +16 -0
- package/src/implement/array/uniqBy.test.ts +22 -0
- package/src/implement/array/uniqBy.ts +25 -0
- package/src/implement/array/unzip.test.ts +22 -0
- package/src/implement/array/unzip.ts +16 -0
- package/src/implement/array/zip.test.ts +16 -0
- package/src/implement/array/zip.ts +23 -0
- package/src/implement/array/zipIndex.test.ts +16 -0
- package/src/implement/array/zipIndex.ts +8 -0
- package/src/implement/array/zipWith.test.ts +13 -0
- package/src/implement/array/zipWith.ts +22 -0
- package/src/implement/async/curried.test.ts +133 -0
- package/src/implement/async/debounce.test.ts +21 -0
- package/src/implement/async/debounce.ts +26 -0
- package/src/implement/async/debounceLeading.test.ts +24 -0
- package/src/implement/async/debounceLeading.ts +25 -0
- package/src/implement/async/debounceLeadingTrailing.test.ts +37 -0
- package/src/implement/async/debounceLeadingTrailing.ts +41 -0
- package/src/implement/async/delay.test.ts +22 -0
- package/src/implement/async/delay.ts +7 -0
- package/src/implement/async/index.ts +9 -0
- package/src/implement/async/pipeAsync.test.ts +23 -0
- package/src/implement/async/pipeAsync.ts +48 -0
- package/src/implement/async/pipeAsyncSideEffect.test.ts +23 -0
- package/src/implement/async/pipeAsyncSideEffect.ts +68 -0
- package/src/implement/async/retry.test.ts +49 -0
- package/src/implement/async/retry.ts +27 -0
- package/src/implement/async/throttle.test.ts +38 -0
- package/src/implement/async/throttle.ts +47 -0
- package/src/implement/async/timeout.test.ts +20 -0
- package/src/implement/async/timeout.ts +24 -0
- package/src/implement/composition/complement.test.ts +17 -0
- package/src/implement/composition/complement.ts +13 -0
- package/src/implement/composition/compose.test.ts +30 -0
- package/src/implement/composition/compose.ts +48 -0
- package/src/implement/composition/constant.test.ts +16 -0
- package/src/implement/composition/constant.ts +8 -0
- package/src/implement/composition/curry.test.ts +31 -0
- package/src/implement/composition/curry.ts +71 -0
- package/src/implement/composition/flip.test.ts +41 -0
- package/src/implement/composition/flip.ts +16 -0
- package/src/implement/composition/identity.test.ts +14 -0
- package/src/implement/composition/identity.ts +8 -0
- package/src/implement/composition/index.ts +15 -0
- package/src/implement/composition/memoize.test.ts +46 -0
- package/src/implement/composition/memoize.ts +31 -0
- package/src/implement/composition/once.test.ts +30 -0
- package/src/implement/composition/once.ts +21 -0
- package/src/implement/composition/partial.test.ts +25 -0
- package/src/implement/composition/partial.ts +14 -0
- package/src/implement/composition/pipe.test.ts +31 -0
- package/src/implement/composition/pipe.ts +39 -0
- package/src/implement/composition/pipe.type-test.ts +54 -0
- package/src/implement/composition/pipeSideEffect.test.ts +23 -0
- package/src/implement/composition/pipeSideEffect.ts +60 -0
- package/src/implement/composition/sideEffect.test.ts +43 -0
- package/src/implement/composition/sideEffect.ts +44 -0
- package/src/implement/composition/tap.test.ts +17 -0
- package/src/implement/composition/tap.ts +11 -0
- package/src/implement/control/cond.test.ts +33 -0
- package/src/implement/control/cond.ts +17 -0
- package/src/implement/control/curried.test.ts +71 -0
- package/src/implement/control/guard.test.ts +17 -0
- package/src/implement/control/guard.ts +27 -0
- package/src/implement/control/ifElse.test.ts +68 -0
- package/src/implement/control/ifElse.ts +40 -0
- package/src/implement/control/index.ts +6 -0
- package/src/implement/control/tryCatch.test.ts +35 -0
- package/src/implement/control/tryCatch.ts +36 -0
- package/src/implement/control/unless.test.ts +22 -0
- package/src/implement/control/unless.ts +29 -0
- package/src/implement/control/when.test.ts +22 -0
- package/src/implement/control/when.ts +29 -0
- package/src/implement/debug/assert.test.ts +16 -0
- package/src/implement/debug/assert.ts +9 -0
- package/src/implement/debug/curried.test.ts +17 -0
- package/src/implement/debug/index.ts +3 -0
- package/src/implement/debug/invariant.test.ts +16 -0
- package/src/implement/debug/invariant.ts +9 -0
- package/src/implement/debug/log.test.ts +20 -0
- package/src/implement/debug/log.ts +12 -0
- package/src/implement/equality/clamp.test.ts +16 -0
- package/src/implement/equality/clamp.ts +9 -0
- package/src/implement/equality/curried.test.ts +13 -0
- package/src/implement/equality/equals.test.ts +63 -0
- package/src/implement/equality/equals.ts +87 -0
- package/src/implement/equality/gt.test.ts +13 -0
- package/src/implement/equality/gt.ts +5 -0
- package/src/implement/equality/gte.test.ts +13 -0
- package/src/implement/equality/gte.ts +5 -0
- package/src/implement/equality/includes.test.ts +16 -0
- package/src/implement/equality/includes.ts +21 -0
- package/src/implement/equality/index.ts +10 -0
- package/src/implement/equality/isEmpty.test.ts +24 -0
- package/src/implement/equality/isEmpty.ts +19 -0
- package/src/implement/equality/isNil.test.ts +16 -0
- package/src/implement/equality/isNil.ts +5 -0
- package/src/implement/equality/isType.test.ts +28 -0
- package/src/implement/equality/isType.ts +13 -0
- package/src/implement/equality/lt.test.ts +13 -0
- package/src/implement/equality/lt.ts +5 -0
- package/src/implement/equality/lte.test.ts +13 -0
- package/src/implement/equality/lte.ts +5 -0
- package/src/implement/math/add.test.ts +9 -0
- package/src/implement/math/add.ts +7 -0
- package/src/implement/math/ceil.test.ts +10 -0
- package/src/implement/math/ceil.ts +5 -0
- package/src/implement/math/curried.test.ts +30 -0
- package/src/implement/math/div.test.ts +9 -0
- package/src/implement/math/div.ts +7 -0
- package/src/implement/math/floor.test.ts +10 -0
- package/src/implement/math/floor.ts +5 -0
- package/src/implement/math/index.ts +12 -0
- package/src/implement/math/max.test.ts +13 -0
- package/src/implement/math/max.ts +6 -0
- package/src/implement/math/mean.test.ts +12 -0
- package/src/implement/math/mean.ts +7 -0
- package/src/implement/math/min.test.ts +12 -0
- package/src/implement/math/min.ts +6 -0
- package/src/implement/math/mul.test.ts +9 -0
- package/src/implement/math/mul.ts +7 -0
- package/src/implement/math/randomInt.test.ts +22 -0
- package/src/implement/math/randomInt.ts +14 -0
- package/src/implement/math/round.test.ts +10 -0
- package/src/implement/math/round.ts +5 -0
- package/src/implement/math/sub.test.ts +9 -0
- package/src/implement/math/sub.ts +7 -0
- package/src/implement/math/sum.test.ts +10 -0
- package/src/implement/math/sum.ts +5 -0
- package/src/implement/nullable/curried.test.ts +13 -0
- package/src/implement/nullable/fold.test.ts +31 -0
- package/src/implement/nullable/fold.ts +27 -0
- package/src/implement/nullable/getOrElse.test.ts +17 -0
- package/src/implement/nullable/getOrElse.ts +10 -0
- package/src/implement/nullable/index.ts +5 -0
- package/src/implement/nullable/mapMaybe.test.ts +23 -0
- package/src/implement/nullable/mapMaybe.ts +18 -0
- package/src/implement/nullable/maybe.test.ts +15 -0
- package/src/implement/nullable/maybe.ts +10 -0
- package/src/implement/nullable/result.test.ts +17 -0
- package/src/implement/nullable/result.ts +10 -0
- package/src/implement/object/assoc.test.ts +27 -0
- package/src/implement/object/assoc.ts +43 -0
- package/src/implement/object/assoc.type-test.ts +38 -0
- package/src/implement/object/assocPath.test.ts +33 -0
- package/src/implement/object/assocPath.ts +64 -0
- package/src/implement/object/curried.test.ts +49 -0
- package/src/implement/object/dissoc.test.ts +20 -0
- package/src/implement/object/dissoc.ts +26 -0
- package/src/implement/object/dissocPath.test.ts +18 -0
- package/src/implement/object/dissocPath.ts +80 -0
- package/src/implement/object/entries.test.ts +12 -0
- package/src/implement/object/entries.ts +8 -0
- package/src/implement/object/evolve.test.ts +14 -0
- package/src/implement/object/evolve.ts +31 -0
- package/src/implement/object/has.test.ts +10 -0
- package/src/implement/object/has.ts +16 -0
- package/src/implement/object/hasPath.test.ts +13 -0
- package/src/implement/object/hasPath.ts +17 -0
- package/src/implement/object/index.ts +20 -0
- package/src/implement/object/keys.test.ts +9 -0
- package/src/implement/object/keys.ts +8 -0
- package/src/implement/object/mapValues.test.ts +11 -0
- package/src/implement/object/mapValues.ts +16 -0
- package/src/implement/object/merge.test.ts +22 -0
- package/src/implement/object/merge.ts +19 -0
- package/src/implement/object/mergeAll.test.ts +13 -0
- package/src/implement/object/mergeAll.ts +12 -0
- package/src/implement/object/mergeDeep.test.ts +11 -0
- package/src/implement/object/mergeDeep.ts +41 -0
- package/src/implement/object/omit.test.ts +12 -0
- package/src/implement/object/omit.ts +20 -0
- package/src/implement/object/path.test.ts +9 -0
- package/src/implement/object/path.ts +16 -0
- package/src/implement/object/pathOr.test.ts +15 -0
- package/src/implement/object/pathOr.ts +18 -0
- package/src/implement/object/pick.test.ts +12 -0
- package/src/implement/object/pick.ts +22 -0
- package/src/implement/object/prop.test.ts +9 -0
- package/src/implement/object/prop.ts +16 -0
- package/src/implement/object/propOr.test.ts +15 -0
- package/src/implement/object/propOr.ts +22 -0
- package/src/implement/object/values.test.ts +9 -0
- package/src/implement/object/values.ts +8 -0
- package/src/implement/string/curried.test.ts +21 -0
- package/src/implement/string/endsWith.test.ts +23 -0
- package/src/implement/string/endsWith.ts +21 -0
- package/src/implement/string/index.ts +9 -0
- package/src/implement/string/join.test.ts +16 -0
- package/src/implement/string/join.ts +7 -0
- package/src/implement/string/match.test.ts +13 -0
- package/src/implement/string/match.ts +7 -0
- package/src/implement/string/replace.test.ts +12 -0
- package/src/implement/string/replace.ts +7 -0
- package/src/implement/string/split.test.ts +12 -0
- package/src/implement/string/split.ts +7 -0
- package/src/implement/string/startsWith.test.ts +21 -0
- package/src/implement/string/startsWith.ts +20 -0
- package/src/implement/string/toLower.test.ts +13 -0
- package/src/implement/string/toLower.ts +5 -0
- package/src/implement/string/toUpper.test.ts +13 -0
- package/src/implement/string/toUpper.ts +5 -0
- package/src/implement/string/trim.test.ts +12 -0
- package/src/implement/string/trim.ts +5 -0
- package/src/index.ts +32 -0
- package/src/stream/append.test.ts +20 -0
- package/src/stream/append.ts +39 -0
- package/src/stream/chunk.test.ts +62 -0
- package/src/stream/chunk.ts +74 -0
- package/src/stream/concat.test.ts +20 -0
- package/src/stream/concat.ts +43 -0
- package/src/stream/drop.test.ts +19 -0
- package/src/stream/drop.ts +59 -0
- package/src/stream/dropWhile.test.ts +20 -0
- package/src/stream/dropWhile.ts +51 -0
- package/src/stream/every.test.ts +19 -0
- package/src/stream/every.ts +46 -0
- package/src/stream/filter.test.ts +19 -0
- package/src/stream/filter.ts +46 -0
- package/src/stream/find.test.ts +18 -0
- package/src/stream/find.ts +43 -0
- package/src/stream/flatMap.test.ts +20 -0
- package/src/stream/flatMap.ts +48 -0
- package/src/stream/flatten.test.ts +17 -0
- package/src/stream/flatten.ts +33 -0
- package/src/stream/flattenDeep.test.ts +17 -0
- package/src/stream/flattenDeep.ts +41 -0
- package/src/stream/index.ts +23 -0
- package/src/stream/map.test.ts +19 -0
- package/src/stream/map.ts +39 -0
- package/src/stream/pipeAsync.test.ts +27 -0
- package/src/stream/prepend.test.ts +20 -0
- package/src/stream/prepend.ts +39 -0
- package/src/stream/range.test.ts +16 -0
- package/src/stream/range.ts +20 -0
- package/src/stream/reduce.test.ts +18 -0
- package/src/stream/reduce.ts +47 -0
- package/src/stream/scan.test.ts +22 -0
- package/src/stream/scan.ts +49 -0
- package/src/stream/some.test.ts +19 -0
- package/src/stream/some.ts +46 -0
- package/src/stream/take.test.ts +19 -0
- package/src/stream/take.ts +51 -0
- package/src/stream/takeWhile.test.ts +20 -0
- package/src/stream/takeWhile.ts +45 -0
- package/src/stream/toArray.test.ts +19 -0
- package/src/stream/toArray.ts +26 -0
- package/src/stream/toAsync.test.ts +11 -0
- package/src/stream/toAsync.ts +30 -0
- package/src/stream/utils.ts +30 -0
- package/src/stream/zip.test.ts +29 -0
- package/src/stream/zip.ts +56 -0
- package/src/stream/zipWith.test.ts +22 -0
- package/src/stream/zipWith.ts +62 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** flatMap - lazy map + flatten */
|
|
6
|
+
function flatMap<T, R>(fn: (value: T) => Iterable<R>): (iterable: Iterable<T>) => IterableIterator<R>;
|
|
7
|
+
function flatMap<T, R>(
|
|
8
|
+
fn: (value: T) => Iterable<R> | Promise<Iterable<R>>
|
|
9
|
+
): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => AsyncIterableIterator<R>;
|
|
10
|
+
function flatMap<T, R>(fn: (value: T) => Iterable<R>, iterable: Iterable<T>): IterableIterator<R>;
|
|
11
|
+
function flatMap<T, R>(
|
|
12
|
+
fn: (value: T) => Iterable<R> | Promise<Iterable<R>>,
|
|
13
|
+
iterable: AnyIterableInput<PromiseLikeValue<T>>
|
|
14
|
+
): AsyncIterableIterator<R>;
|
|
15
|
+
function flatMap<T, R>(
|
|
16
|
+
fn: (value: T) => Iterable<R> | Promise<Iterable<R>>,
|
|
17
|
+
iterable?: AnyIterableInput<PromiseLikeValue<T>>
|
|
18
|
+
): any {
|
|
19
|
+
if (iterable === undefined) {
|
|
20
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => flatMap(fn, next);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (isAsyncInput(iterable)) {
|
|
24
|
+
return (async function* () {
|
|
25
|
+
for await (const item of toAsync(iterable)) {
|
|
26
|
+
const mapped = await fn(item as T);
|
|
27
|
+
for (const inner of mapped) {
|
|
28
|
+
yield inner;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (isIterable(iterable)) {
|
|
35
|
+
return (function* () {
|
|
36
|
+
for (const item of iterable) {
|
|
37
|
+
const mapped = fn(item as T) as Iterable<R>;
|
|
38
|
+
for (const inner of mapped) {
|
|
39
|
+
yield inner;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw new TypeError('flatMap: input is not iterable');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default flatMap;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import flatten from './flatten';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream flatten', () => {
|
|
6
|
+
it('flattens sync iterables', () => {
|
|
7
|
+
const result = Array.from(flatten([[1, 2], [3]]));
|
|
8
|
+
expect(result).toEqual([1, 2, 3]);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('flattens async inputs', async () => {
|
|
12
|
+
const result = await toArray(
|
|
13
|
+
flatten(Promise.resolve([[1, 2], [3]]))
|
|
14
|
+
);
|
|
15
|
+
expect(result).toEqual([1, 2, 3]);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { awaitValue, isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** flatten - lazily flatten iterable of iterables */
|
|
6
|
+
function flatten<T>(iterable: Iterable<Iterable<T>>): IterableIterator<T>;
|
|
7
|
+
function flatten<T>(iterable: AnyIterableInput<PromiseLikeValue<Iterable<T>>>): AsyncIterableIterator<T>;
|
|
8
|
+
function flatten<T>(iterable: AnyIterableInput<PromiseLikeValue<Iterable<T>>>): any {
|
|
9
|
+
if (isAsyncInput(iterable)) {
|
|
10
|
+
return (async function* () {
|
|
11
|
+
for await (const inner of toAsync(iterable)) {
|
|
12
|
+
const resolved = await awaitValue(inner as PromiseLikeValue<Iterable<T>>);
|
|
13
|
+
for (const item of resolved) {
|
|
14
|
+
yield item as T;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
})();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isIterable(iterable)) {
|
|
21
|
+
return (function* () {
|
|
22
|
+
for (const inner of iterable as Iterable<Iterable<T>>) {
|
|
23
|
+
for (const item of inner) {
|
|
24
|
+
yield item as T;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
throw new TypeError('flatten: input is not iterable');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default flatten;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import flattenDeep from './flattenDeep';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream flattenDeep', () => {
|
|
6
|
+
it('flattens sync iterables deeply', () => {
|
|
7
|
+
const result = Array.from(flattenDeep([1, [2, [3, 4], 5], [[6]]]));
|
|
8
|
+
expect(result).toEqual([1, 2, 3, 4, 5, 6]);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('flattens async inputs deeply', async () => {
|
|
12
|
+
const result = await toArray(
|
|
13
|
+
flattenDeep(Promise.resolve([1, [2, [3]], [[4]]]))
|
|
14
|
+
);
|
|
15
|
+
expect(result).toEqual([1, 2, 3, 4]);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { awaitValue, isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** flattenDeep - lazily flatten nested iterables */
|
|
6
|
+
function flattenDeep<T>(iterable: Iterable<unknown>): IterableIterator<T>;
|
|
7
|
+
function flattenDeep<T>(iterable: AnyIterableInput<PromiseLikeValue<unknown>>): AsyncIterableIterator<T>;
|
|
8
|
+
function flattenDeep<T>(iterable: AnyIterableInput<PromiseLikeValue<unknown>>): any {
|
|
9
|
+
const walkSync = function* (value: unknown): IterableIterator<T> {
|
|
10
|
+
if (isIterable(value)) {
|
|
11
|
+
for (const item of value as Iterable<unknown>) {
|
|
12
|
+
yield* walkSync(item);
|
|
13
|
+
}
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
yield value as T;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (isAsyncInput(iterable)) {
|
|
20
|
+
return (async function* () {
|
|
21
|
+
for await (const item of toAsync(iterable)) {
|
|
22
|
+
const resolved = await awaitValue(item as PromiseLikeValue<unknown>);
|
|
23
|
+
for (const inner of walkSync(resolved)) {
|
|
24
|
+
yield inner as T;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (isIterable(iterable)) {
|
|
31
|
+
return (function* () {
|
|
32
|
+
for (const item of iterable as Iterable<unknown>) {
|
|
33
|
+
yield* walkSync(item);
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
throw new TypeError('flattenDeep: input is not iterable');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default flattenDeep;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { default as append } from './append';
|
|
2
|
+
export { default as chunk } from './chunk';
|
|
3
|
+
export { default as concat } from './concat';
|
|
4
|
+
export { default as drop } from './drop';
|
|
5
|
+
export { default as dropWhile } from './dropWhile';
|
|
6
|
+
export { default as every } from './every';
|
|
7
|
+
export { default as filter } from './filter';
|
|
8
|
+
export { default as find } from './find';
|
|
9
|
+
export { default as flatMap } from './flatMap';
|
|
10
|
+
export { default as flatten } from './flatten';
|
|
11
|
+
export { default as flattenDeep } from './flattenDeep';
|
|
12
|
+
export { default as map } from './map';
|
|
13
|
+
export { default as prepend } from './prepend';
|
|
14
|
+
export { default as range } from './range';
|
|
15
|
+
export { default as reduce } from './reduce';
|
|
16
|
+
export { default as scan } from './scan';
|
|
17
|
+
export { default as some } from './some';
|
|
18
|
+
export { default as take } from './take';
|
|
19
|
+
export { default as takeWhile } from './takeWhile';
|
|
20
|
+
export { default as toArray } from './toArray';
|
|
21
|
+
export { default as toAsync } from './toAsync';
|
|
22
|
+
export { default as zip } from './zip';
|
|
23
|
+
export { default as zipWith } from './zipWith';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import map from './map';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream map', () => {
|
|
6
|
+
it('maps sync iterables', () => {
|
|
7
|
+
expect(Array.from(map((n: number) => n * 2, [1, 2, 3]))).toEqual([2, 4, 6]);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('supports data-last usage', () => {
|
|
11
|
+
const mapper = map((n: number) => n + 1);
|
|
12
|
+
expect(Array.from(mapper([1, 2]))).toEqual([2, 3]);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('maps async inputs', async () => {
|
|
16
|
+
const result = await toArray(map(async (n: number) => n * 3, Promise.resolve([1, 2])));
|
|
17
|
+
expect(result).toEqual([3, 6]);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** map - lazy map over iterables */
|
|
6
|
+
function map<T, R>(fn: (value: T) => R): (iterable: Iterable<T>) => IterableIterator<R>;
|
|
7
|
+
function map<T, R>(
|
|
8
|
+
fn: (value: T) => R | Promise<R>
|
|
9
|
+
): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => AsyncIterableIterator<R>;
|
|
10
|
+
function map<T, R>(fn: (value: T) => R, iterable: Iterable<T>): IterableIterator<R>;
|
|
11
|
+
function map<T, R>(
|
|
12
|
+
fn: (value: T) => R | Promise<R>,
|
|
13
|
+
iterable: AnyIterableInput<PromiseLikeValue<T>>
|
|
14
|
+
): AsyncIterableIterator<R>;
|
|
15
|
+
function map<T, R>(fn: (value: T) => R | Promise<R>, iterable?: AnyIterableInput<PromiseLikeValue<T>>): any {
|
|
16
|
+
if (iterable === undefined) {
|
|
17
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => map(fn, next);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isAsyncInput(iterable)) {
|
|
21
|
+
return (async function* () {
|
|
22
|
+
for await (const item of toAsync(iterable)) {
|
|
23
|
+
yield await fn(item as T);
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (isIterable(iterable)) {
|
|
29
|
+
return (function* () {
|
|
30
|
+
for (const item of iterable) {
|
|
31
|
+
yield fn(item as T) as R;
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
throw new TypeError('map: input is not iterable');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default map;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import pipeAsync from '../implement/async/pipeAsync';
|
|
3
|
+
import chunk from './chunk';
|
|
4
|
+
import toArray from './toArray';
|
|
5
|
+
import toAsync from './toAsync';
|
|
6
|
+
|
|
7
|
+
describe('stream pipeAsync integration', () => {
|
|
8
|
+
it('pipes sync input through chunk/toArray', async () => {
|
|
9
|
+
const result = await pipeAsync(chunk(2), toArray)([1, 2, 3, 4]);
|
|
10
|
+
expect(result).toEqual([[1, 2], [3, 4]]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('pipes promise input through chunk/toArray', async () => {
|
|
14
|
+
const result = await pipeAsync(chunk(2), toArray)(Promise.resolve([1, 2, 3, 4]));
|
|
15
|
+
expect(result).toEqual([[1, 2], [3, 4]]);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('pipes async values via toAsync', async () => {
|
|
19
|
+
const result = await pipeAsync(toAsync, chunk(2), toArray)([
|
|
20
|
+
Promise.resolve(1),
|
|
21
|
+
Promise.resolve(2),
|
|
22
|
+
Promise.resolve(3),
|
|
23
|
+
Promise.resolve(4),
|
|
24
|
+
]);
|
|
25
|
+
expect(result).toEqual([[1, 2], [3, 4]]);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import prepend from './prepend';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream prepend', () => {
|
|
6
|
+
it('prepends sync iterables', () => {
|
|
7
|
+
const result = Array.from(prepend(0, [1, 2]));
|
|
8
|
+
expect(result).toEqual([0, 1, 2]);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('supports data-last usage', () => {
|
|
12
|
+
const addHead = prepend(-1);
|
|
13
|
+
expect(Array.from(addHead([1, 2]))).toEqual([-1, 1, 2]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('prepends async inputs', async () => {
|
|
17
|
+
const result = await toArray(prepend(Promise.resolve(0), Promise.resolve([1, 2])));
|
|
18
|
+
expect(result).toEqual([0, 1, 2]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { awaitValue, isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** prepend - lazily prepend a value to the start */
|
|
6
|
+
function prepend<T>(value: T): (iterable: Iterable<T>) => IterableIterator<T>;
|
|
7
|
+
function prepend<T>(value: PromiseLikeValue<T>): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => AsyncIterableIterator<T>;
|
|
8
|
+
function prepend<T>(value: T, iterable: Iterable<T>): IterableIterator<T>;
|
|
9
|
+
function prepend<T>(
|
|
10
|
+
value: PromiseLikeValue<T>,
|
|
11
|
+
iterable: AnyIterableInput<PromiseLikeValue<T>>
|
|
12
|
+
): AsyncIterableIterator<T>;
|
|
13
|
+
function prepend<T>(value: PromiseLikeValue<T>, iterable?: AnyIterableInput<PromiseLikeValue<T>>): any {
|
|
14
|
+
if (iterable === undefined) {
|
|
15
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => prepend(value, next);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (isAsyncInput(iterable)) {
|
|
19
|
+
return (async function* () {
|
|
20
|
+
yield await awaitValue(value);
|
|
21
|
+
for await (const item of toAsync(iterable)) {
|
|
22
|
+
yield item as T;
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (isIterable(iterable)) {
|
|
28
|
+
return (function* () {
|
|
29
|
+
yield value as T;
|
|
30
|
+
for (const item of iterable) {
|
|
31
|
+
yield item as T;
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
throw new TypeError('prepend: input is not iterable');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default prepend;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import range from './range';
|
|
3
|
+
|
|
4
|
+
describe('stream range', () => {
|
|
5
|
+
it('creates an ascending range excluding end', () => {
|
|
6
|
+
expect(Array.from(range(0, 4))).toEqual([0, 1, 2, 3]);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('creates a descending range excluding end', () => {
|
|
10
|
+
expect(Array.from(range(4, 0))).toEqual([4, 3, 2, 1]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('returns empty when start equals end', () => {
|
|
14
|
+
expect(Array.from(range(2, 2))).toEqual([]);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** range - lazily generate a numeric range (end excluded) */
|
|
2
|
+
function range(start: number, end: number): IterableIterator<number> {
|
|
3
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) {
|
|
4
|
+
return (function* () {})();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
if (start === end) {
|
|
8
|
+
return (function* () {})();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const step = start < end ? 1 : -1;
|
|
12
|
+
|
|
13
|
+
return (function* () {
|
|
14
|
+
for (let value = start; step > 0 ? value < end : value > end; value += step) {
|
|
15
|
+
yield value;
|
|
16
|
+
}
|
|
17
|
+
})();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default range;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import reduce from './reduce';
|
|
3
|
+
|
|
4
|
+
describe('stream reduce', () => {
|
|
5
|
+
it('reduces sync iterables', () => {
|
|
6
|
+
expect(reduce((acc: number, n: number) => acc + n, 0, [1, 2, 3])).toBe(6);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('supports data-last usage', () => {
|
|
10
|
+
const sum = reduce((acc: number, n: number) => acc + n, 0);
|
|
11
|
+
expect(sum([4, 5])).toBe(9);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('reduces async inputs', async () => {
|
|
15
|
+
const result = await reduce(async (acc: number, n: number) => acc + n, 0, Promise.resolve([2, 4]));
|
|
16
|
+
expect(result).toBe(6);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** reduce - fold values into an accumulator */
|
|
6
|
+
function reduce<T, R>(fn: (acc: R, value: T) => R, initial: R): (iterable: Iterable<T>) => R;
|
|
7
|
+
function reduce<T, R>(
|
|
8
|
+
fn: (acc: R, value: T) => R | Promise<R>,
|
|
9
|
+
initial: R
|
|
10
|
+
): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => Promise<R>;
|
|
11
|
+
function reduce<T, R>(fn: (acc: R, value: T) => R, initial: R, iterable: Iterable<T>): R;
|
|
12
|
+
function reduce<T, R>(
|
|
13
|
+
fn: (acc: R, value: T) => R | Promise<R>,
|
|
14
|
+
initial: R,
|
|
15
|
+
iterable: AnyIterableInput<PromiseLikeValue<T>>
|
|
16
|
+
): Promise<R>;
|
|
17
|
+
function reduce<T, R>(
|
|
18
|
+
fn: (acc: R, value: T) => R | Promise<R>,
|
|
19
|
+
initial: R,
|
|
20
|
+
iterable?: AnyIterableInput<PromiseLikeValue<T>>
|
|
21
|
+
) {
|
|
22
|
+
if (iterable === undefined) {
|
|
23
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => reduce(fn, initial, next);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (isAsyncInput(iterable)) {
|
|
27
|
+
return (async () => {
|
|
28
|
+
let acc = initial;
|
|
29
|
+
for await (const item of toAsync(iterable)) {
|
|
30
|
+
acc = await fn(acc, item as T);
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (isIterable(iterable)) {
|
|
37
|
+
let acc = initial;
|
|
38
|
+
for (const item of iterable) {
|
|
39
|
+
acc = fn(acc, item as T) as R;
|
|
40
|
+
}
|
|
41
|
+
return acc;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
throw new TypeError('reduce: input is not iterable');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default reduce;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import scan from './scan';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream scan', () => {
|
|
6
|
+
it('scans sync iterables', () => {
|
|
7
|
+
const result = Array.from(scan((acc: number, n: number) => acc + n, 0, [1, 2, 3]));
|
|
8
|
+
expect(result).toEqual([1, 3, 6]);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('supports data-last usage', () => {
|
|
12
|
+
const runningSum = scan((acc: number, n: number) => acc + n, 0);
|
|
13
|
+
expect(Array.from(runningSum([2, 2]))).toEqual([2, 4]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('scans async inputs', async () => {
|
|
17
|
+
const result = await toArray(
|
|
18
|
+
scan(async (acc: number, n: number) => acc + n, 0, Promise.resolve([1, 2]))
|
|
19
|
+
);
|
|
20
|
+
expect(result).toEqual([1, 3]);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** scan - fold values and emit each accumulated value */
|
|
6
|
+
function scan<T, R>(fn: (acc: R, value: T) => R, initial: R): (iterable: Iterable<T>) => IterableIterator<R>;
|
|
7
|
+
function scan<T, R>(
|
|
8
|
+
fn: (acc: R, value: T) => R | Promise<R>,
|
|
9
|
+
initial: R
|
|
10
|
+
): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => AsyncIterableIterator<R>;
|
|
11
|
+
function scan<T, R>(fn: (acc: R, value: T) => R, initial: R, iterable: Iterable<T>): IterableIterator<R>;
|
|
12
|
+
function scan<T, R>(
|
|
13
|
+
fn: (acc: R, value: T) => R | Promise<R>,
|
|
14
|
+
initial: R,
|
|
15
|
+
iterable: AnyIterableInput<PromiseLikeValue<T>>
|
|
16
|
+
): AsyncIterableIterator<R>;
|
|
17
|
+
function scan<T, R>(
|
|
18
|
+
fn: (acc: R, value: T) => R | Promise<R>,
|
|
19
|
+
initial: R,
|
|
20
|
+
iterable?: AnyIterableInput<PromiseLikeValue<T>>
|
|
21
|
+
): any {
|
|
22
|
+
if (iterable === undefined) {
|
|
23
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => scan(fn, initial, next);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (isAsyncInput(iterable)) {
|
|
27
|
+
return (async function* () {
|
|
28
|
+
let acc = initial;
|
|
29
|
+
for await (const item of toAsync(iterable)) {
|
|
30
|
+
acc = await fn(acc, item as T);
|
|
31
|
+
yield acc;
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (isIterable(iterable)) {
|
|
37
|
+
return (function* () {
|
|
38
|
+
let acc = initial;
|
|
39
|
+
for (const item of iterable) {
|
|
40
|
+
acc = fn(acc, item as T) as R;
|
|
41
|
+
yield acc;
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
throw new TypeError('scan: input is not iterable');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default scan;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import some from './some';
|
|
3
|
+
|
|
4
|
+
describe('stream some', () => {
|
|
5
|
+
it('checks sync iterables', () => {
|
|
6
|
+
expect(some((n: number) => n > 2, [1, 2, 3])).toBe(true);
|
|
7
|
+
expect(some((n: number) => n > 5, [1, 2, 3])).toBe(false);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('supports data-last usage', () => {
|
|
11
|
+
const hasEven = some((n: number) => n % 2 === 0);
|
|
12
|
+
expect(hasEven([1, 3, 5])).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('checks async inputs', async () => {
|
|
16
|
+
const result = await some(async (n: number) => n === 2, Promise.resolve([1, 2, 3]));
|
|
17
|
+
expect(result).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** some - check any value matches */
|
|
6
|
+
function some<T>(predicate: (value: T) => boolean): (iterable: Iterable<T>) => boolean;
|
|
7
|
+
function some<T>(
|
|
8
|
+
predicate: (value: T) => boolean | Promise<boolean>
|
|
9
|
+
): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => Promise<boolean>;
|
|
10
|
+
function some<T>(predicate: (value: T) => boolean, iterable: Iterable<T>): boolean;
|
|
11
|
+
function some<T>(
|
|
12
|
+
predicate: (value: T) => boolean | Promise<boolean>,
|
|
13
|
+
iterable: AnyIterableInput<PromiseLikeValue<T>>
|
|
14
|
+
): Promise<boolean>;
|
|
15
|
+
function some<T>(
|
|
16
|
+
predicate: (value: T) => boolean | Promise<boolean>,
|
|
17
|
+
iterable?: AnyIterableInput<PromiseLikeValue<T>>
|
|
18
|
+
): any {
|
|
19
|
+
if (iterable === undefined) {
|
|
20
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => some(predicate, next);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (isAsyncInput(iterable)) {
|
|
24
|
+
return (async () => {
|
|
25
|
+
for await (const item of toAsync(iterable)) {
|
|
26
|
+
if (await predicate(item as T)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
})();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (isIterable(iterable)) {
|
|
35
|
+
for (const item of iterable) {
|
|
36
|
+
if (predicate(item as T)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
throw new TypeError('some: input is not iterable');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default some;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import take from './take';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream take', () => {
|
|
6
|
+
it('takes from sync iterables', () => {
|
|
7
|
+
expect(Array.from(take(2, [1, 2, 3]))).toEqual([1, 2]);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('supports data-last usage', () => {
|
|
11
|
+
const takeTwo = take(2);
|
|
12
|
+
expect(Array.from(takeTwo([4, 5, 6]))).toEqual([4, 5]);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('takes from async inputs', async () => {
|
|
16
|
+
const result = await toArray(take(2, Promise.resolve([7, 8, 9])));
|
|
17
|
+
expect(result).toEqual([7, 8]);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AnyIterableInput, PromiseLikeValue } from './utils';
|
|
2
|
+
import { isAsyncInput, isIterable } from './utils';
|
|
3
|
+
import toAsync from './toAsync';
|
|
4
|
+
|
|
5
|
+
/** take - lazily take first n values */
|
|
6
|
+
function take<T>(count: number): (iterable: Iterable<T>) => IterableIterator<T>;
|
|
7
|
+
function take<T>(count: number): (iterable: AnyIterableInput<PromiseLikeValue<T>>) => AsyncIterableIterator<T>;
|
|
8
|
+
function take<T>(count: number, iterable: Iterable<T>): IterableIterator<T>;
|
|
9
|
+
function take<T>(count: number, iterable: AnyIterableInput<PromiseLikeValue<T>>): AsyncIterableIterator<T>;
|
|
10
|
+
function take<T>(count: number, iterable?: AnyIterableInput<PromiseLikeValue<T>>): any {
|
|
11
|
+
if (iterable === undefined) {
|
|
12
|
+
return (next: AnyIterableInput<PromiseLikeValue<T>>) => take(count, next);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const limit = Math.floor(count);
|
|
16
|
+
if (!Number.isFinite(limit) || limit <= 0) {
|
|
17
|
+
return isAsyncInput(iterable)
|
|
18
|
+
? (async function* () {})()
|
|
19
|
+
: (function* () {})();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (isAsyncInput(iterable)) {
|
|
23
|
+
return (async function* () {
|
|
24
|
+
let taken = 0;
|
|
25
|
+
for await (const item of toAsync(iterable)) {
|
|
26
|
+
yield item as T;
|
|
27
|
+
taken += 1;
|
|
28
|
+
if (taken >= limit) {
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (isIterable(iterable)) {
|
|
36
|
+
return (function* () {
|
|
37
|
+
let taken = 0;
|
|
38
|
+
for (const item of iterable) {
|
|
39
|
+
yield item as T;
|
|
40
|
+
taken += 1;
|
|
41
|
+
if (taken >= limit) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw new TypeError('take: input is not iterable');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default take;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import takeWhile from './takeWhile';
|
|
3
|
+
import toArray from './toArray';
|
|
4
|
+
|
|
5
|
+
describe('stream takeWhile', () => {
|
|
6
|
+
it('takes while predicate holds (sync)', () => {
|
|
7
|
+
const result = Array.from(takeWhile((n: number) => n < 3, [1, 2, 3, 1]));
|
|
8
|
+
expect(result).toEqual([1, 2]);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('supports data-last usage', () => {
|
|
12
|
+
const takeSmall = takeWhile((n: number) => n <= 2);
|
|
13
|
+
expect(Array.from(takeSmall([2, 2, 3]))).toEqual([2, 2]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('takes while predicate holds (async)', async () => {
|
|
17
|
+
const result = await toArray(takeWhile(async (n: number) => n < 3, Promise.resolve([1, 2, 3, 1])));
|
|
18
|
+
expect(result).toEqual([1, 2]);
|
|
19
|
+
});
|
|
20
|
+
});
|