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

Commit

Permalink
[spec] update appending prose per review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 31, 2023
1 parent d04f5a8 commit e31c01f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions index.html
Expand Up @@ -2414,7 +2414,7 @@
</ul></div><div id="menu-toggle"><svg xmlns="http://www.w3.org/2000/svg" style="width:100%; height:100%; stroke:currentColor" viewBox="0 0 120 120">
<title>Menu</title>
<path stroke-width="10" stroke-linecap="round" d="M30,60 h60 M30,30 m0,5 h60 M30,90 m0,-5 h60"></path>
</svg></div><div id="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins</div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-scope" title="Scope"><span class="secnum">1</span> Scope</a></li><li><span class="item-toggle">◢</span><a href="#sec-properties-of-the-object-constructor" title="Properties of the Object Constructor (20.1.2)"><span class="secnum">2</span> Properties of the Object Constructor (20.1.2)</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-object.groupby" title="Object.groupBy ( items, callbackfn )"><span class="secnum">2.1</span> Object.groupBy ( <var>items</var>, <var>callbackfn</var> )</a></li></ol></li><li><span class="item-toggle">◢</span><a href="#sec-properties-of-the-map-constructor" title="Properties of the Map Constructor (24.1.2)"><span class="secnum">3</span> Properties of the Map Constructor (24.1.2)</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-map.groupby" title="Map.groupBy ( items, callbackfn )"><span class="secnum">3.1</span> Map.groupBy ( <var>items</var>, <var>callbackfn</var> )</a></li></ol></li><li><span class="item-toggle">◢</span><a href="#sec-group-by-helpers" title="Group By Helpers"><span class="secnum">4</span> Group By Helpers</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-group-by" title="GroupBy ( items, callbackfn, coercion )"><span class="secnum">4.1</span> GroupBy ( <var>items</var>, <var>callbackfn</var>, <var>coercion</var> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-add-value-to-keyed-group" title="AddValueToKeyedGroup ( groups, key, value )"><span class="secnum">4.2</span> AddValueToKeyedGroup ( <var>groups</var>, <var>key</var>, <var>value</var> )</a></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="version">Stage 2 Draft / May 18, 2023</h1><h1 class="title">Array Grouping</h1>
</svg></div><div id="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins</div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-scope" title="Scope"><span class="secnum">1</span> Scope</a></li><li><span class="item-toggle">◢</span><a href="#sec-properties-of-the-object-constructor" title="Properties of the Object Constructor (20.1.2)"><span class="secnum">2</span> Properties of the Object Constructor (20.1.2)</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-object.groupby" title="Object.groupBy ( items, callbackfn )"><span class="secnum">2.1</span> Object.groupBy ( <var>items</var>, <var>callbackfn</var> )</a></li></ol></li><li><span class="item-toggle">◢</span><a href="#sec-properties-of-the-map-constructor" title="Properties of the Map Constructor (24.1.2)"><span class="secnum">3</span> Properties of the Map Constructor (24.1.2)</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-map.groupby" title="Map.groupBy ( items, callbackfn )"><span class="secnum">3.1</span> Map.groupBy ( <var>items</var>, <var>callbackfn</var> )</a></li></ol></li><li><span class="item-toggle">◢</span><a href="#sec-group-by-helpers" title="Group By Helpers"><span class="secnum">4</span> Group By Helpers</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-group-by" title="GroupBy ( items, callbackfn, coercion )"><span class="secnum">4.1</span> GroupBy ( <var>items</var>, <var>callbackfn</var>, <var>coercion</var> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-add-value-to-keyed-group" title="AddValueToKeyedGroup ( groups, key, value )"><span class="secnum">4.2</span> AddValueToKeyedGroup ( <var>groups</var>, <var>key</var>, <var>value</var> )</a></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="version">Stage 2 Draft / May 31, 2023</h1><h1 class="title">Array Grouping</h1>

<emu-clause id="sec-scope">
<h1><span class="secnum">1</span> Scope</h1>
Expand Down Expand Up @@ -2452,7 +2452,7 @@ <h1><span class="secnum">3.1</span> Map.groupBy ( <var>items</var>, <var>callbac
<p>The return value of <code>groupBy</code> is a Map.</p>
</div></emu-note>
<p>When the <code>groupBy</code> method is called with two arguments, the following steps are taken:</p>
<emu-alg><ol><li>Let <var>groups</var> be ?&nbsp;<emu-xref aoid="GroupBy" id="_ref_3"><a href="#sec-group-by">GroupBy</a></emu-xref>(<var>items</var>, <var>callbackfn</var>, <emu-const>zero</emu-const>).</li><li>Let <var>map</var> be !&nbsp;<emu-xref aoid="Construct" id="_ref_4"><a href="https://tc39.es/ecma262/#sec-construct">Construct</a></emu-xref>(<emu-xref href="#sec-map-constructor"><a href="https://tc39.es/ecma262/#sec-map-constructor">%Map%</a></emu-xref>).</li><li>For each <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]], [[Elements]] } <var>g</var> of <var>groups</var>, do<ol><li>Let <var>elements</var> be <emu-xref aoid="CreateArrayFromList" id="_ref_5"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>g</var>.[[Elements]]).</li><li>Let <var>entry</var> be the <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]]: <var>g</var>.[[Key]], [[Value]]: <var>elements</var> }.</li><li>Append <var>entry</var> as the last element of <var>map</var>.[[MapData]].</li></ol></li><li>Return <var>map</var>.</li></ol></emu-alg>
<emu-alg><ol><li>Let <var>groups</var> be ?&nbsp;<emu-xref aoid="GroupBy" id="_ref_3"><a href="#sec-group-by">GroupBy</a></emu-xref>(<var>items</var>, <var>callbackfn</var>, <emu-const>zero</emu-const>).</li><li>Let <var>map</var> be !&nbsp;<emu-xref aoid="Construct" id="_ref_4"><a href="https://tc39.es/ecma262/#sec-construct">Construct</a></emu-xref>(<emu-xref href="#sec-map-constructor"><a href="https://tc39.es/ecma262/#sec-map-constructor">%Map%</a></emu-xref>).</li><li>For each <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]], [[Elements]] } <var>g</var> of <var>groups</var>, do<ol><li>Let <var>elements</var> be <emu-xref aoid="CreateArrayFromList" id="_ref_5"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>g</var>.[[Elements]]).</li><li>Let <var>entry</var> be the <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]]: <var>g</var>.[[Key]], [[Value]]: <var>elements</var> }.</li><li>Append <var>entry</var> to <var>map</var>.[[MapData]].</li></ol></li><li>Return <var>map</var>.</li></ol></emu-alg>
</emu-clause>
</ins>
</emu-clause>
Expand All @@ -2472,7 +2472,7 @@ <h1><span class="secnum">4.1</span> GroupBy ( <var>items</var>, <var>callbackfn<
<emu-clause id="sec-add-value-to-keyed-group" type="abstract operation" aoid="AddValueToKeyedGroup">
<h1><span class="secnum">4.2</span> AddValueToKeyedGroup ( <var>groups</var>, <var>key</var>, <var>value</var> )</h1>
<p>The abstract operation AddValueToKeyedGroup takes arguments <var>groups</var> (a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> of Records that have [[Key]] and [[Elements]] fields), <var>key</var> (an <emu-xref href="#sec-ecmascript-language-types"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns <emu-const>unused</emu-const>. It performs the following steps when called:</p>
<emu-alg><ol><li>For each <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]], [[Elements]] } <var>g</var> of <var>groups</var>, do<ol><li>If <emu-xref aoid="SameValue" id="_ref_18"><a href="https://tc39.es/ecma262/#sec-samevalue">SameValue</a></emu-xref>(<var>g</var>.[[Key]], <var>key</var>) is <emu-val>true</emu-val>, then<ol><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: exactly one element of <var>groups</var> meets this criteria.</li><li>Append <var>value</var> as the last element of <var>g</var>.[[Elements]].</li><li>Return <emu-const>unused</emu-const>.</li></ol></li></ol></li><li>Let <var>group</var> be the <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]]: <var>key</var>, [[Elements]]: « <var>value</var> » }.</li><li>Append <var>group</var> as the last element of <var>groups</var>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
<emu-alg><ol><li>For each <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]], [[Elements]] } <var>g</var> of <var>groups</var>, do<ol><li>If <emu-xref aoid="SameValue" id="_ref_18"><a href="https://tc39.es/ecma262/#sec-samevalue">SameValue</a></emu-xref>(<var>g</var>.[[Key]], <var>key</var>) is <emu-val>true</emu-val>, then<ol><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: exactly one element of <var>groups</var> meets this criteria.</li><li>Append <var>value</var> to <var>g</var>.[[Elements]].</li><li>Return <emu-const>unused</emu-const>.</li></ol></li></ol></li><li>Let <var>group</var> be the <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Key]]: <var>key</var>, [[Elements]]: « <var>value</var> » }.</li><li>Append <var>group</var> to <var>groups</var>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
</ins>
</emu-clause><emu-annex id="sec-copyright-and-software-license">
Expand Down
6 changes: 3 additions & 3 deletions spec.emu
Expand Up @@ -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_.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -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]]: &laquo; _value_ &raquo; }.
1. Append _group_ as the last element of _groups_.
1. Append _group_ to _groups_.
1. Return ~unused~.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit e31c01f

Please sign in to comment.