Skip to content

Similar to the Unix `|` operator; returns a function that invokes the given series of functions whose output is subsequently passed to the next function in the series.

License

Notifications You must be signed in to change notification settings

wilmoore/function-pipeline.js

Repository files navigation

function-pipeline

Similar to the Unix | operator; returns a function that invokes the given series of functions whose output is subsequently passed to the next function in the series.

Build Status Code Climate js-standard-style

npm install function-pipeline --save

You can also use Duo, Bower or download the files manually.

npm stats

npm NPM downloads David

API Example

var pipeline = require('function-pipeline')

var word = text => text.split(/\s+/)
var reverse = list => list.reverse()
var join = list => list.join(' ')
var text = 'dog lazy the over jumps fox brown quick The'
var pipe = pipeline(word, reverse, join)

Promise.resolve(text).then(pipe)
//=> The quick brown fox jumps over the lazy dog

API

pipe(…Function|Function[])

arguments
  • fns (…Function|Function[]) Functions to apply as an argument list or array of arguments.
returns
  • (Function) Function that invokes the given series of functions.

Inspiration

Alternatives

Contributing

SEE: contributing.md

Licenses

GitHub license

About

Similar to the Unix `|` operator; returns a function that invokes the given series of functions whose output is subsequently passed to the next function in the series.

Resources

License

Stars

Watchers

Forks

Packages

No packages published