switchy

0.1.0 • Public • Published


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

Readme

Keywords

none

Package Sidebar

Install

npm i switchy

Weekly Downloads

459

Version

0.1.0

License

MIT

Last publish

Collaborators

  • kchan