Skip to main content

isFunction

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


Code

🔗 View source code

Interface

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

Usage

typescript
import { isFunction } from '@modern-kit/utils';

function example() {}

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

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