if-fun
v1.0.1
Published
Returns the first argument if it is a function (regular, async, generator, …), or your custom fallback value otherwise.
Downloads
106
Readme
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