-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Open
Labels
Milestone
Description
Edit bij @jgonggrijp: tldr link.
Is this intentional?
var a = new Error('a')
var b = new Error('b')
_.isEqual(a, b) // true
This holds true for extensions as well...
class A extends Error { constructor(message) { super(message); this.enumerable = 'Klaatu barada nikto' } }
var e1 = new A('Fear has been substituted for reason.')
var e2 = new A('Join us and live in peace')
_.isEqual(a, b) // true
Other built in types (e.g. Date, RegExp, Symbol) have various methods to coerce for comparison.
Error comparison ends up in deep equality comparison, which relies on Object.keys and ends up comparing empty arrays.
Happy to send in a PR if this is unintentional, also happy to work around it if it is.