https://github.com/seangenabe/iif
The IIf function in Javascript
https://github.com/seangenabe/iif
conditional iif ternary
Last synced: 7 months ago
JSON representation
The IIf function in Javascript
- Host: GitHub
- URL: https://github.com/seangenabe/iif
- Owner: seangenabe
- Created: 2016-06-23T20:48:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-17T21:32:17.000Z (over 7 years ago)
- Last Synced: 2025-03-01T04:55:51.686Z (7 months ago)
- Topics: conditional, iif, ternary
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# iif
The IIf function in Javascript
[](https://www.npmjs.com/package/iif)
[](https://travis-ci.org/seangenabe/iif)
[](https://coveralls.io/github/seangenabe/iif?branch=master)## Usage
### `iif(condition, ifTrue, [ifFalse])`
`var iif = require('iif')`
Returns `ifTrue` if `condition` is truthy. Otherwise, returns `ifFalse`.
### `iifBranch(condition, ifTrueFunc, [ifFalseFunc])`
`var iif = require('iif/branch')`
Same as above, but additionally calls the argument being returned if it's a function.
## License
CC0-1.0