Check if the value is a function, using the typeof operator.
typeof
Why needed? Because lodash _.isFunction(value) fails for async generator functions:
_.isFunction(value)
console.log(.isFunction(a_GeneratorFunction_async_named)) console.log(.isFunction(a_GeneratorFunction_async_anonymous))
both print false
false
The z.isFunction returns true for both.
z.isFunction
true
Use isRealFunction() to exclude classes.
boolean true if value is any kind of function, including classes. Use isRealFunction() to exclude classes.
Check if the value is a function, using the
typeof
operator.Why needed? Because lodash
_.isFunction(value)
fails for async generator functions:console.log(.isFunction(a_GeneratorFunction_async_named)) console.log(.isFunction(a_GeneratorFunction_async_anonymous))
both print
false
The
z.isFunction
returnstrue
for both.See
Use isRealFunction() to exclude classes.