mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Bump to v4.16.5.
This commit is contained in:
20
isError.js
20
isError.js
@@ -1,17 +1,8 @@
|
||||
define(['./isObjectLike'], function(isObjectLike) {
|
||||
define(['./_baseGetTag', './isObjectLike', './isPlainObject'], function(baseGetTag, isObjectLike, isPlainObject) {
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var errorTag = '[object Error]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
var domExcTag = '[object DOMException]',
|
||||
errorTag = '[object Error]';
|
||||
|
||||
/**
|
||||
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
||||
@@ -35,8 +26,9 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
if (!isObjectLike(value)) {
|
||||
return false;
|
||||
}
|
||||
return (objectToString.call(value) == errorTag) ||
|
||||
(typeof value.message == 'string' && typeof value.name == 'string');
|
||||
var tag = baseGetTag(value);
|
||||
return tag == errorTag || tag == domExcTag ||
|
||||
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
||||
}
|
||||
|
||||
return isError;
|
||||
|
||||
Reference in New Issue
Block a user