effectuate
v0.3.2
Published
Run exported function from any script passing in arguments from the command line. First argument can be passed in through stdin.
Readme
Effectuate
Run exported function from any script passing in arguments from the command line. First argument can be passed in through stdin.
Install
$ npm install -g effectuateUsage
Passing arguments
// multiply.js
module.exports = (a, b) => a * b$ effectuate multiply 5 10
50Named arguments
// getName.js
module.exports = config => config.first + ' ' + config.last$ effectuate ./getName --first=John --last=Doe
John DoeUsing stdin
// double.js
module.exports = n => n * 2$ echo 10 | effectuate-piped ./double
20Can also provide stdin line by line:
$ echo -e "1\n2\n3" | effectuate-byline ./double
2
4
6Returning a promise
// delay.js
module.exports = value => new Promise(
resolve => setTimeout(() => resolve(value), 100)
)$ effectuate ./delay foo
foo