1.0.0 • Published 11 years ago

bindjs v1.0.0

Weekly downloads
6
License
-
Repository
github
Last release
11 years ago

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