enslave

v0.0.2
binds `this` to a function's first argument
enslave liberate this bind

What is enslave?

enslave is the inverse function of liberate

Usage

var enslave = require('enslave')

function add(a, b){ return a.value + b.value }

var n = {add: enslave(add)}

var A = Object.create(n)
A.value = 1

var B = Object.create(n)
B.value = 2

A.add(B)  // returns 3

Credits

Ripped straight from sinful.js, as I found it useful on its own.

npm i enslave

Metadata

Downloads

Maintainers