1.0.3 • Published 6 years ago
farnsworth-attach v1.0.3
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()