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.
Downloads
2
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 effectuate
Usage
Passing arguments
// multiply.js
module.exports = (a, b) => a * b
$ effectuate multiply 5 10
50
Named arguments
// getName.js
module.exports = config => config.first + ' ' + config.last
$ effectuate ./getName --first=John --last=Doe
John Doe
Using stdin
// double.js
module.exports = n => n * 2
$ echo 10 | effectuate-piped ./double
20
Can also provide stdin line by line:
$ echo -e "1\n2\n3" | effectuate-byline ./double
2
4
6
Returning a promise
// delay.js
module.exports = value => new Promise(
resolve => setTimeout(() => resolve(value), 100)
)
$ effectuate ./delay foo
foo