1.0.0 • Published 5 years ago

condit v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

condit

Build Status

condit is a package that allows you to write conditional expressions for jsx-like syntax.

Installation

npm i -S condit

Usage

const condit = require('condit')

condit(1)
.when(1, 'one')
.when(2, 'two')
.do()

// return 'one'

condit(3)
.when(1, 'one')
.when(2, 'two')
.otherwise('not found')
.do()

// return 'not found'

condit(3, 'default variable')
.when(1, 'one')
.when(2, 'two')
.do()

// return 'default variable'

License

MIT