isFunction

A TypeScript type guard that checks whether a value is callable, narrowing it to a function type so you can safely invoke it in your code.

Usage

Check whether a value is a function. This is a TypeScript type guard function.

import { isFunction } from '@movk/core'

isFunction(() => {}) // => true
isFunction(Math.abs) // => true
isFunction({}) // => false

API

isFunction(value: any): value is (...args: any[]) => any

Parameters

value
any required
The value to check.

Returns

boolean
Returns true if the value is a function, otherwise false.

Changelog

No recent changes
Copyright © 2024 - 2026 YiXuan - MIT License