farnsworth-attach
v1.0.3
Published
Attach method implementations to classes
Downloads
9
Readme
attach()
Syntactical sugar to make it a bit nicer to attach functions to classes
Kind: global function
Example
// example.js
let attach = require('farnsworth-attach')
// document your class...
class Foo {
// document your method...
bar() {}
// document your constructor...
constructor() {
attach(this, bar)
}
}
function bar() {
console.log('I was attached')
}
let foo = new Foo()
foo.bar()