UNPKG

442 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Checks whether a value is a function
5 *
6 * **Aliases** _func_, _fn_
7 * @function function
8 *
9 * @example
10 * var is = require('predicates');
11 *
12 * is.function(function() {}); // true
13 * is.function(alert); // true
14 * is.function('alert'); // false
15 *
16 * @param {*} value
17 * @returns {Boolean}
18 */
19module.exports = function isFunction(value) {
20 return Object.prototype.toString.call(value) === '[object Function]';
21};
22