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
Copy file name to clipboardExpand all lines: spec/abstractops.html
+42-29Lines changed: 42 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -548,51 +548,58 @@ <h1>
548
548
GetTemporalUnitValuedOption (
549
549
_options_: an Object,
550
550
_key_: a property key,
551
-
_unitGroup_: ~date~, ~time~, or ~datetime~,
552
-
_default_: ~required~, ~unset~, ~auto~, or a Temporal unit,
553
-
optional _extraValues_: a List of either Temporal units or ~auto~,
551
+
_default_: ~required~ or ~unset~,
554
552
): either a normal completion containing either a Temporal unit, ~unset~, or ~auto~, or a throw completion
555
553
</h1>
556
554
<dlclass="header">
557
555
<dt>description</dt>
558
-
<dd>It attempts to read from the specified property of _options_a Temporal unit that is <emu-not-ref>covered</emu-not-ref> by the union of _unitGroup_ and _extraValues_, substituting _default_ if the property value is *undefined*.</dd>
556
+
<dd>It attempts to read a Temporal unit from the specified property of _options_.</dd>
559
557
</dl>
560
558
<p>Both singular and plural unit names are accepted, but only the singular form is used internally.</p>
561
559
<emu-alg>
562
-
1. Let _allowedValues_ be a new empty List.
560
+
1. Let _allowedStrings_ be a new empty List.
561
+
1. Append *"auto"* to _allowedStrings_.
563
562
1. For each row of <emu-xrefhref="#table-temporal-units"></emu-xref>, except the header row, in table order, do
564
-
1. Let _unit_ be the value in the "Value" column of the row.
565
-
1.If the "Category" column of the row is ~date~ and _unitGroup_ is ~date~ or ~datetime~, append _unit_to _allowedValues_.
566
-
1.Else if the "Category" column of the row is ~time~ and _unitGroup_ is ~time~ or ~datetime~, append _unit_ to _allowedValues_.
567
-
1.If _extraValues_ is present, then
568
-
1.Set _allowedValues_ to the list-concatenation of _allowedValues_ and _extraValues_.
563
+
1. Let _singularName_ be the value in the "Singular property name" column of the row.
564
+
1.Append _singularName_to _allowedStrings_.
565
+
1.Let _pluralName_ be the value in the "Plural property name" column of the row.
566
+
1.Append _pluralName_ to _allowedStrings_.
567
+
1.NOTE: For each singular Temporal unit name that is contained within _allowedStrings_, the corresponding plural name is also contained within it.
569
568
1. If _default_ is ~unset~, then
570
569
1. Let _defaultValue_ be *undefined*.
571
-
1. Else if _default_ is ~required~, then
572
-
1. Let _defaultValue_ be ~required~.
573
-
1. Else if _default_ is ~auto~, then
574
-
1. Append _default_ to _allowedValues_.
575
-
1. Let _defaultValue_ be *"auto"*.
576
570
1. Else,
577
-
1.Assert:_allowedValues_ contains _default_.
578
-
1. Let _defaultValue_ be the value in the "Singular property name" column of <emu-xrefhref="#table-temporal-units"></emu-xref> corresponding to the row with _default_ in the "Value" column.
579
-
1. Let _allowedStrings_ be a new empty List.
580
-
1. For each element _value_ of _allowedValues_, do
581
-
1. If _value_ is ~auto~, then
582
-
1. Append *"auto"* to _allowedStrings_.
583
-
1. Else,
584
-
1. Let _singularName_ be the value in the "Singular property name" column of <emu-xrefhref="#table-temporal-units"></emu-xref> corresponding to the row with _value_ in the "Value" column.
585
-
1. Append _singularName_ to _allowedStrings_.
586
-
1. Let _pluralName_ be the value in the "Plural property name" column of the corresponding row.
587
-
1. Append _pluralName_ to _allowedStrings_.
588
-
1. NOTE: For each singular Temporal unit name that is contained within _allowedStrings_, the corresponding plural name is also contained within it.
571
+
1. Let _defaultValue_ be _default_.
589
572
1. Let _value_ be ? GetOption(_options_, _key_, ~string~, _allowedStrings_, _defaultValue_).
590
573
1. If _value_ is *undefined*, return ~unset~.
591
574
1. If _value_ is *"auto"*, return ~auto~.
592
575
1. Return the value in the "Value" column of <emu-xrefhref="#table-temporal-units"></emu-xref> corresponding to the row with _value_ in its "Singular property name" or "Plural property name" column.
optional _extraValues_: a List of either Temporal units or ~auto~,
585
+
): either a normal completion containing ~unused~ or a throw completion
586
+
</h1>
587
+
<dlclass="header">
588
+
<dt>description</dt>
589
+
<dd>It validates that the result of GetTemporalUnitValuedOption is <emu-not-ref>covered</emu-not-ref> by the union of _unitGroup_ and _extraValues_.</dd>
590
+
</dl>
591
+
<emu-alg>
592
+
1. Let _allowedValues_ be a new empty List.
593
+
1. For each row of <emu-xrefhref="#table-temporal-units"></emu-xref>, except the header row, in table order, do
594
+
1. Let _unit_ be the value in the "Value" column of the row.
595
+
1. If the "Category" column of the row is ~date~ and _unitGroup_ is ~date~ or ~datetime~, append _unit_ to _allowedValues_.
596
+
1. Else if the "Category" column of the row is ~time~ and _unitGroup_ is ~time~ or ~datetime~, append _unit_ to _allowedValues_.
597
+
1. If _extraValues_ is present, then
598
+
1. Set _allowedValues_ to the list-concatenation of _allowedValues_ and _extraValues_.
599
+
1. If _allowedValues_ does not contain _value_, throw a RangeError exception.
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetTemporalRelativeToOption reads *"relativeTo"*, GetRoundingIncrementOption reads *"roundingIncrement"* and GetRoundingModeOption reads *"roundingMode"*).
405
-
1. Let _largestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"largestUnit"*, ~datetime~, ~unset~, « ~auto~ »).
405
+
1. Let _largestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"largestUnit"*, ~unset~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetTemporalFractionalSecondDigitsOption reads *"fractionalSecondDigits"* and GetRoundingModeOption reads *"roundingMode"*).
513
516
1. Let _digits_ be ? GetTemporalFractionalSecondDigitsOption(_resolvedOptions_).
514
517
1. Let _roundingMode_ be ? GetRoundingModeOption(_resolvedOptions_, ~trunc~).
515
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~time~, ~unset~).
518
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~unset~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetRoundingIncrementOption reads *"roundingIncrement"* and GetRoundingModeOption reads *"roundingMode"*).
194
194
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_roundTo_).
195
195
1. Let _roundingMode_ be ? GetRoundingModeOption(_roundTo_, ~half-expand~).
196
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~time~, ~required~).
196
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~required~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetTemporalFractionalSecondDigitsOption reads *"fractionalSecondDigits"* and GetRoundingModeOption reads *"roundingMode"*).
236
237
1. Let _digits_ be ? GetTemporalFractionalSecondDigitsOption(_resolvedOptions_).
237
238
1. Let _roundingMode_ be ? GetRoundingModeOption(_resolvedOptions_, ~trunc~).
238
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~time~, ~unset~).
239
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~unset~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetRoundingIncrementOption reads *"roundingIncrement"* and GetRoundingModeOption reads *"roundingMode"*).
503
503
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_roundTo_).
504
504
1. Let _roundingMode_ be ? GetRoundingModeOption(_roundTo_, ~half-expand~).
505
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~time~, ~required~, « ~day~ »).
505
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~required~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetRoundingIncrementOption reads *"roundingIncrement"* and GetRoundingModeOption reads *"roundingMode"*).
273
273
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_roundTo_).
274
274
1. Let _roundingMode_ be ? GetRoundingModeOption(_roundTo_, ~half-expand~).
275
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~time~, ~required~).
275
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~required~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetTemporalFractionalSecondDigitsOption reads *"fractionalSecondDigits"* and GetRoundingModeOption reads *"roundingMode"*).
304
305
1. Let _digits_ be ? GetTemporalFractionalSecondDigitsOption(_resolvedOptions_).
305
306
1. Let _roundingMode_ be ? GetRoundingModeOption(_resolvedOptions_, ~trunc~).
306
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~time~, ~unset~).
307
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~unset~).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetRoundingIncrementOption reads *"roundingIncrement"* and GetRoundingModeOption reads *"roundingMode"*).
634
634
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_roundTo_).
635
635
1. Let _roundingMode_ be ? GetRoundingModeOption(_roundTo_, ~half-expand~).
636
-
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~time~, ~required~, « ~day~ »).
636
+
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~required~).
0 commit comments