Socket
Book a DemoInstallSign in
Socket

blind-bind

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blind-bind

Bind arguments before you have the function

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

blind-bind Build Status

Bind arguments before you have the function

Install

$ npm install --save blind-bind

Usage

var bind = require('blind-bind');

// bind some args - returns a callback
var bound = bind(3, 2);

// declare some functions
function add(a, b) {
  return a + b;
}

function subtr(a, b) {
  return a - b;
}

bound(add); // => 5;

bound(subtr); // => 1;

// really useful in array.map / array.forEach
[add, subtr].map(bound);  // => [5, 1]; 


// partial binding
var partial = bind(4);

// you can add args after the fact (first arg must be a function)
partial(add, 5); // => 9;

License

MIT © James Talmage

Keywords

function

FAQs

Package last updated on 07 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts