felixge / felixge/node-dirty

Internally, duplicate keys are maintained

Open
#17 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
619
Forks
64
PR merge metrics
No merged PRs in 30d

Description

There's a bug in Dirty.prototype.set() where keys are pushed onto _keys, even though they have already been set. This is immediately noticeable when iterating using forEach.

The fix is very simple:

```
if (!this._keys[key]) { // FAIL - _keys is an Array
this._keys.push(key);
}
```

should of course be:

```
if (this._keys.indexOf(key) === -1) { // FIXED
this._keys.push(key);
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.