Switch as expressions for JavaScript
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.jshintrc
.travis.yml
README.md
gulpfile.js
index.html
package.json

README.md

Switch expressions Build Status

Switch as an expression in Javascript, inspired by @FGRibreau's https://github.com/FGRibreau/if-exp.

Install

npm install switch-exp

## Usage

import _switch from 'switch-exp';

const a = _switch( thing )
    .case( condition1 )
        .then( 'value1' )
    .case( condition2 )
        .then( 'value2' )
    .default( 'defaultValue' );