schnuller

1.0.0 • Public • Published

Schnuller

[ˈʃnʊlɐ]

npm Standard Version GitHub license GitHub issues

Travis branch bitHound bitHound Coveralls

logo

  • 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

Readme

Keywords

none

Package Sidebar

Install

npm i schnuller

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • pixelass