Function isFunction

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 returns true for both.

Use isRealFunction() to exclude classes.

  • Parameters

    • value: unknown

    Returns value is Function

    boolean true if value is any kind of function, including classes. Use isRealFunction() to exclude classes.