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,68 @@
|
|
|
1
|
+
import SideEffect, { isSideEffect } from '../composition/sideEffect';
|
|
2
|
+
|
|
3
|
+
/** pipeAsyncSideEffect - SideEffect를 허용하는 비동기 함수 합성 */
|
|
4
|
+
type MaybeSideEffect<T> = T | SideEffect<any>;
|
|
5
|
+
type NonSideEffect<T> = Exclude<T, SideEffect<any>>;
|
|
6
|
+
type AsyncOrSync<A, R> = (a: A) => MaybeSideEffect<R> | Promise<MaybeSideEffect<R>>;
|
|
7
|
+
type PipeInput<Fns extends AsyncOrSync<any, any>[]> = Fns extends [
|
|
8
|
+
AsyncOrSync<infer A, any>,
|
|
9
|
+
...AsyncOrSync<any, any>[]
|
|
10
|
+
]
|
|
11
|
+
? A
|
|
12
|
+
: never;
|
|
13
|
+
type PipeOutput<Fns extends AsyncOrSync<any, any>[]> = Fns extends [AsyncOrSync<any, infer R>]
|
|
14
|
+
? MaybeSideEffect<Awaited<R>>
|
|
15
|
+
: Fns extends [AsyncOrSync<any, infer R>, ...infer Rest]
|
|
16
|
+
? Rest extends [AsyncOrSync<Awaited<NonSideEffect<R>>, any>, ...AsyncOrSync<any, any>[]]
|
|
17
|
+
? PipeOutput<Rest>
|
|
18
|
+
: never
|
|
19
|
+
: never;
|
|
20
|
+
type Resolve<T> = T extends infer R ? R : never;
|
|
21
|
+
type PipeAsyncSideEffect<Fns extends AsyncOrSync<any, any>[]> = (
|
|
22
|
+
input: PipeInput<Fns> | SideEffect<any>
|
|
23
|
+
) => Promise<Resolve<PipeOutput<Fns>>>;
|
|
24
|
+
|
|
25
|
+
function pipeAsyncSideEffect<A, R>(
|
|
26
|
+
ab: AsyncOrSync<A, R>
|
|
27
|
+
): (a: A | SideEffect<any>) => Promise<MaybeSideEffect<Awaited<R>>>;
|
|
28
|
+
function pipeAsyncSideEffect<A, B, R>(
|
|
29
|
+
ab: AsyncOrSync<A, B>,
|
|
30
|
+
bc: AsyncOrSync<Awaited<B>, R>
|
|
31
|
+
): (a: A | SideEffect<any>) => Promise<MaybeSideEffect<Awaited<R>>>;
|
|
32
|
+
function pipeAsyncSideEffect<A, B, C, R>(
|
|
33
|
+
ab: AsyncOrSync<A, B>,
|
|
34
|
+
bc: AsyncOrSync<Awaited<B>, C>,
|
|
35
|
+
cd: AsyncOrSync<Awaited<C>, R>
|
|
36
|
+
): (a: A | SideEffect<any>) => Promise<MaybeSideEffect<Awaited<R>>>;
|
|
37
|
+
function pipeAsyncSideEffect<A, B, C, D, R>(
|
|
38
|
+
ab: AsyncOrSync<A, B>,
|
|
39
|
+
bc: AsyncOrSync<Awaited<B>, C>,
|
|
40
|
+
cd: AsyncOrSync<Awaited<C>, D>,
|
|
41
|
+
de: AsyncOrSync<Awaited<D>, R>
|
|
42
|
+
): (a: A | SideEffect<any>) => Promise<MaybeSideEffect<Awaited<R>>>;
|
|
43
|
+
function pipeAsyncSideEffect<A, B, C, D, E, R>(
|
|
44
|
+
ab: AsyncOrSync<A, B>,
|
|
45
|
+
bc: AsyncOrSync<Awaited<B>, C>,
|
|
46
|
+
cd: AsyncOrSync<Awaited<C>, D>,
|
|
47
|
+
de: AsyncOrSync<Awaited<D>, E>,
|
|
48
|
+
ef: AsyncOrSync<Awaited<E>, R>
|
|
49
|
+
): (a: A | SideEffect<any>) => Promise<MaybeSideEffect<Awaited<R>>>;
|
|
50
|
+
|
|
51
|
+
function pipeAsyncSideEffect<Fns extends [AsyncOrSync<any, any>, ...AsyncOrSync<any, any>[]]>(
|
|
52
|
+
...funcs: Fns
|
|
53
|
+
): PipeAsyncSideEffect<Fns>;
|
|
54
|
+
function pipeAsyncSideEffect(...funcs: Array<AsyncOrSync<any, any>>): (value: any) => Promise<any>;
|
|
55
|
+
function pipeAsyncSideEffect(...funcs: Array<(arg: any) => any>) {
|
|
56
|
+
return async (value: any) => {
|
|
57
|
+
let acc = value;
|
|
58
|
+
for (const fn of funcs) {
|
|
59
|
+
if (isSideEffect(acc)) {
|
|
60
|
+
return acc;
|
|
61
|
+
}
|
|
62
|
+
acc = await fn(acc);
|
|
63
|
+
}
|
|
64
|
+
return acc;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default pipeAsyncSideEffect;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import retry from './retry';
|
|
3
|
+
|
|
4
|
+
describe('retry', () => {
|
|
5
|
+
it('retries until success', async () => {
|
|
6
|
+
let count = 0;
|
|
7
|
+
const fn = vi.fn(async () => {
|
|
8
|
+
count += 1;
|
|
9
|
+
if (count < 3) throw new Error('fail');
|
|
10
|
+
return 'ok';
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
await expect(retry<string>(5, fn)).resolves.toBe('ok');
|
|
14
|
+
expect(fn).toHaveBeenCalledTimes(3);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('fails after max retries', async () => {
|
|
18
|
+
const fn = vi.fn(async () => {
|
|
19
|
+
throw new Error('always');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
await expect(retry(2, fn)).rejects.toThrow('always');
|
|
23
|
+
expect(fn).toHaveBeenCalledTimes(3); // initial + 2 retries
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('waits between retries when delayMs is provided', async () => {
|
|
27
|
+
vi.useFakeTimers();
|
|
28
|
+
const fn = vi
|
|
29
|
+
.fn(async () => 'ok' as const)
|
|
30
|
+
.mockRejectedValueOnce(new Error('fail1'))
|
|
31
|
+
.mockRejectedValueOnce(new Error('fail2'));
|
|
32
|
+
|
|
33
|
+
const promise = retry(2, fn, 50);
|
|
34
|
+
|
|
35
|
+
// first call, then schedule delay before second attempt
|
|
36
|
+
expect(fn).toHaveBeenCalledTimes(1);
|
|
37
|
+
|
|
38
|
+
// finish first delay -> second attempt
|
|
39
|
+
await vi.advanceTimersByTimeAsync(50);
|
|
40
|
+
expect(fn).toHaveBeenCalledTimes(2);
|
|
41
|
+
|
|
42
|
+
// finish second delay -> third attempt (success)
|
|
43
|
+
await vi.advanceTimersByTimeAsync(50);
|
|
44
|
+
await promise;
|
|
45
|
+
expect(fn).toHaveBeenCalledTimes(3);
|
|
46
|
+
|
|
47
|
+
vi.useRealTimers();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** retry - 실패 시 재시도 (옵션 대기 시간 포함) */
|
|
2
|
+
import delay from './delay';
|
|
3
|
+
import curry from '../composition/curry';
|
|
4
|
+
|
|
5
|
+
type Retry = {
|
|
6
|
+
(times: number): <T>(fn: () => Promise<T>, delayMs?: number) => Promise<T>;
|
|
7
|
+
<T>(...args: [times: number, fn: () => Promise<T>, delayMs?: number]): Promise<T>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function retry<T>(times: number, fn: () => Promise<T>, delayMs = 0): Promise<T> {
|
|
11
|
+
return (async () => {
|
|
12
|
+
let attempt = 0;
|
|
13
|
+
while (true) {
|
|
14
|
+
try {
|
|
15
|
+
return await fn();
|
|
16
|
+
} catch (err) {
|
|
17
|
+
attempt += 1;
|
|
18
|
+
if (attempt > times) throw err;
|
|
19
|
+
if (delayMs > 0) {
|
|
20
|
+
await delay(delayMs);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
26
|
+
const curriedRetry = curry(retry) as Retry;
|
|
27
|
+
export default curriedRetry;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import throttle from './throttle';
|
|
3
|
+
|
|
4
|
+
describe('throttle', () => {
|
|
5
|
+
it('invokes immediately and then throttles', async () => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
const spy = vi.fn();
|
|
8
|
+
const fn = throttle(spy, 100);
|
|
9
|
+
|
|
10
|
+
fn();
|
|
11
|
+
fn();
|
|
12
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
13
|
+
|
|
14
|
+
vi.advanceTimersByTime(100);
|
|
15
|
+
await Promise.resolve();
|
|
16
|
+
expect(spy).toHaveBeenCalledTimes(2); // trailing
|
|
17
|
+
vi.useRealTimers();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('drops intermediate calls and runs trailing once', async () => {
|
|
21
|
+
vi.useFakeTimers();
|
|
22
|
+
const spy = vi.fn();
|
|
23
|
+
const fn = throttle(spy, 50);
|
|
24
|
+
|
|
25
|
+
fn(1);
|
|
26
|
+
fn(2);
|
|
27
|
+
fn(3);
|
|
28
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
29
|
+
expect(spy).toHaveBeenCalledWith(1);
|
|
30
|
+
|
|
31
|
+
vi.advanceTimersByTime(50);
|
|
32
|
+
await Promise.resolve();
|
|
33
|
+
expect(spy).toHaveBeenCalledTimes(2);
|
|
34
|
+
expect(spy).toHaveBeenCalledWith(3); // trailing call
|
|
35
|
+
|
|
36
|
+
vi.useRealTimers();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import curry from '../composition/curry';
|
|
2
|
+
|
|
3
|
+
type Throttle = {
|
|
4
|
+
<T extends (...args: any[]) => any>(...args: [fn: T]): (ms: number) => T;
|
|
5
|
+
<T extends (...args: any[]) => any>(...args: [fn: T, ms: number]): T;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** throttle - 호출 제어 (쓰로틀) */
|
|
9
|
+
function throttle<T extends (...args: any[]) => any>(fn: T, ms: number): T {
|
|
10
|
+
let lastCall = 0;
|
|
11
|
+
let trailingArgs: any[] | null = null;
|
|
12
|
+
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
|
13
|
+
|
|
14
|
+
const invoke = (ctx: any, args: any[]) => {
|
|
15
|
+
lastCall = Date.now();
|
|
16
|
+
fn.apply(ctx, args);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const throttled = function (this: any, ...args: any[]) {
|
|
20
|
+
const now = Date.now();
|
|
21
|
+
const remaining = ms - (now - lastCall);
|
|
22
|
+
|
|
23
|
+
if (remaining <= 0) {
|
|
24
|
+
if (timeoutId) {
|
|
25
|
+
clearTimeout(timeoutId);
|
|
26
|
+
timeoutId = null;
|
|
27
|
+
}
|
|
28
|
+
trailingArgs = null;
|
|
29
|
+
invoke(this, args);
|
|
30
|
+
} else {
|
|
31
|
+
trailingArgs = args;
|
|
32
|
+
if (!timeoutId) {
|
|
33
|
+
timeoutId = setTimeout(() => {
|
|
34
|
+
timeoutId = null;
|
|
35
|
+
if (trailingArgs) {
|
|
36
|
+
invoke(this, trailingArgs);
|
|
37
|
+
trailingArgs = null;
|
|
38
|
+
}
|
|
39
|
+
}, remaining);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
} as T;
|
|
43
|
+
|
|
44
|
+
return throttled;
|
|
45
|
+
}
|
|
46
|
+
const curriedThrottle = curry(throttle) as Throttle;
|
|
47
|
+
export default curriedThrottle;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import timeout from './timeout';
|
|
3
|
+
|
|
4
|
+
describe('timeout', () => {
|
|
5
|
+
it('resolves when promise finishes before timeout', async () => {
|
|
6
|
+
const result = await timeout<string>(50, Promise.resolve('ok'));
|
|
7
|
+
expect(result).toBe('ok');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('rejects when promise exceeds timeout', async () => {
|
|
11
|
+
await expect(
|
|
12
|
+
timeout(
|
|
13
|
+
10,
|
|
14
|
+
new Promise((resolve) => {
|
|
15
|
+
setTimeout(() => resolve('late'), 30);
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
).rejects.toThrow('Timed out after 10ms');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import curry from '../composition/curry';
|
|
2
|
+
|
|
3
|
+
type Timeout = {
|
|
4
|
+
(ms: number): <T>(promise: Promise<T>) => Promise<T>;
|
|
5
|
+
<T>(...args: [ms: number, promise: Promise<T>]): Promise<T>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** timeout - 제한 시간 내 실행 */
|
|
9
|
+
function timeout<T>(ms: number, promise: Promise<T>): Promise<T> {
|
|
10
|
+
return new Promise<T>((resolve, reject) => {
|
|
11
|
+
const timer = setTimeout(() => reject(new Error(`Timed out after ${ms}ms`)), ms);
|
|
12
|
+
promise
|
|
13
|
+
.then((val) => {
|
|
14
|
+
clearTimeout(timer);
|
|
15
|
+
resolve(val);
|
|
16
|
+
})
|
|
17
|
+
.catch((err) => {
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const curriedTimeout = curry(timeout) as Timeout;
|
|
24
|
+
export default curriedTimeout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import complement from './complement';
|
|
3
|
+
|
|
4
|
+
describe('complement', () => {
|
|
5
|
+
it('negates predicate results', () => {
|
|
6
|
+
const isEven = (n: number) => n % 2 === 0;
|
|
7
|
+
expect(complement(isEven, 2)).toBe(false);
|
|
8
|
+
expect(complement(isEven, 3)).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('supports data-last usage', () => {
|
|
12
|
+
const isEven = (n: number) => n % 2 === 0;
|
|
13
|
+
const isOdd = complement(isEven);
|
|
14
|
+
expect(isOdd(1)).toBe(true);
|
|
15
|
+
expect(isOdd(2)).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* complement - 조건 함수 반전
|
|
3
|
+
*/
|
|
4
|
+
function complement<T extends any[]>(predicate: (...args: T) => boolean): (...args: T) => boolean;
|
|
5
|
+
function complement<T extends any[]>(predicate: (...args: T) => boolean, ...args: T): boolean;
|
|
6
|
+
function complement<T extends any[]>(predicate: (...args: T) => boolean, ...args: T) {
|
|
7
|
+
if (args.length === 0) {
|
|
8
|
+
return (...nextArgs: T) => !predicate(...nextArgs);
|
|
9
|
+
}
|
|
10
|
+
return !predicate(...args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default complement;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import compose from './compose';
|
|
3
|
+
|
|
4
|
+
describe('compose', () => {
|
|
5
|
+
it('applies functions right-to-left', () => {
|
|
6
|
+
const double = (n: number) => n * 2;
|
|
7
|
+
const addOne = (n: number) => n + 1;
|
|
8
|
+
|
|
9
|
+
const fn = compose(double, addOne);
|
|
10
|
+
expect(fn(3)).toBe(8); // double(addOne(3))
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('supports mixed types across the chain', () => {
|
|
14
|
+
const toString = (n: number) => `${n}`;
|
|
15
|
+
const trim = (s: string) => s.trim();
|
|
16
|
+
const length = (s: string) => s.length;
|
|
17
|
+
const isLong = (len: number) => len > 2;
|
|
18
|
+
|
|
19
|
+
const fn = compose(isLong, length, trim, toString);
|
|
20
|
+
expect(fn(123)).toBe(true);
|
|
21
|
+
expect(fn(5)).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('works with a single function', () => {
|
|
25
|
+
const square = (n: number) => n * n;
|
|
26
|
+
const fn = compose(square);
|
|
27
|
+
expect(fn(4)).toBe(16);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compose - 함수를 우→좌로 합성
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
type UnaryFn<A, R> = (a: A) => R;
|
|
6
|
+
type ComposeInput<Fns extends UnaryFn<any, any>[]> = Fns extends [...UnaryFn<any, any>[], UnaryFn<infer A, any>]
|
|
7
|
+
? A
|
|
8
|
+
: never;
|
|
9
|
+
type ComposeChain<Fns extends UnaryFn<any, any>[]> = Fns extends [UnaryFn<infer A, infer R>]
|
|
10
|
+
? UnaryFn<A, R>
|
|
11
|
+
: Fns extends [UnaryFn<infer A, infer R>, ...infer Rest]
|
|
12
|
+
? Rest extends [UnaryFn<R, any>, ...UnaryFn<any, any>[]]
|
|
13
|
+
? ComposeChain<Rest> extends UnaryFn<any, infer NextR>
|
|
14
|
+
? UnaryFn<A, NextR>
|
|
15
|
+
: never
|
|
16
|
+
: never
|
|
17
|
+
: never;
|
|
18
|
+
type Compose<Fns extends UnaryFn<any, any>[]> = (input: ComposeInput<Fns>) => ComposeChain<Fns> extends UnaryFn<
|
|
19
|
+
any,
|
|
20
|
+
infer R
|
|
21
|
+
>
|
|
22
|
+
? R
|
|
23
|
+
: never;
|
|
24
|
+
|
|
25
|
+
function compose<A, R>(ab: UnaryFn<A, R>): (a: A) => R;
|
|
26
|
+
function compose<A, B, R>(ab: UnaryFn<A, B>, bc: UnaryFn<B, R>): (a: A) => R;
|
|
27
|
+
function compose<A, B, C, R>(ab: UnaryFn<A, B>, bc: UnaryFn<B, C>, cd: UnaryFn<C, R>): (a: A) => R;
|
|
28
|
+
function compose<A, B, C, D, R>(
|
|
29
|
+
ab: UnaryFn<A, B>,
|
|
30
|
+
bc: UnaryFn<B, C>,
|
|
31
|
+
cd: UnaryFn<C, D>,
|
|
32
|
+
de: UnaryFn<D, R>
|
|
33
|
+
): (a: A) => R;
|
|
34
|
+
function compose<A, B, C, D, E, R>(
|
|
35
|
+
ab: UnaryFn<A, B>,
|
|
36
|
+
bc: UnaryFn<B, C>,
|
|
37
|
+
cd: UnaryFn<C, D>,
|
|
38
|
+
de: UnaryFn<D, E>,
|
|
39
|
+
ef: UnaryFn<E, R>
|
|
40
|
+
): (a: A) => R;
|
|
41
|
+
|
|
42
|
+
function compose<Fns extends [UnaryFn<any, any>, ...UnaryFn<any, any>[]]>(...funcs: Fns): Compose<Fns>;
|
|
43
|
+
function compose(...funcs: Array<UnaryFn<any, any>>): (input: any) => any;
|
|
44
|
+
function compose(...funcs: Array<(input: any) => any>) {
|
|
45
|
+
return (value: any) => funcs.reduceRight((acc, fn) => fn(acc), value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default compose;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import constant from './constant';
|
|
3
|
+
|
|
4
|
+
describe('constant', () => {
|
|
5
|
+
it('returns a function that always returns the same value', () => {
|
|
6
|
+
const alwaysFive = constant(5);
|
|
7
|
+
expect(alwaysFive()).toBe(5);
|
|
8
|
+
expect(alwaysFive()).toBe(5);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('preserves reference identity', () => {
|
|
12
|
+
const obj = { a: 1 };
|
|
13
|
+
const alwaysObj = constant(obj);
|
|
14
|
+
expect(alwaysObj()).toBe(obj);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import curry from './curry';
|
|
3
|
+
|
|
4
|
+
describe('curry', () => {
|
|
5
|
+
it('curries a binary function', () => {
|
|
6
|
+
const add = (a: number, b: number) => a + b;
|
|
7
|
+
const curriedAdd = curry(add);
|
|
8
|
+
|
|
9
|
+
expect(curriedAdd(1, 2)).toBe(3);
|
|
10
|
+
expect(curriedAdd(1)(2)).toBe(3);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('curries a ternary function across multiple calls', () => {
|
|
14
|
+
const combine = (a: string, b: string, c: string) => `${a}-${b}-${c}`;
|
|
15
|
+
const curriedCombine = curry(combine);
|
|
16
|
+
|
|
17
|
+
expect(curriedCombine('x')('y')('z')).toBe('x-y-z');
|
|
18
|
+
expect(curriedCombine('x', 'y')('z')).toBe('x-y-z');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('reuses partial applications', () => {
|
|
22
|
+
const sum3 = (a: number, b: number, c: number) => a + b + c;
|
|
23
|
+
const curried = curry(sum3);
|
|
24
|
+
|
|
25
|
+
const addOne = curried(1);
|
|
26
|
+
const addOneAndTwo = addOne(2);
|
|
27
|
+
|
|
28
|
+
expect(addOneAndTwo(3)).toBe(6);
|
|
29
|
+
expect(addOneAndTwo(5)).toBe(8);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curry function with stable TypeScript types.
|
|
3
|
+
* Supports functions with 2-5 parameters and keeps data-last call order.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
type Curry2<Fn> = Fn extends (a: infer A, b: infer B) => infer R
|
|
7
|
+
? {
|
|
8
|
+
(...args: [A]): (b: B) => R;
|
|
9
|
+
(...args: [A, B]): R;
|
|
10
|
+
}
|
|
11
|
+
: never;
|
|
12
|
+
|
|
13
|
+
type Curry3<Fn> = Fn extends (a: infer A, b: infer B, c: infer C) => infer R
|
|
14
|
+
? {
|
|
15
|
+
(...args: [A]): (b: B) => (c: C) => R;
|
|
16
|
+
(...args: [A, B]): (c: C) => R;
|
|
17
|
+
(...args: [A, B, C]): R;
|
|
18
|
+
}
|
|
19
|
+
: never;
|
|
20
|
+
|
|
21
|
+
type Curry4<Fn> = Fn extends (a: infer A, b: infer B, c: infer C, d: infer D) => infer R
|
|
22
|
+
? {
|
|
23
|
+
(...args: [A]): (b: B) => (c: C) => (d: D) => R;
|
|
24
|
+
(...args: [A, B]): (c: C) => (d: D) => R;
|
|
25
|
+
(...args: [A, B, C]): (d: D) => R;
|
|
26
|
+
(...args: [A, B, C, D]): R;
|
|
27
|
+
}
|
|
28
|
+
: never;
|
|
29
|
+
|
|
30
|
+
type Curry5<Fn> = Fn extends (a: infer A, b: infer B, c: infer C, d: infer D, e: infer E) => infer R
|
|
31
|
+
? {
|
|
32
|
+
(...args: [A]): (b: B) => (c: C) => (d: D) => (e: E) => R;
|
|
33
|
+
(...args: [A, B]): (c: C) => (d: D) => (e: E) => R;
|
|
34
|
+
(...args: [A, B, C]): (d: D) => (e: E) => R;
|
|
35
|
+
(...args: [A, B, C, D]): (e: E) => R;
|
|
36
|
+
(...args: [A, B, C, D, E]): R;
|
|
37
|
+
}
|
|
38
|
+
: never;
|
|
39
|
+
|
|
40
|
+
type CurryVariadic<Fn extends (...args: any[]) => any> = Fn extends (...args: infer P) => infer R
|
|
41
|
+
? <T extends any[]>(
|
|
42
|
+
...args: T
|
|
43
|
+
) => T extends P ? R : P extends [...T, ...infer Rest] ? CurryVariadic<(...args: Rest) => R> : never
|
|
44
|
+
: never;
|
|
45
|
+
|
|
46
|
+
type CurryByArity<Fn extends (...args: any[]) => any> = Parameters<Fn>['length'] extends 2
|
|
47
|
+
? Curry2<Fn>
|
|
48
|
+
: Parameters<Fn>['length'] extends 3
|
|
49
|
+
? Curry3<Fn>
|
|
50
|
+
: Parameters<Fn>['length'] extends 4
|
|
51
|
+
? Curry4<Fn>
|
|
52
|
+
: Parameters<Fn>['length'] extends 5
|
|
53
|
+
? Curry5<Fn>
|
|
54
|
+
: CurryVariadic<Fn>;
|
|
55
|
+
|
|
56
|
+
type Curried<Fn extends (...args: any[]) => any> = CurryByArity<Fn>;
|
|
57
|
+
|
|
58
|
+
function curry<Fn extends (...args: any[]) => any>(fn: Fn): Curried<Fn>;
|
|
59
|
+
|
|
60
|
+
// Implementation
|
|
61
|
+
function curry(fn: (...args: any[]) => any, ...args: any[]): any {
|
|
62
|
+
const curried = (accumulated: any[]) => {
|
|
63
|
+
return accumulated.length >= fn.length
|
|
64
|
+
? fn(...accumulated)
|
|
65
|
+
: (...nextArgs: any[]) => curried([...accumulated, ...nextArgs]);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return args.length === 0 ? curried([]) : curried(args);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default curry;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import flip from './flip';
|
|
3
|
+
|
|
4
|
+
describe('flip', () => {
|
|
5
|
+
it('swaps the first two arguments of a binary function', () => {
|
|
6
|
+
const divide = (a: number, b: number) => a / b;
|
|
7
|
+
const flipped = flip(divide);
|
|
8
|
+
|
|
9
|
+
expect(flipped(2, 10)).toBe(5); // divide(10, 2)
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('reverses arguments for 3-arity functions', () => {
|
|
13
|
+
const concat = (a: string | number, b: string | number, c: string | number) => `${a}-${b}-${c}`;
|
|
14
|
+
const flipped = flip(concat);
|
|
15
|
+
|
|
16
|
+
expect(flipped(1, 'b', 'a')).toBe('a-b-1');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('preserves this binding when used with call/apply', () => {
|
|
20
|
+
const obj = {
|
|
21
|
+
base: 10,
|
|
22
|
+
fn(this: { base: number }, a: number, b: number) {
|
|
23
|
+
return this.base + a - b;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const flipped = flip(obj.fn);
|
|
28
|
+
expect(flipped.call(obj, 2, 5)).toBe(13); // base + 5 - 2
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('supports 4-5 arity with reversed order', () => {
|
|
32
|
+
const format4 = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`;
|
|
33
|
+
const flipped4 = flip(format4);
|
|
34
|
+
expect(flipped4('4', '3', '2', '1')).toBe('1-2-3-4');
|
|
35
|
+
|
|
36
|
+
const format5 = (a: number, b: number, c: number, d: number, e: number) => a + b * 2 + c * 3 + d * 4 + e * 5;
|
|
37
|
+
const flipped5 = flip(format5);
|
|
38
|
+
// reversed args: 5,4,3,2,1 => 5 + 4*2 + 3*3 + 2*4 + 1*5 = 5 + 8 + 9 + 8 + 5 = 35
|
|
39
|
+
expect(flipped5(1, 2, 3, 4, 5)).toBe(35);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* flip - 함수 인자 순서를 뒤집음
|
|
3
|
+
*/
|
|
4
|
+
function flip<A, B, R>(fn: (a: A, b: B) => R): (b: B, a: A) => R;
|
|
5
|
+
function flip<A, B, C, R>(fn: (a: A, b: B, c: C) => R): (c: C, b: B, a: A) => R;
|
|
6
|
+
function flip<A, B, C, D, R>(fn: (a: A, b: B, c: C, d: D) => R): (d: D, c: C, b: B, a: A) => R;
|
|
7
|
+
function flip<A, B, C, D, E, R>(fn: (a: A, b: B, c: C, d: D, e: E) => R): (e: E, d: D, c: C, b: B, a: A) => R;
|
|
8
|
+
function flip<R>(fn: (...args: any[]) => R): (...reversed: any[]) => R;
|
|
9
|
+
function flip<R>(fn: (...args: any[]) => R) {
|
|
10
|
+
return function flipped(this: unknown, ...args: any[]) {
|
|
11
|
+
const reversed = [...args].reverse();
|
|
12
|
+
return fn.apply(this, reversed);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default flip;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import identity from './identity';
|
|
3
|
+
|
|
4
|
+
describe('identity', () => {
|
|
5
|
+
it('returns the same value', () => {
|
|
6
|
+
expect(identity(5)).toBe(5);
|
|
7
|
+
expect(identity('fp')).toBe('fp');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('preserves reference identity', () => {
|
|
11
|
+
const obj = { a: 1 };
|
|
12
|
+
expect(identity(obj)).toBe(obj);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as pipe } from './pipe';
|
|
2
|
+
export { default as pipeSideEffect } from './pipeSideEffect';
|
|
3
|
+
export { default as compose } from './compose';
|
|
4
|
+
export { default as curry } from './curry';
|
|
5
|
+
export { default as partial } from './partial';
|
|
6
|
+
export { default as flip } from './flip';
|
|
7
|
+
export { default as complement } from './complement';
|
|
8
|
+
export { default as identity } from './identity';
|
|
9
|
+
export { default as constant } from './constant';
|
|
10
|
+
export { default as tap } from './tap';
|
|
11
|
+
export { default as once } from './once';
|
|
12
|
+
export { default as memoize } from './memoize';
|
|
13
|
+
export { default as SideEffect } from './sideEffect';
|
|
14
|
+
export { SideEffect as SideEffectClass } from './sideEffect';
|
|
15
|
+
export { isSideEffect, matchSideEffect, runPipeResult } from './sideEffect';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import memoize from './memoize';
|
|
3
|
+
|
|
4
|
+
describe('memoize', () => {
|
|
5
|
+
it('caches results for identical args', () => {
|
|
6
|
+
const spy = vi.fn((a: number, b: number) => a + b);
|
|
7
|
+
const m = memoize(spy);
|
|
8
|
+
|
|
9
|
+
expect(m(1, 2)).toBe(3);
|
|
10
|
+
expect(m(1, 2)).toBe(3);
|
|
11
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('distinguishes different args', () => {
|
|
15
|
+
const spy = vi.fn((a: number, b: number) => a * b);
|
|
16
|
+
const m = memoize(spy);
|
|
17
|
+
|
|
18
|
+
expect(m(2, 3)).toBe(6);
|
|
19
|
+
expect(m(3, 2)).toBe(6);
|
|
20
|
+
expect(spy).toHaveBeenCalledTimes(2);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('respects reference equality for object args', () => {
|
|
24
|
+
const spy = vi.fn((obj: { v: number }) => obj.v * 2);
|
|
25
|
+
const m = memoize(spy);
|
|
26
|
+
|
|
27
|
+
const ref = { v: 5 };
|
|
28
|
+
expect(m(ref)).toBe(10);
|
|
29
|
+
expect(m(ref)).toBe(10);
|
|
30
|
+
expect(m({ v: 5 })).toBe(10);
|
|
31
|
+
expect(spy).toHaveBeenCalledTimes(2);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('preserves this binding', () => {
|
|
35
|
+
const ctx = {
|
|
36
|
+
factor: 10,
|
|
37
|
+
fn(this: { factor: number }, x: number) {
|
|
38
|
+
return this.factor + x;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const m = memoize(ctx.fn);
|
|
43
|
+
expect(m.call(ctx, 5)).toBe(15);
|
|
44
|
+
expect(m.call(ctx, 5)).toBe(15);
|
|
45
|
+
});
|
|
46
|
+
});
|