mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Simplify isType modules.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user