Skip to content

Commit

Permalink
Normative: Integrate Intl NumberFormat v3 into ECMA-402 (tc39#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc authored and ben-allen committed Apr 10, 2023
1 parent 88c8e95 commit c0b5b63
Show file tree
Hide file tree
Showing 4 changed files with 737 additions and 81 deletions.
28 changes: 26 additions & 2 deletions spec/negotiation.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h1>BestAvailableLocale ( _availableLocales_, _locale_ )</h1>
<emu-alg>
1. Let _candidate_ be _locale_.
1. Repeat,
1. If _availableLocales_ contains an element equal to _candidate_, return _candidate_.
1. If _availableLocales_ contains _candidate_, return _candidate_.
1. Let _pos_ be the character index of the last occurrence of *"-"* (U+002D) within _candidate_. If that character does not occur, return *undefined*.
1. If _pos_ &ge; 2 and the character *"-"* occurs at index _pos_ - 2 of candidate, decrease _pos_ by 2.
1. Let _candidate_ be the substring of _candidate_ from position 0, inclusive, to position _pos_, exclusive.
Expand Down Expand Up @@ -353,7 +353,31 @@ <h1>
1. Else,
1. Assert: _type_ is ~string~.
1. Set _value_ to ? ToString(_value_).
1. If _values_ is not ~empty~ and _values_ does not contain an element equal to _value_, throw a *RangeError* exception.
1. If _values_ is not ~empty~ and _values_ does not contain _value_, throw a *RangeError* exception.
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-getbooleanorstringnumberformatoption" type="abstract operation">
<h1>
GetBooleanOrStringNumberFormatOption (
_options_: an Object,
_property_: a property key,
_stringValues_: a List of Strings,
_fallback_: an ECMAScript language value,
): either a normal completion containing either a Boolean, String, or _fallback_, or a throw completion
</h1>
<dl class="header">
<dt>description</dt>
<dd>It extracts the value of the property named _property_ from the provided _options_ object. It returns _fallback_ if that value is *undefined*, *true* if that value is *true*, *false* if that value coerces to *false*, and otherwise coerces it to a String and returns the result if it is allowed by _stringValues_.</dd>
</dl>
<emu-alg>
1. Let _value_ be ? Get(_options_, _property_).
1. If _value_ is *undefined*, return _fallback_.
1. If _value_ is *true*, return *true*.
1. If ToBoolean(_value_) is *false*, return *false*.
1. Let _value_ be ? ToString(_value_).
1. If _stringValues_ does not contain _value_, throw a *RangeError* exception.
1. Return _value_.
</emu-alg>
</emu-clause>
Expand Down
Loading

0 comments on commit c0b5b63

Please sign in to comment.