This PR represents a first pass addition of Tuple.prototype.group and Tuple.prototype.groupToMap, reflecting the addition of similar methods to the Array.prototype in https://github.com/tc39/proposal-array-grouping .
The array grouping proposal is currently at Stage 3, so we don't intend to merge this until Array Grouping reaches Stage 4, but want to prepare this in case it advanced ahead of Records and Tuples.
A few notes on this spec text:
This is almost entirely the same as the spec text for regular Array versions of these methods, which some verbiage changed to refer to Tuple.
I removed the comments ahead of the algorithm steps regarding the mutation of the Array (Tuple) being traversed, as they don't apply here, since Tuples are immutable.
This PR represents a first pass addition of
Tuple.prototype.group
andTuple.prototype.groupToMap
, reflecting the addition of similar methods to theArray.prototype
in https://github.com/tc39/proposal-array-grouping .The array grouping proposal is currently at Stage 3, so we don't intend to merge this until Array Grouping reaches Stage 4, but want to prepare this in case it advanced ahead of Records and Tuples.
A few notes on this spec text:
AddValueToKeyedGroup
that the array grouping proposal implements, so if you are looking for that it is here: https://tc39.es/proposal-array-grouping/#sec-add-value-to-keyed-groupObject
ofArray
s. This choice was made so that asymbol
can be used as a "grouping key" (because a Record cannot have a symbol key, see the discussion in this issue: https://github.com/tc39/proposal-record-tuple/issues/275#issuecomment-995834454)