ternary
Version:
Build a ternary statement
51 lines (28 loc) • 732 B
Markdown
> Build a ternary statement
```
$ npm install --save ternary
```
```js
var ternary = require('ternary')
ternary('condition', 'whenTruthy' : 'whenFalsy')
//=> condition ? whenTruthy : whenFalsy
```
*Required*
Type: `string`
The ternary condition.
*Required*
Type: `string`
The expression to use when the condition is truthy.
*Required*
Type: `string`
The expression to use when the condition is falsy.
MIT © [Ben Drucker](http://bendrucker.me)