JSPM

switchy

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 96
  • Score
    100M100P100Q94567F
  • License MIT

Replace `switch` with switchy.

Package Exports

  • switchy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (switchy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


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