diff --git a/index.html b/index.html index 2e7a5c6..45166a3 100644 --- a/index.html +++ b/index.html @@ -2414,7 +2414,7 @@

2.2 Array.prototype.groupByMap ( callbackfn

2.3 AddValueToKeyedGroup ( groups, key, value )

The abstract operation AddValueToKeyedGroup takes arguments groups (a List of Records that have [[Key]] and [[Elements]] fields), key (an ECMAScript language value), and value (an ECMAScript language value). It performs the following steps when called:

-
  1. If groups contains a Record g such that ! SameValue(g.[[Key]], key) is true, then
    1. Assert: exactly one element of groups meets this criteria.
    2. Append value as the last element of g.[[Elements]].
  2. Else,
    1. Let group be the Record { [[Key]]: key, [[Elements]]: « value » }.
    2. Append group as the last element of groups.
+
  1. For each Record { [[Key]], [[Elements]] } g of groups, do
    1. If ! SameValue(g.[[Key]], key) is true, then
      1. Assert: exactly one element of groups meets this criteria.
      2. Append value as the last element of g.[[Elements]].
      3. Return.
  2. Let group be the Record { [[Key]]: key, [[Elements]]: « value » }.
  3. Append group as the last element of groups.
diff --git a/spec.emu b/spec.emu index b0268b1..55bce34 100644 --- a/spec.emu +++ b/spec.emu @@ -105,12 +105,13 @@ location: https://tc39.es/proposal-array-grouping/
- 1. If _groups_ contains a Record _g_ such that ! SameValue(_g_.[[Key]], _key_) is *true*, then - 1. Assert: exactly one element of _groups_ meets this criteria. - 1. Append _value_ as the last element of _g_.[[Elements]]. - 1. Else, - 1. Let _group_ be the Record { [[Key]]: _key_, [[Elements]]: « _value_ » }. - 1. Append _group_ as the last element of _groups_. + 1. For each Record { [[Key]], [[Elements]] } _g_ of _groups_, do + 1. If ! SameValue(_g_.[[Key]], _key_) is *true*, then + 1. Assert: exactly one element of _groups_ meets this criteria. + 1. Append _value_ as the last element of _g_.[[Elements]]. + 1. Return. + 1. Let _group_ be the Record { [[Key]]: _key_, [[Elements]]: « _value_ » }. + 1. Append _group_ as the last element of _groups_.