You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
<p>The return value of <code>groupBy</code> is a Map.</p>
2453
2453
</div></emu-note>
2454
2454
<p>When the <code>groupBy</code> method is called with two arguments, the following steps are taken:</p>
2455
-
<emu-alg><ol><li>Let <var>groups</var> be ? <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 ! <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>
2455
+
<emu-alg><ol><li>Let <var>groups</var> be ? <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 ! <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>
<p>The abstract operation AddValueToKeyedGroup takes arguments <var>groups</var> (a <emu-xrefhref="#sec-list-and-record-specification-type"><ahref="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-xrefhref="#sec-ecmascript-language-types"><ahref="https://tc39.es/ecma262/#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>value</var> (an <emu-xrefhref="#sec-ecmascript-language-types"><ahref="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>
2475
-
<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>
2475
+
<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>
0 commit comments