switchy
Replace `switch` with switchy.
Last updated 4 years ago by kchan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install switchy 
SYNC missed versions from official npm registry.


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

Current Tags

  • 0.1.0                                ...           latest (4 years ago)

1 Versions

  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 2
Last Day 0
Last Week 0
Last Month 5
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |