Normalize function arguments.
So you can easily do things like:
function doSomething() {
var args = nargs(arguments);
console.log(args[0]);
console.log(args[1]);
}
doSomething('a', 'b'); // 'a', 'b'
doSomething(['a', 'b']); //'a', 'b'
npm install nargs
See the test suite for more examples and expected output.
node-nargs
was written by JP Richardson. You should follow him on Twitter @jprichardson. Also read his coding blog Procbits. If you write software with others, you should checkout Gitpilot to make collaboration with Git simple.
(MIT License)
Copyright 2012, JP Richardson jprichardson@gmail.com