1.0.0 • Published 5 years ago
condit v1.0.0
condit
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
1.0.0
5 years ago