File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import getTag from './.internal/getTag.js'
2- import isObject from './isObject.js'
31
42/**
53 * Checks if `value` is classified as a `Function` object.
@@ -10,21 +8,26 @@ import isObject from './isObject.js'
108 * @returns {boolean } Returns `true` if `value` is a function, else `false`.
119 * @example
1210 *
13- * isFunction(_ )
11+ * isFunction(class Any{} )
1412 * // => true
1513 *
14+ * isFunction(() => {})
15+ * // => true
16+ *
17+ * isFunction(async () => {})
18+ * // => true
19+ *
20+ * isFunction(function * Any() {})
21+ * // => true
22+ *
23+ * isFunction(Math.round)
24+ * // => true
25+ *
1626 * isFunction(/abc/)
1727 * // => false
1828 */
1929function isFunction ( value ) {
20- if ( ! isObject ( value ) ) {
21- return false
22- }
23- // The use of `Object#toString` avoids issues with the `typeof` operator
24- // in Safari 9 which returns 'object' for typed arrays and other constructors.
25- const tag = getTag ( value )
26- return tag == '[object Function]' || tag == '[object AsyncFunction]' ||
27- tag == '[object GeneratorFunction]' || tag == '[object Proxy]'
30+ return typeof value === 'function'
2831}
2932
3033export default isFunction
You can’t perform that action at this time.
0 commit comments