mirror of
https://github.com/hanzoai/es5-ext.git
synced 2026-09-24 16:58:43 +00:00
Error.isError true only for Error instances
This commit is contained in:
+2
-5
@@ -2,11 +2,8 @@
|
||||
|
||||
var toString = Object.prototype.toString
|
||||
|
||||
, id = toString.call(new Error())
|
||||
, exceptionRe = /^\[object [a-zA-z0-9]*(?:Exception|Error)\]$/;
|
||||
, id = toString.call(new Error());
|
||||
|
||||
module.exports = function (x) {
|
||||
var xid;
|
||||
return (x && ((x instanceof Error) || ((xid = toString.call(x)) === id) ||
|
||||
xid.match(exceptionRe))) || false;
|
||||
return (x && ((x instanceof Error) || (toString.call(x)) === id)) || false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user