bindjs

Function.prototype.bind() extension

npm install bindjs
1 downloads in the last week
8 downloads in the last month

bind.js

Simple extension of Function.prototype.bind().

Supported platforms

  • Web
  • node.js ( npm install bindjs )

Usage

require('./bind');

function test(a, b, c, d) {
    console.log(a);
    console.log(b);
    console.log(c);
    console.log(d);
    console.log();
}

test.bind(null, 9)(1, 2, 3); // 9 1 2 3
test.bind(null, $0, 9, $1, $2)(1, 2, 3); // 1 9 2 3

var obj = {foo: 1, bar: 2};
test.bind(null, $this).call(obj, 1, 2, 3); // { foo: 1, bar: 2 } 1 2 3
npm loves you