argshift
argshift takes a function, and returns the same function but with its arguments shifted one to the left, and into context
installation
npm install argshift
usage
An explanatory example
// using a builtin method sucks. var capitalize = StringprototypetoUpperCase // -> throws: TypeError: String.prototype.toUpperCase called on null or undefined var capitalize = StringprototypetoUpperCasecall // -> throws: TypeError: capitalize is not a function var capitalize = StringprototypetoUpperCasecall // -> LOUD NOISES // and yes, this works// but its crazy long and odd to reason about// so instead you can just.. var capitalize = // -> LOUD NOISES!!!
A more examply example
var argshift = var reduce = // now reduce works on both arrays and strings!// -> 10// -> 'fdsa'
license
MIT