root / HServer / 00.Server / 00.Program / node_modules / lodash / isFunction.js
이력 | 보기 | 이력해설 | 다운로드 (993 Bytes)
| 1 | 39 | HKM | var baseGetTag = require('./_baseGetTag'), |
|---|---|---|---|
| 2 | isObject = require('./isObject');
|
||
| 3 | |||
| 4 | /** `Object#toString` result references. */
|
||
| 5 | var asyncTag = '[object AsyncFunction]', |
||
| 6 | funcTag = '[object Function]',
|
||
| 7 | genTag = '[object GeneratorFunction]',
|
||
| 8 | proxyTag = '[object Proxy]';
|
||
| 9 | |||
| 10 | /**
|
||
| 11 | * Checks if `value` is classified as a `Function` object.
|
||
| 12 | *
|
||
| 13 | * @static
|
||
| 14 | * @memberOf _
|
||
| 15 | * @since 0.1.0
|
||
| 16 | * @category Lang
|
||
| 17 | * @param {*} value The value to check.
|
||
| 18 | * @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||
| 19 | * @example
|
||
| 20 | *
|
||
| 21 | * _.isFunction(_);
|
||
| 22 | * // => true
|
||
| 23 | *
|
||
| 24 | * _.isFunction(/abc/);
|
||
| 25 | * // => false
|
||
| 26 | */
|
||
| 27 | function isFunction(value) { |
||
| 28 | if (!isObject(value)) {
|
||
| 29 | return false; |
||
| 30 | } |
||
| 31 | // The use of `Object#toString` avoids issues with the `typeof` operator
|
||
| 32 | // in Safari 9 which returns 'object' for typed arrays and other constructors.
|
||
| 33 | var tag = baseGetTag(value);
|
||
| 34 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
||
| 35 | } |
||
| 36 | |||
| 37 | module.exports = isFunction; |