hapijs / hoek

Node utilities shared among the extended hapi universe
Other
480 stars 171 forks source link

deepEqual with skip seems to ignore missing properties #337

Closed rankida closed 4 years ago

rankida commented 4 years ago
> Hoek.deepEqual({a: 1}, {a:1, b: 2})
false
> Hoek.deepEqual({a: 1}, {a:1, b: 2}, { skip: ['a'] })
true
> Hoek.deepEqual({a: 1, b: 2}, {a:1}, { skip: ['a'] })
false

☝️ the middle example is surprising to me as b exists only in the second object and yet it is considered to be deepEqual.

I wonder if skip has the effect of turning part to true?

hueniverse commented 4 years ago

It ignores key counts which has this bug as side effect.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.