binderify
v1.0.2
Published
Easily bind every method in an object, to the object.
Downloads
7
Readme
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);