UNPKG

moltres-utils

Version:
43 lines (34 loc) 1.26 kB
"use strict"; require("core-js/modules/es6.object.define-property"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _baseGetTag = _interopRequireDefault(require("./baseGetTag")); var _isObject = _interopRequireDefault(require("./isObject")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Checks if `value` is classified as a `Function` object. * * @function * @since v0.0.3 * @category lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * isFunction(function() {}) // => true * * isFunction(/abc/) // => false */ var isFunction = function isFunction(value) { if (!(0, _isObject.default)(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = (0, _baseGetTag.default)(value); return tag == '[object Function]' || tag == '[object AsyncFunction]' || tag == '[object GeneratorFunction]' || tag == '[object Proxy]'; }; var _default = isFunction; exports.default = _default; //# sourceMappingURL=isFunction.js.map