binderify

1.0.2 • Public • Published

Works with classes and simple objects

class Node {
    constructor(data) {
        binderify(this);

        this.data = data;
    }

    report() {
        return this.data;
    }
}

const node = new Node(128);
const method = node.report;
assert.equal(method(), 128);
const obj = {
    val: 64,
    ret: function() {
        return this.val;
    },
};

binderify(obj);

const method = obj.ret;
assert.equal(method(), 64);

Readme

Keywords

none

Package Sidebar

Install

npm i binderify

Weekly Downloads

3

Version

1.0.2

License

MIT

Last publish

Collaborators

  • chrisantaki