jashkenas / jashkenas/underscore
Change to SameValueZero for comparisons
- Dominant language
- JavaScript
- Stars
- 27.3k
- Forks
- 5.4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 1
Description
Currently for comparisons in methods like `difference`, `includes`, `indexOf`, `intersection`, `lastIndexOf`,`uniq`, `union` a strict equality, `===` is used.
If this was tweaked a bit to [SameValueZero](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero), `===` + `NaN` matches, then it would allow for optimizations with `Set` and `Map` as well as cover the `NaN` match case.
Thoughts?
Contributor guide
Research direction
Start by locating the implementations of difference, includes, indexOf, intersection, lastIndexOf, uniq, and union, then review how their current strict-equality comparisons are tested. The change is done when these methods consistently use SameValueZero semantics, including matching NaN, with the relevant behavior verified across the listed methods.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100