1.0.0 • Published 5 years ago

pipe-it-down v1.0.0

Weekly downloads
1
License
ISC
Repository
gitlab
Last release
5 years ago

pipe-it-down

Extremely barebones implementation of pipes, inspired by Elixir.

To use it, simply kick off a chain, optionally supplying an initial value.

If no initial value, it will default to null.

Example:

Javascript:

 // node import
 const { chain } = require('pipe-it-down');
 
 // es6-style import
 import { chain } from 'pipe-it-down';

 const totalDataset = chain(dataset)
   .pipe( normalize )
   .pipe( assignWeights(weights) )
   .pipe( average )
   .end();

Which would be equivalent to typing out:

const totalDataset = average(assignWeights(weights)(normalize(dataset)))

or somewhat cleaner:

const normalized = normalize(dataset);
const weighted = assignWeights(weights)(normalized);
const totalDataset = average(weighted);

Note:

If operating over arrays, this is very similar to map/filter/reduce combinations.

1.0.0

5 years ago