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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 superlucky84
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://github.com/user-attachments/assets/20cf4276-761d-4967-b1a5-1adc0c3b9ffd" alt="fp-pack" width="200" />
|
|
3
|
+
|
|
4
|
+
# fp-pack
|
|
5
|
+
|
|
6
|
+
**A practical functional toolkit for JavaScript and TypeScript.**
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
Written in TypeScript with full type safety, fp-pack works seamlessly in both JavaScript and TypeScript projects.
|
|
10
|
+
|
|
11
|
+
fp-pack is a focused collection of functional programming utilities designed for real-world applications.
|
|
12
|
+
It emphasizes **function composition, immutability, and declarative code** through `pipe` and `pipeAsync`, while remaining approachable for everyday developers.
|
|
13
|
+
|
|
14
|
+
The concept is simple: if you understand functions, pipes, and currying, you can use fp-pack immediately.
|
|
15
|
+
|
|
16
|
+
There's no framework and no heavy abstractionsβjust well-chosen helpers that make functional style easier to adopt and maintain in production code.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Custom Utility Authoring Guide (for pipe)
|
|
21
|
+
|
|
22
|
+
When you write your own helpers that should compose cleanly with `pipe`/`pipeAsync`, follow these conventions:
|
|
23
|
+
|
|
24
|
+
- **Data-last arguments** so partial application works naturally in pipelines.
|
|
25
|
+
- **Curry multi-argument functions** to make them pipe-friendly.
|
|
26
|
+
- **Fixed signatures** can use `curry(fn)` directly.
|
|
27
|
+
- **Generic or overloaded signatures** should be wrapped with an explicit type alias and a cast to preserve inference.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// Fixed signature: curry is enough
|
|
31
|
+
function split(separator: string, str: string): string[] {
|
|
32
|
+
return str.split(separator);
|
|
33
|
+
}
|
|
34
|
+
export default curry(split);
|
|
35
|
+
|
|
36
|
+
// Generic signature: add a type alias for the curried form
|
|
37
|
+
type Chunk = {
|
|
38
|
+
(size: number): <T>(arr: T[]) => T[][];
|
|
39
|
+
<T>(size: number, arr: T[]): T[][];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function chunk<T>(size: number, arr: T[]): T[][] {
|
|
43
|
+
// ...
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const curriedChunk = curry(chunk) as Chunk;
|
|
48
|
+
export default curriedChunk;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Why fp-pack?
|
|
52
|
+
|
|
53
|
+
- π **Pipe-First Philosophy**
|
|
54
|
+
Built around `pipe` and `pipeAsync` for clean, left-to-right function composition.
|
|
55
|
+
|
|
56
|
+
- β‘ **SideEffect Pattern**
|
|
57
|
+
Handle errors and side effects declaratively in SideEffect-aware pipelines. Use `pipeSideEffect` / `pipeAsyncSideEffect` to short-circuit on `SideEffect` without breaking composition. Focus on business logic, not error plumbing.
|
|
58
|
+
|
|
59
|
+
- π§ **Lazy Stream Processing**
|
|
60
|
+
Efficient iterable processing with `stream/*` functions for memory-conscious operations on large datasets.
|
|
61
|
+
|
|
62
|
+
- π **JavaScript & TypeScript**
|
|
63
|
+
Works seamlessly in JavaScript. Written in TypeScript for robust type inference when you need it.
|
|
64
|
+
|
|
65
|
+
- π― **Practical & Production-Ready**
|
|
66
|
+
Covers the patterns you write every dayβdata transformation, composition, control flow, and async operations.
|
|
67
|
+
|
|
68
|
+
- πͺΆ **Lightweight & Modular**
|
|
69
|
+
Zero dependencies and tree-shakeable modules.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Design Principles
|
|
74
|
+
|
|
75
|
+
- **Pipe-centric composition**
|
|
76
|
+
`pipe` (sync) and `pipeAsync` (async) are the primary composition tools. All utilities are designed to work seamlessly in pipe chains.
|
|
77
|
+
|
|
78
|
+
- **Pragmatic error handling**
|
|
79
|
+
The `SideEffect` pattern handles errors and side effects declaratively in `pipeSideEffect`/`pipeAsyncSideEffect` pipelines. Write normal functions that compose naturallyβthese pipelines automatically short-circuit when they encounter a `SideEffect`, eliminating the need for wrapper types everywhere. Use `runPipeResult<T, R>`/`matchSideEffect` **outside** the pipeline with generics for type safety, and `isSideEffect` for runtime type checking.
|
|
80
|
+
|
|
81
|
+
- **Immutable & Pure by default**
|
|
82
|
+
Core utilities avoid mutations and side effects. Any exception is explicitly named (e.g. `tap`, `log`).
|
|
83
|
+
|
|
84
|
+
- **Lazy evaluation when needed**
|
|
85
|
+
Array helpers are eager and simple. Stream helpers (`stream/*`) provide lazy, memory-efficient alternatives for large datasets.
|
|
86
|
+
|
|
87
|
+
- **Curried by design**
|
|
88
|
+
All multi-argument utility functions are curried or behave like curried functions, enabling partial application and point-free style. This design allows elegant composition in pipes without awkward wrapper functions.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Functions are curried - apply arguments one at a time
|
|
92
|
+
const double = map((n: number) => n * 2);
|
|
93
|
+
const evenOnly = filter((n: number) => n % 2 === 0);
|
|
94
|
+
|
|
95
|
+
const result = pipe(
|
|
96
|
+
evenOnly, // Partially applied filter
|
|
97
|
+
double, // Partially applied map
|
|
98
|
+
take(5) // Partially applied take
|
|
99
|
+
)([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
|
100
|
+
// [4, 8, 12, 16, 20]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Installation
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm install fp-pack
|
|
107
|
+
# or
|
|
108
|
+
pnpm add fp-pack
|
|
109
|
+
# or
|
|
110
|
+
yarn add fp-pack
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## AI Agent Skills (Optional)
|
|
114
|
+
|
|
115
|
+
fp-pack includes an AI agent skills file that helps AI coding assistants (Claude Code, GitHub Copilot, Cursor, etc.) automatically write fp-pack-style functional code.
|
|
116
|
+
|
|
117
|
+
When you have this skills file in your project, AI assistants will:
|
|
118
|
+
- Default to using `pipe`/`pipeAsync` for pure transformations, and `pipeSideEffect`/`pipeAsyncSideEffect` when SideEffect is involved
|
|
119
|
+
- Use the `SideEffect` pattern instead of try-catch
|
|
120
|
+
- Prefer `stream/*` functions for large datasets
|
|
121
|
+
- Write declarative, functional code using fp-pack utilities
|
|
122
|
+
|
|
123
|
+
### Setup for Claude Code
|
|
124
|
+
|
|
125
|
+
Copy the skills file to your project's `.claude/skills/` directory:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Unix/macOS/Linux
|
|
129
|
+
cp node_modules/fp-pack/dist/skills/fp-pack.md .claude/skills/
|
|
130
|
+
|
|
131
|
+
# Windows (PowerShell)
|
|
132
|
+
Copy-Item node_modules/fp-pack/dist/skills/fp-pack.md .claude/skills/
|
|
133
|
+
|
|
134
|
+
# Or manually create the directory and copy
|
|
135
|
+
mkdir -p .claude/skills
|
|
136
|
+
cp node_modules/fp-pack/dist/skills/fp-pack.md .claude/skills/
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Once configured, AI assistants will automatically apply fp-pack coding patterns when helping you write code.
|
|
140
|
+
|
|
141
|
+
> **Note:** The skills file is located at `node_modules/fp-pack/dist/skills/fp-pack.md` after installation. You can also view it in the [GitHub repository](https://github.com/superlucky84/fp-pack/blob/main/fp-pack.md).
|
|
142
|
+
|
|
143
|
+
## Quick Start
|
|
144
|
+
|
|
145
|
+
### Basic Pipe Composition
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { pipe, map, filter, take } from 'fp-pack';
|
|
149
|
+
|
|
150
|
+
// Synchronous data transformation
|
|
151
|
+
const processUsers = pipe(
|
|
152
|
+
filter((user: User) => user.age >= 18),
|
|
153
|
+
map(user => user.name.toUpperCase()),
|
|
154
|
+
take(10)
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const result = processUsers(users);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Async Operations with pipeAsync
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { pipeAsync } from 'fp-pack';
|
|
164
|
+
|
|
165
|
+
// Async pipe composition
|
|
166
|
+
const fetchUserProfile = pipeAsync(
|
|
167
|
+
async (userId: string) => fetch(`/api/users/${userId}`),
|
|
168
|
+
async (response) => response.json(),
|
|
169
|
+
(data) => data.profile
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
const profile = await fetchUserProfile('user-123');
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Object Transformation
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import { pipe, pick, mapValues, assoc } from 'fp-pack';
|
|
179
|
+
|
|
180
|
+
// Transform and clean data
|
|
181
|
+
const prepareUserData = pipe(
|
|
182
|
+
pick(['name', 'email', 'age']),
|
|
183
|
+
mapValues((val) => typeof val === 'string' ? val.trim() : val),
|
|
184
|
+
assoc('timestamp', Date.now())
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const cleanData = prepareUserData(rawUserInput);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Lazy Stream Processing
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { pipe } from 'fp-pack';
|
|
194
|
+
import { filter, map, take, toArray, range } from 'fp-pack/stream';
|
|
195
|
+
|
|
196
|
+
// Process only what you need - memory efficient
|
|
197
|
+
const processLargeDataset = pipe(
|
|
198
|
+
filter((n: number) => n % 2 === 0),
|
|
199
|
+
map(n => n * n),
|
|
200
|
+
take(100),
|
|
201
|
+
toArray
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
// Only processes 100 items, not 1 million
|
|
205
|
+
const result = processLargeDataset(range(1, 1000000));
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## API Reference
|
|
209
|
+
|
|
210
|
+
### Composition
|
|
211
|
+
|
|
212
|
+
Functions for composing and transforming other functions.
|
|
213
|
+
|
|
214
|
+
- **pipe** - Compose functions left to right (f β g β h)
|
|
215
|
+
- **pipeSideEffect** - Compose functions left to right with SideEffect short-circuiting
|
|
216
|
+
- **compose** - Compose functions right to left (h β g β f)
|
|
217
|
+
- **curry** - Transform a function to support partial application
|
|
218
|
+
- **partial** - Pre-fill function arguments
|
|
219
|
+
- **flip** - Reverse the order of function arguments
|
|
220
|
+
- **complement** - Logical negation of a predicate
|
|
221
|
+
- **identity** - Return input unchanged
|
|
222
|
+
- **constant** - Always return the same value
|
|
223
|
+
- **tap** - Execute side effects without changing the value
|
|
224
|
+
- **once** - Create a function that only executes once
|
|
225
|
+
- **memoize** - Cache function results for same inputs
|
|
226
|
+
- **SideEffect** - Side effect container for SideEffect-aware pipelines
|
|
227
|
+
- **isSideEffect** - Type guard for runtime checking whether a value is a SideEffect
|
|
228
|
+
- **matchSideEffect** - Pattern match on value or SideEffect
|
|
229
|
+
- **runPipeResult** - Execute SideEffect or return value (call OUTSIDE pipelines). **β οΈ CRITICAL:** `runPipeResult<T, R=any>` has default `R=any`, so using it without generics returns `any` type. Always provide explicit type parameters `runPipeResult<SuccessType, ErrorType>` for type safety. Use `isSideEffect` for runtime type checking
|
|
230
|
+
|
|
231
|
+
### Control Flow
|
|
232
|
+
|
|
233
|
+
Functions for conditional logic and flow control.
|
|
234
|
+
|
|
235
|
+
- **ifElse** - Execute different functions based on a condition
|
|
236
|
+
- **when** - Apply function only when condition is true
|
|
237
|
+
- **unless** - Apply function only when condition is false
|
|
238
|
+
- **cond** - Multi-way conditional branching (switch alternative)
|
|
239
|
+
- **tryCatch** - Handle exceptions functionally
|
|
240
|
+
- **guard** - Early return with default value on condition failure
|
|
241
|
+
|
|
242
|
+
### Array
|
|
243
|
+
|
|
244
|
+
Functions for working with arrays. All operations are immutable and return new arrays.
|
|
245
|
+
|
|
246
|
+
- **map** - Transform each element
|
|
247
|
+
- **filter** - Select elements matching a predicate
|
|
248
|
+
- **reduce** - Accumulate values into a single result
|
|
249
|
+
- **flatMap** - Map then flatten the result
|
|
250
|
+
- **find** - Get first element matching predicate
|
|
251
|
+
- **some** - Check if at least one element matches
|
|
252
|
+
- **every** - Check if all elements match
|
|
253
|
+
- **take** - Take first n elements
|
|
254
|
+
- **drop** - Skip first n elements
|
|
255
|
+
- **takeWhile** - Take elements while predicate is true
|
|
256
|
+
- **dropWhile** - Skip elements while predicate is true
|
|
257
|
+
- **chunk** - Split array into chunks of specified size
|
|
258
|
+
- **zip** - Combine two arrays into pairs
|
|
259
|
+
- **zipWith** - Combine two arrays with custom function
|
|
260
|
+
- **unzip** - Split array of pairs into two arrays
|
|
261
|
+
- **zipIndex** - Pair each element with its index
|
|
262
|
+
- **uniq** - Remove duplicate values
|
|
263
|
+
- **uniqBy** - Remove duplicates by comparison function
|
|
264
|
+
- **sort** - Sort array
|
|
265
|
+
- **sortBy** - Sort by comparison function
|
|
266
|
+
- **groupBy** - Group elements by key function
|
|
267
|
+
- **partition** - Split array by predicate into [true, false]
|
|
268
|
+
- **concat** - Concatenate arrays
|
|
269
|
+
- **append** - Add element to end
|
|
270
|
+
- **prepend** - Add element to start
|
|
271
|
+
- **flatten** - Flatten one level deep
|
|
272
|
+
- **flattenDeep** - Flatten all levels
|
|
273
|
+
- **head** - Get first element
|
|
274
|
+
- **tail** - Get all but first element
|
|
275
|
+
- **last** - Get last element
|
|
276
|
+
- **init** - Get all but last element
|
|
277
|
+
- **range** - Generate numeric range
|
|
278
|
+
- **scan** - Like reduce but emit intermediate values
|
|
279
|
+
|
|
280
|
+
### Object
|
|
281
|
+
|
|
282
|
+
Functions for working with objects and records. All operations are immutable.
|
|
283
|
+
|
|
284
|
+
- **prop** - Safely access object property
|
|
285
|
+
- **propOr** - Access property with default value
|
|
286
|
+
- **path** - Safely access nested property path
|
|
287
|
+
- **pathOr** - Access nested path with default value
|
|
288
|
+
- **pick** - Select specified properties
|
|
289
|
+
- **omit** - Remove specified properties
|
|
290
|
+
- **assoc** - Set property immutably
|
|
291
|
+
- **assocPath** - Set nested path immutably
|
|
292
|
+
- **dissoc** - Remove property immutably
|
|
293
|
+
- **dissocPath** - Remove nested path immutably
|
|
294
|
+
- **merge** - Shallow merge objects
|
|
295
|
+
- **mergeDeep** - Deep merge objects
|
|
296
|
+
- **mergeAll** - Merge multiple objects
|
|
297
|
+
- **keys** - Get array of object keys
|
|
298
|
+
- **values** - Get array of object values
|
|
299
|
+
- **entries** - Get array of [key, value] pairs
|
|
300
|
+
- **mapValues** - Transform object values
|
|
301
|
+
- **evolve** - Transform object based on schema
|
|
302
|
+
- **has** - Check if property exists
|
|
303
|
+
- **hasPath** - Check if nested path exists
|
|
304
|
+
|
|
305
|
+
### Equality & Comparison
|
|
306
|
+
|
|
307
|
+
Functions for comparing and checking values.
|
|
308
|
+
|
|
309
|
+
- **equals** - Deep equality comparison
|
|
310
|
+
- **includes** - Check containment (string) or deep equality in arrays
|
|
311
|
+
- **isNil** - Check if value is null or undefined
|
|
312
|
+
- **isEmpty** - Check if value is empty
|
|
313
|
+
- **isType** - Check value type
|
|
314
|
+
- **gt** - Greater than comparison
|
|
315
|
+
- **gte** - Greater than or equal comparison
|
|
316
|
+
- **lt** - Less than comparison
|
|
317
|
+
- **lte** - Less than or equal comparison
|
|
318
|
+
- **clamp** - Constrain value within range
|
|
319
|
+
|
|
320
|
+
### Math
|
|
321
|
+
|
|
322
|
+
Mathematical operations and utilities.
|
|
323
|
+
|
|
324
|
+
- **add** - Addition (curried)
|
|
325
|
+
- **sub** - Subtraction (curried)
|
|
326
|
+
- **mul** - Multiplication (curried)
|
|
327
|
+
- **div** - Division (curried)
|
|
328
|
+
- **sum** - Sum of array elements
|
|
329
|
+
- **mean** - Average of array elements
|
|
330
|
+
- **min** - Minimum value in array
|
|
331
|
+
- **max** - Maximum value in array
|
|
332
|
+
- **round** - Round to nearest integer
|
|
333
|
+
- **floor** - Round down
|
|
334
|
+
- **ceil** - Round up
|
|
335
|
+
- **randomInt** - Random integer in range
|
|
336
|
+
|
|
337
|
+
### String
|
|
338
|
+
|
|
339
|
+
Functions for string manipulation. All operations return new strings.
|
|
340
|
+
|
|
341
|
+
- **trim** - Remove whitespace from both ends
|
|
342
|
+
- **split** - Split string by separator
|
|
343
|
+
- **join** - Join array into string
|
|
344
|
+
- **replace** - Replace pattern in string
|
|
345
|
+
- **toUpper** - Convert to uppercase
|
|
346
|
+
- **toLower** - Convert to lowercase
|
|
347
|
+
- **startsWith** - Check if string starts with prefix
|
|
348
|
+
- **endsWith** - Check if string ends with suffix
|
|
349
|
+
- **match** - Match string against regex
|
|
350
|
+
|
|
351
|
+
### Async
|
|
352
|
+
|
|
353
|
+
Functions for asynchronous operations.
|
|
354
|
+
|
|
355
|
+
- **pipeAsync** - Compose async/sync functions (pure)
|
|
356
|
+
- **pipeAsyncSideEffect** - Async composition with SideEffect short-circuiting
|
|
357
|
+
- **delay** - Wait for specified milliseconds
|
|
358
|
+
- **timeout** - Execute promise with timeout limit
|
|
359
|
+
- **retry** - Retry failed operations with optional delay
|
|
360
|
+
- **debounce** - Debounce function calls (trailing)
|
|
361
|
+
- **debounceLeading** - Debounce with leading edge
|
|
362
|
+
- **debounceLeadingTrailing** - Debounce with both edges
|
|
363
|
+
- **throttle** - Throttle function calls
|
|
364
|
+
|
|
365
|
+
### Stream (Lazy Iterables)
|
|
366
|
+
|
|
367
|
+
Memory-efficient lazy evaluation for large datasets. Works with both sync and async iterables.
|
|
368
|
+
|
|
369
|
+
- **map** - Lazy map over iterable
|
|
370
|
+
- **filter** - Lazy filter
|
|
371
|
+
- **flatMap** - Lazy flatMap
|
|
372
|
+
- **flatten** - Lazy flatten (one level)
|
|
373
|
+
- **flattenDeep** - Lazy flatten (all levels)
|
|
374
|
+
- **take** - Take first n elements
|
|
375
|
+
- **takeWhile** - Take while predicate is true
|
|
376
|
+
- **drop** - Skip first n elements
|
|
377
|
+
- **dropWhile** - Skip while predicate is true
|
|
378
|
+
- **chunk** - Split into chunks
|
|
379
|
+
- **zip** - Combine two iterables
|
|
380
|
+
- **zipWith** - Combine with custom function
|
|
381
|
+
- **find** - Find first matching element
|
|
382
|
+
- **some** - Check if any element matches
|
|
383
|
+
- **every** - Check if all elements match
|
|
384
|
+
- **reduce** - Accumulate values
|
|
385
|
+
- **scan** - Emit intermediate accumulations
|
|
386
|
+
- **concat** - Concatenate iterables
|
|
387
|
+
- **append** - Add element to end
|
|
388
|
+
- **prepend** - Add element to start
|
|
389
|
+
- **range** - Generate lazy numeric range
|
|
390
|
+
- **toArray** - Materialize iterable to array
|
|
391
|
+
- **toAsync** - Convert to async iterable
|
|
392
|
+
|
|
393
|
+
### Nullable
|
|
394
|
+
|
|
395
|
+
Functions for handling nullable values safely.
|
|
396
|
+
|
|
397
|
+
- **maybe** - Safely transform nullable values
|
|
398
|
+
- **mapMaybe** - Apply function only if value exists
|
|
399
|
+
- **getOrElse** - Get value or return default
|
|
400
|
+
- **fold** - Handle both Some and None cases
|
|
401
|
+
- **result** - Wrap operation in Result type
|
|
402
|
+
|
|
403
|
+
### Debug
|
|
404
|
+
|
|
405
|
+
Functions for debugging and development.
|
|
406
|
+
|
|
407
|
+
- **assert** - Assert condition with error message
|
|
408
|
+
- **invariant** - Check invariant contracts
|
|
409
|
+
- **log** - Log value and pass through (for debugging pipes)
|
|
410
|
+
|
|
411
|
+
## Key Concepts
|
|
412
|
+
|
|
413
|
+
### SideEffect Pattern
|
|
414
|
+
|
|
415
|
+
**The JavaScript exception problem:** In functional pipelines, throwing exceptions breaks compositionβcontrol jumps out of the pipe. To avoid this, you need `try-catch` (which breaks flow) or wrap every function in `Either`/`Result` (which requires `map`/`chain` everywhere). Both solutions make you think about error plumbing instead of business logic.
|
|
416
|
+
|
|
417
|
+
**The SideEffect solution:** Write normal functions that compose naturally. When you need to terminate early (validation failure, missing data, errors), return `SideEffect.of(() => ...)`. `pipeSideEffect`/`pipeAsyncSideEffect` pipelines automatically stopβno ceremony, no wrappers, no plumbing.
|
|
418
|
+
|
|
419
|
+
```typescript
|
|
420
|
+
import { pipeSideEffect, SideEffect, runPipeResult } from 'fp-pack';
|
|
421
|
+
|
|
422
|
+
// Optional chaining pattern - return null to gracefully terminate
|
|
423
|
+
const findUser = (id: string) => {
|
|
424
|
+
const user = database.get(id);
|
|
425
|
+
return user ? user : SideEffect.of(() => null);
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
const emailPipeline = pipeSideEffect(
|
|
429
|
+
findUser,
|
|
430
|
+
(user) => user.email, // Skipped if user not found
|
|
431
|
+
(email) => email.toLowerCase()
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
// runPipeResult must be called OUTSIDE the pipeline
|
|
435
|
+
const email = runPipeResult(emailPipeline('unknown-id'));
|
|
436
|
+
// Returns null without errors - clean optional flow
|
|
437
|
+
|
|
438
|
+
// Practical: User notification flow
|
|
439
|
+
const paymentPipeline = pipeSideEffect(
|
|
440
|
+
validateCard,
|
|
441
|
+
(card) => card.balance >= 100
|
|
442
|
+
? card
|
|
443
|
+
: SideEffect.of(() => {
|
|
444
|
+
showToast('Insufficient balance');
|
|
445
|
+
logEvent('payment_failed', { reason: 'insufficient_funds' });
|
|
446
|
+
return null;
|
|
447
|
+
}),
|
|
448
|
+
chargeCard,
|
|
449
|
+
sendReceipt,
|
|
450
|
+
(receipt) => ({ success: true, receipt })
|
|
451
|
+
);
|
|
452
|
+
|
|
453
|
+
// runPipeResult must be called OUTSIDE the pipeline
|
|
454
|
+
const result = runPipeResult(paymentPipeline(userCard));
|
|
455
|
+
// If balance insufficient: shows toast, logs event, returns null
|
|
456
|
+
// Otherwise: completes payment and returns success object
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Key benefits:**
|
|
460
|
+
- Write normal functionsβno wrapper types
|
|
461
|
+
- Mark exceptional paths explicitly with `SideEffect.of()`
|
|
462
|
+
- `pipeSideEffect`/`pipeAsyncSideEffect` automatically short-circuit on `SideEffect`
|
|
463
|
+
- `runPipeResult` / `matchSideEffect` must be called **OUTSIDE** the pipeline for proper type safety
|
|
464
|
+
- Focus on business logic, not error infrastructure
|
|
465
|
+
|
|
466
|
+
**Type-safe result handling with `isSideEffect`:**
|
|
467
|
+
|
|
468
|
+
```typescript
|
|
469
|
+
import { pipeSideEffect, SideEffect, isSideEffect, runPipeResult } from 'fp-pack';
|
|
470
|
+
|
|
471
|
+
const processNumbers = pipeSideEffect(
|
|
472
|
+
(nums: number[]) => nums.filter(n => n % 2 === 1),
|
|
473
|
+
(odds) => odds.length > 0
|
|
474
|
+
? odds
|
|
475
|
+
: SideEffect.of(() => 'No odd numbers found'),
|
|
476
|
+
(odds) => odds.map(n => n * 2)
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
const oddsDoubled = processNumbers([1, 2, 3, 4, 5]);
|
|
480
|
+
|
|
481
|
+
// β
CORRECT: Use isSideEffect for type checking + provide generics to runPipeResult
|
|
482
|
+
if (!isSideEffect(oddsDoubled)) {
|
|
483
|
+
// TypeScript knows: oddsDoubled is number[]
|
|
484
|
+
const sum: number = oddsDoubled.reduce((a, b) => a + b, 0);
|
|
485
|
+
console.log(`Sum: ${sum}`); // sum: number
|
|
486
|
+
} else {
|
|
487
|
+
// TypeScript knows: oddsDoubled is SideEffect<string>
|
|
488
|
+
// But runPipeResult still returns number[] | string (not fully narrowed)
|
|
489
|
+
const error = runPipeResult<number[], string>(oddsDoubled);
|
|
490
|
+
console.log(`Error: ${error}`); // error: number[] | string
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// β WRONG: runPipeResult without generics
|
|
494
|
+
const result = runPipeResult(oddsDoubled); // result: any (no type information!)
|
|
495
|
+
|
|
496
|
+
// β
CORRECT: Provide generics to runPipeResult
|
|
497
|
+
const result = runPipeResult<number[], string>(oddsDoubled); // result: number[] | string (union type - safe but not narrowed)
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
**β οΈ CRITICAL: runPipeResult Type Safety**
|
|
501
|
+
|
|
502
|
+
`runPipeResult<T, R=any>` has a default type parameter `R=any`. This means:
|
|
503
|
+
|
|
504
|
+
- β **Without generics**: `const result = runPipeResult(pipeline(data));` returns `any` type (unsafe!)
|
|
505
|
+
- β
**With generics**: `runPipeResult<SuccessType, ErrorType>(result)` returns union type `SuccessType | ErrorType` (type-safe)
|
|
506
|
+
- β
**With isSideEffect**: Use for runtime checking whether a value is SideEffect
|
|
507
|
+
|
|
508
|
+
**Always provide generics to `runPipeResult`** for type safety. Use `isSideEffect` for runtime type checking.
|
|
509
|
+
|
|
510
|
+
### Pipe vs PipeAsync
|
|
511
|
+
|
|
512
|
+
**Default choice: Start with `pipe` / `pipeAsync`**
|
|
513
|
+
|
|
514
|
+
Most data transformations are pure and don't need SideEffect handling. Use `pipe` for sync operations and `pipeAsync` for async operations. **Only switch to SideEffect-aware pipes when you actually need** early termination or error handling with side effects.
|
|
515
|
+
|
|
516
|
+
- **`pipe`** - Synchronous, **pure** transformations (99% of cases)
|
|
517
|
+
- **`pipeAsync`** - Async, **pure** transformations (99% of cases)
|
|
518
|
+
- **`pipeSideEffect`** - **Only when you need** SideEffect short-circuiting (sync)
|
|
519
|
+
- **`pipeAsyncSideEffect`** - **Only when you need** SideEffect short-circuiting (async)
|
|
520
|
+
|
|
521
|
+
**Important:** `pipe` and `pipeAsync` are for **pure** functions onlyβthey don't handle `SideEffect`. If your pipeline can return `SideEffect`, use `pipeSideEffect` or `pipeAsyncSideEffect` instead.
|
|
522
|
+
|
|
523
|
+
```typescript
|
|
524
|
+
// Pure sync pipe - no SideEffect handling
|
|
525
|
+
const processNumbers = pipe(
|
|
526
|
+
filter((n: number) => n > 0),
|
|
527
|
+
map(n => n * 2),
|
|
528
|
+
sum
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
// Pure async pipe - no SideEffect handling
|
|
532
|
+
const fetchAndProcess = pipeAsync(
|
|
533
|
+
async (id: string) => fetchUser(id),
|
|
534
|
+
(user) => user.profile, // Sync step is OK
|
|
535
|
+
async (profile) => enrichProfile(profile)
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
// SideEffect-aware sync pipe
|
|
539
|
+
const validateAndProcess = pipeSideEffect(
|
|
540
|
+
(n: number) => n > 0 ? n : SideEffect.of(() => 'Invalid'),
|
|
541
|
+
(n) => n * 2
|
|
542
|
+
);
|
|
543
|
+
|
|
544
|
+
// SideEffect-aware async pipe
|
|
545
|
+
const fetchAndValidate = pipeAsyncSideEffect(
|
|
546
|
+
async (id: string) => fetchUser(id),
|
|
547
|
+
(user) => user.verified ? user : SideEffect.of(() => 'Not verified')
|
|
548
|
+
);
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### SideEffect Composition Rule
|
|
552
|
+
|
|
553
|
+
**π Critical Rule: SideEffect Contagion**
|
|
554
|
+
|
|
555
|
+
Once you use `pipeSideEffect` or `pipeAsyncSideEffect`, the result is **always `T | SideEffect`** (or `Promise<T | SideEffect>` for async).
|
|
556
|
+
|
|
557
|
+
If you want to continue composing this result, you **MUST** keep using SideEffect-aware pipes. You **CANNOT** switch back to `pipe` or `pipeAsync` because they don't handle `SideEffect`.
|
|
558
|
+
|
|
559
|
+
```typescript
|
|
560
|
+
import { pipe, pipeSideEffect, SideEffect } from 'fp-pack';
|
|
561
|
+
|
|
562
|
+
const validateUserPipeline = pipeSideEffect(
|
|
563
|
+
findUser,
|
|
564
|
+
validateAge
|
|
565
|
+
);
|
|
566
|
+
// Result type: User | SideEffect
|
|
567
|
+
|
|
568
|
+
// β WRONG - pipe cannot handle SideEffect
|
|
569
|
+
const wrongPipeline = pipe(
|
|
570
|
+
validateUserPipeline, // Returns User | SideEffect
|
|
571
|
+
(user) => user.email // Type error! SideEffect has no 'email' property
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
// β
CORRECT - Keep using pipeSideEffect
|
|
575
|
+
const correctPipeline = pipeSideEffect(
|
|
576
|
+
validateUserPipeline, // User | SideEffect - handled correctly
|
|
577
|
+
(user) => user.email, // Automatically skipped if SideEffect
|
|
578
|
+
sendEmail
|
|
579
|
+
);
|
|
580
|
+
|
|
581
|
+
// The same rule applies to async pipes
|
|
582
|
+
const asyncPipeline = pipeAsyncSideEffect(
|
|
583
|
+
fetchUser,
|
|
584
|
+
validateUser
|
|
585
|
+
);
|
|
586
|
+
// Result type: Promise<User | SideEffect>
|
|
587
|
+
|
|
588
|
+
// You must continue with pipeAsyncSideEffect, not pipeAsync
|
|
589
|
+
const extendedAsyncPipeline = pipeAsyncSideEffect(
|
|
590
|
+
asyncPipeline,
|
|
591
|
+
processUser,
|
|
592
|
+
saveToDatabase
|
|
593
|
+
);
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### Stream vs Array
|
|
597
|
+
|
|
598
|
+
Use `stream/*` for:
|
|
599
|
+
- Large datasets that don't fit in memory
|
|
600
|
+
- Operations that can short-circuit (take, find)
|
|
601
|
+
- Processing iterables without materializing to arrays
|
|
602
|
+
- Async data sources (AsyncIterable)
|
|
603
|
+
|
|
604
|
+
```typescript
|
|
605
|
+
import { pipe } from 'fp-pack';
|
|
606
|
+
import * as Stream from 'fp-pack/stream';
|
|
607
|
+
|
|
608
|
+
// Memory efficient - processes only 10 items
|
|
609
|
+
const first10Evens = pipe(
|
|
610
|
+
Stream.filter((n: number) => n % 2 === 0),
|
|
611
|
+
Stream.take(10),
|
|
612
|
+
Stream.toArray
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
first10Evens(Stream.range(1, 1000000)); // Only processes ~10 items, not 1 million
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
## What You Get
|
|
619
|
+
|
|
620
|
+
- π§ **96+ Utility Functions** - Organized into 10 practical categories
|
|
621
|
+
- π¨ **Composable Design** - Built for pipes, currying, and function composition
|
|
622
|
+
- π¦ **Modern Builds** - ESM and UMD formats for any environment
|
|
623
|
+
- π³ **Tree-Shakeable** - Import only what you need
|
|
624
|
+
- β‘ **Zero Dependencies** - No bloat, just pure TypeScript
|
|
625
|
+
- πͺ **Full Type Safety** - Strong inference with minimal annotations
|
|
626
|
+
|
|
627
|
+
## Import Paths
|
|
628
|
+
|
|
629
|
+
```typescript
|
|
630
|
+
// Main library (implement/*)
|
|
631
|
+
import { pipe, map, filter, pipeAsync } from 'fp-pack';
|
|
632
|
+
|
|
633
|
+
// Stream functions (lazy iterables)
|
|
634
|
+
import { map, filter, toArray, range } from 'fp-pack/stream';
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## Development
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
# Install dependencies
|
|
641
|
+
pnpm install
|
|
642
|
+
|
|
643
|
+
# Build library
|
|
644
|
+
pnpm build
|
|
645
|
+
|
|
646
|
+
# Run tests
|
|
647
|
+
pnpm test
|
|
648
|
+
|
|
649
|
+
# Run dev server
|
|
650
|
+
pnpm dev
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
## Acknowledgements
|
|
654
|
+
|
|
655
|
+
fp-pack was inspired by and learned from excellent functional programming libraries in the JavaScript ecosystem:
|
|
656
|
+
|
|
657
|
+
- **[Ramda](https://ramdajs.com/)** - A practical functional library that pioneered many of the patterns we use today
|
|
658
|
+
- **[FxJS](https://github.com/marpple/FxJS)** and **[FxTS](https://github.com/marpple/FxTS)** - Inspired by their exceptional combination of lazy evaluation and functional tooling patterns
|
|
659
|
+
|
|
660
|
+
While fp-pack's implementation approaches differ (using generator functions, the SideEffect pattern, and pipe-first composition), we're deeply grateful for the influence these projects had on functional programming in JavaScript.
|
|
661
|
+
|
|
662
|
+
## License
|
|
663
|
+
|
|
664
|
+
MIT
|