1.0.1 • Published 2 years ago
if-fun v1.0.1
if-fun
Returns the first argument if it is a function (regular, async, generator, …), or your custom fallback value otherwise.
API
This module exports one function:
ifFun(x, no)
Return x
if x
seems to be some kind of function, otherwise return no
.
In case no
is omitted, JavaScript rules makes it default to undefined
.
Usage
See test/usage.js for examples.
Known issues
- Needs more/better tests and docs.
License
ISC