Skip to content
Switch as expressions for JavaScript
JavaScript HTML
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
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' );
You can’t perform that action at this time.