bind-append

1.0.1 • Public • Published

bind-append

Creates a new function with the given this and the appended arguments.

. It works like Function.prototype.bind

.. but does not pollute Function.prototype

... and appends the arguments to the new Function arguments

.... instead of prepending them

install

npm i -S bind-append

use

var bindAppend = require('bind-append');
 
function linear(x, a, b) {
    return a + b * x;
}
 
var fn = bindAppend(linear, null, 1, 2);
 
assert.equal(fn(0), 1);
assert.equal(fn(1), 3);
assert.equal(fn(2), 5);
 

test

npm test

API

bindAppend(function, thisArg[, arg1[, arg2[, ...]]])

license

MIT

author

Andi Neck @andineck

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i bind-append

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • andineck