schnuller
v1.0.0
Published
Silence methods
Downloads
5
Readme
Schnuller
[ˈʃnʊlɐ]
- Silence methods of an object
- Create silenced copies
- Create objects with noop methods
Installation
yarn add schnuller
Usage
Silence console log globally
import Schnuller from 'schnuller'
window.console = new Schnuller(window.console, 'log')
console.log('Test') // => undefined
Silenced copies
import Schnuller from 'schnuller'
const foo = {
hello(name = 'world') {
return `Hello ${name}`
},
bye(name = 'world') {
return `Bye ${name}`
}
}
const bar = new Schnuller(foo, 'bye')
bar.hello() // => 'Hello World'
bar.bye() // => undefined
foo.hello() // => 'Hello World'
foo.bye() // => 'Bye World'
Empty with noops
import Schnuller from 'schnuller'
const bar = new Schnuller({}, 'bye')
bar.bye() // => undefined
Contributing
Testing
yarn test
© 2017 by Gregor Adams
Logo via onlinewebfonts