ternary
Build a ternary statement
Last updated 9 years ago by bendrucker .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install ternary 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (9 years ago)

1 Versions

  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |