Ducktype in _.isError for ES6 support.

This commit is contained in:
John-David Dalton
2016-02-18 21:52:53 -08:00
parent e380062403
commit 49389d0a2f
2 changed files with 4 additions and 3 deletions

View File

@@ -9871,9 +9871,8 @@
if (!isObjectLike(value)) {
return false;
}
var Ctor = value.constructor;
return (objectToString.call(value) == errorTag) ||
(typeof Ctor == 'function' && objectToString.call(Ctor.prototype) == errorTag);
(typeof value.message == 'string' && typeof value.name == 'string');
}
/**

View File

@@ -364,7 +364,9 @@
this.message = message;
}
CustomError.prototype = lodashStable.create(Error.prototype);
CustomError.prototype = lodashStable.create(Error.prototype, {
'constructor': CustomError
});
/**
* Removes all own enumerable properties from a given object.