1.0.0 • Published 2 years ago
pipeable-es-fns v1.0.0
pipeable-es-fns
A typed, curried, ES6+ functions library for pipe style programming.
Use it when
- You like pipe style programming.
- But Ramda is too cumbersome for you.
- And fp-ts introduce too many FP concepts than you want.
- You just want to use native ES6+ functions with pipe style programming.
Example
import {array, object, pipe} from 'pipeable-es-fns'
const _a = pipe(
[1, 2, 3],
array.map((a) => [a, a] as const),
object.fromEntries
)
const _b = pipe({a: 1, b: 2}, object.entries, object.fromEntries)
Design philosophy
- Just curried the ES6+ functions and try to keep others untouched.
- Just use the TypeScript official type definitions of ES6+ functions.
- Just delegate the implementation to the native ES6+ functions for avoid runtime.
- Unlike Ramda, the pipe function accepts data as it's first argument for better type inference.
- Organize the functions in a namespace rather than function overload for better type inference.
- Doesn't support deprecated methods intentionally.
- Encourage to specify the optional arguments implicitly.
- Encourage to use one function in one way only.