ternary

1.0.0 • Public • Published

ternary Build Status

Build a ternary statement

Install

$ npm install --save ternary

Usage

var ternary = require('ternary')
 
ternary('condition', 'whenTruthy' : 'whenFalsy')
//=> condition ? whenTruthy : whenFalsy

API

ternary(condition, expr1, expr2) -> string

condition

Required
Type: string

The ternary condition.

expr1

Required
Type: string

The expression to use when the condition is truthy.

expr2

Required
Type: string

The expression to use when the condition is falsy.

License

MIT © Ben Drucker

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    24,012
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    24,012

Package Sidebar

Install

npm i ternary

Weekly Downloads

19,885

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker