switchy

Replace `switch` with switchy.


License
MIT
Install
npm install switchy@0.1.0

Documentation


Replace switch with switchy.
http://chimera.labs.oreilly.com/books/1234000000262/apa.html#dont_use_switch

NPM version NPM downloads Build Status

Install

$ npm install --save switchy

Usage

const switchy = require('switchy')

const chooseFruit = switchy({
  apple() {
    console.log('apple')
  },
  peach() {
    console.log('peach')
  },
  default() {
    console.log('no idea what you want')
  }
})

chooseFruit('apple')
//=> apple
chooseFruit('watermelon')
//=> no idea what you want

License

MIT © EGOIST