import { object_type } from "./object" /** * AnyFunction type * * @typeParam R - function return type */ export type AnyFunction = (...args: any[]) => R /** * Test value is function * * @param value - value * @returns test result * @example ```ts * is_function(function() {}) // true * is_function(function*() {}) // true * is_function(()=>{}) // true * is_function(class {}) // true * ``` */ export function is_function(value: unknown): value is AnyFunction { return 'function' === typeof value || 'Function' === object_type(value) }