Skip to main content

isFunction

A function that checks if the given argument is a function and, if so, narrows the argument's type to Function.


Interface

typescript
const isFunction: (arg: unknown) => arg is Function

Usage

import { isFunction } from '@devgrace/utils';

function example() {}

isFunction(() => {}); // true
isFunction(example); // true

isFunction('123'); // false
isFunction(123); // false
isFunction({}); // false
isFunction([]); // false