is-self
v1.0.1
Published
Check if module is self-evoked. Run module methods directly from command line
Downloads
9
Readme
Overview
If you want to run a module directly with node and give arguments through command line
Example
Say, you have module like:
var isSelf = require('isSelf');
var veryUsefulModule = {
methodA: function(foo, bar, bax){
console.log("foo=%s, bar=%s, bax=%s",foo, bar, bax);
},
methodB: function(foo){
console.log(foo);
}
};
module.exports = veryUsefulModule;
isSelf(module).checkAndRun();
Now you can run it from command line like:
node veryUsefulModule -m methodA 1 2 // foo=1, bar=2, bax=undefined
node veryUsefulModule -m methodC 1 2 // Module does not have a "methodC" method