lukeed / lukeed/dequal

Missing properties not equal to undefined

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.5k
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Is this intended?
```js
dequal({ x: undefined}, {}); //=> false
// Returns false, even though arg1.x === arg2.x
```

If it is, could it be documented?

My use case is to check for unsaved changes by comparing a current value with an original value. But to save that original value, I clone it with `JSON.stringify`, which doesn't work because of this issue

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the dequal({ x: undefined }, {}) example and reviewing how the comparison treats missing properties. Decide whether this behavior is intended; if so, document it, or otherwise define the expected equality behavior and add coverage for the reported case. JSON.stringify cloning is part of the reported use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.