lodash-get-arguments
v0.5.10
Published
Lodash mixin which assigns arbitrary arguments to named keys which correspond to named predicates in an object.
Downloads
15
Maintainers
Readme
Lodash getArguments
Lodash mixin which assigns arbitrary arguments to named keys which correspond to named predicates in an object.
Usage
function myFunction() {
var a = _.getArguments(arguments, {
name: function (b) {
return typeof b === 'string';
},
node: function (b) {
return !!b && typeof b === 'object' && !!b.nodeType;
},
callback: function (b) {
return typeof b === 'function';
}
});
}
myFunction(myCallback, 'Sean', document.querySelector('div'));
// → { name: 'Sean', node: document.querySelector('div'), callback: myCallback }
Not all arguments supplied
myFunction(myCallback, document.querySelector('div'));
// → { name: false, node: document.querySelector('div'), callback: myCallback }