20 lines
516 B
JavaScript
20 lines
516 B
JavaScript
|
|
//#region src/predicate/isFunction.ts
|
||
|
|
/**
|
||
|
|
* Checks if `value` is a function.
|
||
|
|
*
|
||
|
|
* @param {any} value The value to check.
|
||
|
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||
|
|
*
|
||
|
|
* @example
|
||
|
|
* isFunction(Array.prototype.slice); // true
|
||
|
|
* isFunction(async function () {}); // true
|
||
|
|
* isFunction(function* () {}); // true
|
||
|
|
* isFunction(Proxy); // true
|
||
|
|
* isFunction(Int8Array); // true
|
||
|
|
*/
|
||
|
|
function isFunction(value) {
|
||
|
|
return typeof value === "function";
|
||
|
|
}
|
||
|
|
//#endregion
|
||
|
|
exports.isFunction = isFunction;
|