Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Integrate Intl NumberFormat v3 into ECMA-402 #753

Merged
merged 11 commits into from
Apr 6, 2023
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 (
sffc marked this conversation as resolved.
Show resolved Hide resolved
_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