pipe
, pipeline
, and compose
functions with 64 overloads per function.
This package not only provides simple pipe
, pipeline
, and compose
implementation, it also provides 64 TypeScript overloads for each function. [See index.d.ts]
URLs to import from: (replace :VERSION
with suitable version, which are git tags)
- GitHub User Content:
https://raw.githubusercontent.com/KSXGitHub/deno-compose/:VERSION/index.js
- GitHub Pages:
https://ksxgithub.github.io/deno-compose/index.js
(always master branch) - Deno Third-Party Modules:
https://deno.land/x/compose@:VERSION/index.js
Code Example:
import {
pipe,
pipeline,
compose,
pipeUnary,
pipelineUnary,
composeUnary,
} from 'https://deno.land/x/compose@1.0.0/index.js'
Signature: pipe (value, ...functions) → result
const y = pipe(x0, f1, f2, f3)
is equivalent to
const x1 = f1(x0)
const x2 = f2(x1)
const y = f3(x2)
or
const y = f3(f2(f1(x0)))
Signature: pipeline (...functions) → function
const fn = pipeline(f0, f1, f2, f3)
is equivalent to
const fn = (...args) => f3(f2(f1(f0(...args))))
Signature: compose (...functions) → function
const fn = compose(f3, f2, f1, f0)
is equivalent to
const fn = (...args) => f3(f2(f1(f0(...args))))
Signature: pipeline (...functions) → function
const fn = pipe(f0, f1, f2, f3)
is equivalent to
const fn = x => f3(f2(f1(f0(x))))
Signature: compose (...functions) → function
const fn = compose(f3, f2, f1, f0)
is equivalent to
const fn = x => f3(f2(f1(f0(x))))
It is just an alias of pipeline
It is just an alias of pipelineUnary
// pipe
const y0 = pipe(x, f1, f2, f3, f4)
// pipeline
const g1 = pipeline(f0, f1, f2, f3, f4)
const y1 = g1(...args)
// compose
const g2 = compose(f4, f3, f2, f1, f0)
const y2 = g2(...args)
This project is formatted according to sane-fmt.