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

@@ -2,10 +2,6 @@ import baseGetTag from './.internal/baseGetTag.js';
import isObjectLike from './isObjectLike.js';
import isPlainObject from './isPlainObject.js';
/** `Object#toString` result references. */
const domExcTag = '[object DOMException]';
const errorTag = '[object Error]';
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
* `SyntaxError`, `TypeError`, or `URIError` object.
@@ -27,7 +23,7 @@ function isError(value) {
return false;
}
const tag = baseGetTag(value);
return tag == errorTag || tag == domExcTag ||
return tag == '[object Error]' || tag == '[object DOMException]' ||
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
}