Simplify isType modules.

This commit is contained in:
John-David Dalton
2017-01-10 13:44:02 -08:00
parent b2f69ea36a
commit 4ecd69e4fa
24 changed files with 50 additions and 217 deletions

View File

@@ -1,12 +1,6 @@
import baseGetTag from './.internal/baseGetTag.js';
import isObject from './isObject.js';
/** `Object#toString` result references. */
const asyncTag = '[object AsyncFunction]';
const funcTag = '[object Function]';
const genTag = '[object GeneratorFunction]';
const proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
@@ -29,7 +23,8 @@ function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
const tag = baseGetTag(value);
return tag == funcTag || tag == asyncTag || tag == genTag || tag == proxyTag;
return tag == '[object Function]' || tag == '[object AsyncFunction]' ||
tag == '[object GeneratorFunction]' || tag == '[object Proxy]';
}
export default isFunction;