bind-array

1.0.0 • Public • Published

Bind-Array

Utility function for binding an array of arguments to a function. Same as apply but without invoking the function.

Usage

var bindArray = require("bind-array");
 
function foo(a, b, c, d, e) {
    console.log(this, a, b, c, d, e)
}
 
var bound = bindArray(foo, "this arg", [1, 2, 3, 4, 5]);
bound(); // prints "this arg", 1, 2, 3, 4, 5

API

bindArray(fn:function, thisArg:any, args:array or args:arguments) : function

Package Sidebar

Install

npm i bind-array

Weekly Downloads

2

Version

1.0.0

License

ISC

Last publish

Collaborators

  • simplej