UNPKG

@rxap/utilities

Version:

A collection of utility functions, types and interfaces.

29 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IsFunction = IsFunction; /** * This function checks if a given value is a function or not. * * @template ReturnType The expected return type of the function. * @template ArgumentTypes An array type representing the expected argument types of the function. * * @param {any} value The value to be checked. * * @returns {boolean} Returns true if the provided value is a function, otherwise returns false. * * @example * * // returns: true * IsFunction<Number, [string, number]>((a: string, b: number) => a.length + b); * * // returns: false * IsFunction<Number, [string, number]>(123); * * @remarks * This function uses TypeScript's type predicates, so it not only checks if the value is a function, * but also narrows down the type of the value if it is a function. */ function IsFunction(value) { return typeof value === 'function' && !value.prototype; } //# sourceMappingURL=is-function.js.map