partial-application
v0.0.17
Published
Enables partial application without affecting the receiver (ie. 'this').
Downloads
963
Maintainers
Readme
partial-application
Enables partial application without affecting the receiver (ie. this
).
File size: 592 bytes. Supported platforms: server and browser. Supported language versions: ES3 and above.
Also includes a function that will return a function with an arity of one, that can be useful when working with frameworks like Grunt that look at the arity of functions.
If you use this library in your software please tweet me @benastontweet.
Installation
npm install partial-application
Example
var partial = require('partial-application').partial;
function foo() {
console.log(arguments, this);
}
// Bare invocation.
partial(foo, 0)(1, 2); // { '0': 0, '1': 1, '2': 2 } { /* the global object */ }
// Method invocation.
var o = {};
o.m = partial(foo, 0);
o.m(1, 2); // { '0': 0, '1': 1, '2': 2 } { m: [Function] }
License & Copyright
This software is released under the MIT License. It is Copyright 2015, Ben Aston. I may be contacted at [email protected].
How to Contribute
Pull requests including bug fixes, new features and improved test coverage are welcomed. Please do your best, where possible, to follow the style of code found in the existing codebase.