…a tiny library whose end goal is to make argument-sniffing code like this obsolete, by providing an easy way to declare what arguments a function expects.
argment is brand new! For the moment, it augments any function to take an options hash, and expands it into nice, old-fashioned arguments. Like this:
function foo(a, b, c){
console.log(a, b, c);
}
foo = argment(['a', 'b', 'c'], foo);
foo({ a: 'one', c: 'three' });
Just call argment
with a function and an array describing the arguments it takes.