Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

groupByMap should have SameValueZero semantics #18

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ location: https://tc39.es/proposal-array-grouping/
1. Repeat, while _k_ < _len_
1. Let _Pk_ be ! ToString(𝔽(_k_)).
1. Let _kValue_ be ? Get(_O_, _Pk_).
1. Let _propertyKey_ be ? ToPropertyKey(? Call(_callbackfn_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)).
1. Let _key_ be ? Call(_callbackfn_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »).
1. If _key_ is *-0*<sub>𝔽</sub>, set _key_ to *+0*<sub>𝔽</sub>.
1. Let _group_ be ~empty~.
1. For each Record { [[Key]], [[Elements]] } _g_ of _groups_, do
1. If ! SameValueNonNumeric(_g_.[[Key]], _propertyKey_) is *true*, then
1. If ! SameValueZero(_g_.[[Key]], _key_) is *true*, then
1. Set _group_ to _g_.
1. If _group_ is ~empty~, then
1. Let _elements_ be a new empty List.
1. Set _group_ to the Record { [[Key]]: _propertyKey_, [[Elements]]: _elements_ }.
1. Set _group_ to the Record { [[Key]]: _key_, [[Elements]]: _elements_ }.
1. Append _group_ as the last element of _groups_.
1. Append _kValue_ as the last element of _group_.[[Elements]].
1. Set _k_ to _k_ + 1.
Expand Down