From e31c01f3156751cbbcb0c2365866d5b4c4dc5055 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 31 May 2023 14:34:35 -0700 Subject: [PATCH] [spec] update appending prose per review feedback --- index.html | 6 +++--- spec.emu | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 6c5fcb2..04fa919 100644 --- a/index.html +++ b/index.html @@ -2414,7 +2414,7 @@

Stage 2 Draft / May 18, 2023

Array Grouping

+

Stage 2 Draft / May 31, 2023

Array Grouping

1 Scope

@@ -2452,7 +2452,7 @@

3.1 Map.groupBy ( items, callbac

The return value of groupBy is a Map.

When the groupBy method is called with two arguments, the following steps are taken:

-
  1. Let groups be ? GroupBy(items, callbackfn, zero).
  2. Let map be ! Construct(%Map%).
  3. For each Record { [[Key]], [[Elements]] } g of groups, do
    1. Let elements be CreateArrayFromList(g.[[Elements]]).
    2. Let entry be the Record { [[Key]]: g.[[Key]], [[Value]]: elements }.
    3. Append entry as the last element of map.[[MapData]].
  4. Return map.
+
  1. Let groups be ? GroupBy(items, callbackfn, zero).
  2. Let map be ! Construct(%Map%).
  3. For each Record { [[Key]], [[Elements]] } g of groups, do
    1. Let elements be CreateArrayFromList(g.[[Elements]]).
    2. Let entry be the Record { [[Key]]: g.[[Key]], [[Value]]: elements }.
    3. Append entry to map.[[MapData]].
  4. Return map.
@@ -2472,7 +2472,7 @@

4.1 GroupBy ( items, callbackfn<

4.2 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) and returns unused. It performs the following steps when called:

-
  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 unused.
  2. Let group be the Record { [[Key]]: key, [[Elements]]: « value » }.
  3. Append group as the last element of groups.
  4. Return unused.
+
  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 to g.[[Elements]].
      3. Return unused.
  2. Let group be the Record { [[Key]]: key, [[Elements]]: « value » }.
  3. Append group to groups.
  4. Return unused.
diff --git a/spec.emu b/spec.emu index 8def97a..69785ea 100644 --- a/spec.emu +++ b/spec.emu @@ -60,7 +60,7 @@ location: https://tc39.es/proposal-array-grouping/ 1. For each Record { [[Key]], [[Elements]] } _g_ of _groups_, do 1. Let _elements_ be CreateArrayFromList(_g_.[[Elements]]). 1. Let _entry_ be the Record { [[Key]]: _g_.[[Key]], [[Value]]: _elements_ }. - 1. Append _entry_ as the last element of _map_.[[MapData]]. + 1. Append _entry_ to _map_.[[MapData]]. 1. Return _map_. @@ -124,10 +124,10 @@ location: https://tc39.es/proposal-array-grouping/ 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. Append _value_ to _g_.[[Elements]]. 1. Return ~unused~. 1. Let _group_ be the Record { [[Key]]: _key_, [[Elements]]: « _value_ » }. - 1. Append _group_ as the last element of _groups_. + 1. Append _group_ to _groups_. 1. Return ~unused~.