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

Commit 03bd8ea

Browse files
authored
spec: use "contains" and assertion verbage (#23)
1 parent 330a793 commit 03bd8ea

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@ <h1><span class="secnum">2.3</span>
23092309
<var>value</var>: an ECMAScript language value,
23102310
)
23112311
</h1>
2312-
<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 !&nbsp;<emu-xref aoid="SameValueZero" id="_ref_17"><a href="https://tc39.es/ecma262/#sec-samevaluezero">SameValueZero</a></emu-xref>(<var>g</var>.[[Key]], <var>key</var>) is <emu-val>true</emu-val>, then<ol><li>Append <var>value</var> as the last element of <var>g</var>.[[Elements]].</li><li>Return.</li></ol></li></ol></li><li>Let <var>elements</var> be 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> whose sole element is <var>value</var>.</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>elements</var> }.</li><li>Append <var>group</var> as the last element of <var>groups</var>.</li></ol></emu-alg>
2312+
<emu-alg><ol><li>If <var>groups</var> contains a <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> <var>g</var> such that !&nbsp;<emu-xref aoid="SameValueZero" id="_ref_17"><a href="https://tc39.es/ecma262/#sec-samevaluezero">SameValueZero</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></ol></li><li>Else,<ol><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></ol></li></ol></emu-alg>
23132313
</emu-clause>
23142314
</ins>
23152315
</emu-clause><emu-annex id="sec-copyright-and-software-license">

spec.emu

+6-7
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,12 @@ location: https://tc39.es/proposal-array-grouping/
103103
)
104104
</h1>
105105
<emu-alg>
106-
1. For each Record { [[Key]], [[Elements]] } _g_ of _groups_, do
107-
1. If ! SameValueZero(_g_.[[Key]], _key_) is *true*, then
108-
1. Append _value_ as the last element of _g_.[[Elements]].
109-
1. Return.
110-
1. Let _elements_ be a List whose sole element is _value_.
111-
1. Let _group_ be the Record { [[Key]]: _key_, [[Elements]]: _elements_ }.
112-
1. Append _group_ as the last element of _groups_.
106+
1. If _groups_ contains a Record _g_ such that ! SameValueZero(_g_.[[Key]], _key_) is *true*, then
107+
1. Assert: exactly one element of _groups_ meets this criteria.
108+
1. Append _value_ as the last element of _g_.[[Elements]].
109+
1. Else,
110+
1. Let _group_ be the Record { [[Key]]: _key_, [[Elements]]: &laquo; _value_ &raquo; }.
111+
1. Append _group_ as the last element of _groups_.
113112
</emu-alg>
114113
</emu-clause>
115114
</ins>

0 commit comments

Comments
 (0)