do-pipeline
v0.0.16
Published
Make pipeline of functions into pipeline of functions into pipeline of...
Downloads
5
Maintainers
Readme
do-pipeline ·
do-pipeline
is a minimalist pipeline library for your data workflows.
- Put your params first then let's chain your functions
- Promise based: it's
bluebird
friendly - Pipelineception: you can put pipelines into a pipeline and so on!
- So simple it works everywhere and it's way more easier to read!
By using it, it feels like to go from programmer to scenarist!
Thank you for using this small piece of code in your projects 😍
Install it
npm i --save do-pipeline
Usage
// with import
import Pipeline from 'do-pipeline';
// with require
const Pipeline = require('do-pipeline');
Simple usage :
const Pipeline = require("do-pipeline");
const Promise = require("bluebird");
const capitalize = str => str[0].toUpperCase() + str.substring(1);
const splitOnSpaces = str => str.trim().split(" ");
const getLastOfArr = arr => arr.pop();
const toUpper = values => values.toUpperCase();
const wait = async values => {
await Promise.delay(500);
return values;
};
Pipeline([
"love food",
capitalize,
wait,
splitOnSpaces,
getLastOfArr,
toUpper
])
.then(data => console.log(data));
// FOOD
For more example, just take a look at the unit test file !
Have fun 😄