Skip to content

Commit

Permalink
Editorial: Change If X is not undefined (#472)
Browse files Browse the repository at this point in the history
Reduce double negative in the spec.

Change from

If X is not undefined then A else B

to

If X is undefined then B else A
  • Loading branch information
FrankYFTang authored Jul 8, 2020
1 parent d0981ee commit 7f83b8a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
14 changes: 7 additions & 7 deletions spec/datetimeformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
1. Set _dateTimeFormat_.[[NumberingSystem]] to _r_.[[nu]].
1. Let _dataLocale_ be _r_.[[dataLocale]].
1. Let _timeZone_ be ? Get(_options_, *"timeZone"*).
1. If _timeZone_ is not *undefined*, then
1. If _timeZone_ is *undefined*, then
1. Let _timeZone_ be DefaultTimeZone().
1. Else,
1. Let _timeZone_ be ? ToString(_timeZone_).
1. If the result of IsValidTimeZoneName(_timeZone_) is *false*, then
1. Throw a *RangeError* exception.
1. Let _timeZone_ be CanonicalizeTimeZoneName(_timeZone_).
1. Else,
1. Let _timeZone_ be DefaultTimeZone().
1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_.
1. Let _opt_ be a new Record.
1. For each row of <emu-xref href="#table-datetimeformat-components"></emu-xref>, except the header row, in table order, do
Expand All @@ -130,7 +130,10 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
1. Let _p_ be _bestFormat_.[[&lt;_prop_&gt;]].
1. If _p_ not *undefined*, then
1. Set _dateTimeFormat_'s internal slot whose name is the Internal Slot column of the row to _p_.
1. If _dateTimeFormat_.[[Hour]] is not *undefined*, then
1. If _dateTimeFormat_.[[Hour]] is *undefined*, then
1. Set _dateTimeFormat_.[[HourCycle]] to *undefined*.
1. Let _pattern_ be _bestFormat_.[[pattern]].
1. Else,
1. Let _hcDefault_ be _dataLocaleData_.[[hourCycle]].
1. Let _hc_ be _dateTimeFormat_.[[HourCycle]].
1. If _hc_ is *null*, then
Expand All @@ -152,9 +155,6 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
1. Let _pattern_ be _bestFormat_.[[pattern12]].
1. Else,
1. Let _pattern_ be _bestFormat_.[[pattern]].
1. Else,
1. Set _dateTimeFormat_.[[HourCycle]] to *undefined*.
1. Let _pattern_ be _bestFormat_.[[pattern]].
1. Set _dateTimeFormat_.[[Pattern]] to _pattern_.
1. Return _dateTimeFormat_.
</emu-alg>
Expand Down
32 changes: 15 additions & 17 deletions spec/negotiation.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,11 @@ <h1>SupportedLocales ( _availableLocales_, _requestedLocales_, _options_ )</h1>
</p>

<emu-alg>
1. If _options_ is not *undefined*, then
1. If _options_ is *undefined*, then
1. Let _matcher_ be *"best fit"*.
1. Else,
1. Let _options_ be ? ToObject(_options_).
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, *"string"*, &laquo; *"lookup"*, *"best fit"* &raquo;, *"best fit"*).
1. Else, let _matcher_ be *"best fit"*.
1. If _matcher_ is *"best fit"*, then
1. Let _supportedLocales_ be BestFitSupportedLocales(_availableLocales_, _requestedLocales_).
1. Else,
Expand All @@ -313,16 +314,14 @@ <h1>GetOption ( _options_, _property_, _type_, _values_, _fallback_ )</h1>
<emu-alg>
1. Assert: Type(_options_) is Object.
1. Let _value_ be ? Get(_options_, _property_).
1. If _value_ is not *undefined*, then
1. Assert: _type_ is *"boolean"* or *"string"*.
1. If _type_ is *"boolean"*, then
1. Let _value_ be ToBoolean(_value_).
1. If _type_ is *"string"*, then
1. Let _value_ be ? ToString(_value_).
1. If _values_ is not *undefined*, then
1. If _values_ does not contain an element equal to _value_, throw a *RangeError* exception.
1. Return _value_.
1. Else, return _fallback_.
1. If _value_ is *undefined*, return _fallback_.
1. Assert: _type_ is *"boolean"* or *"string"*.
1. If _type_ is *"boolean"*, then
1. Let _value_ be ToBoolean(_value_).
1. If _type_ is *"string"*, then
1. Let _value_ be ? ToString(_value_).
1. If _values_ is not *undefined* and _values_ does not contain an element equal to _value_, throw a *RangeError* exception.
1. Return _value_.
</emu-alg>
</emu-clause>

Expand All @@ -334,11 +333,10 @@ <h1>DefaultNumberOption ( _value_, _minimum_, _maximum_, _fallback_ )</h1>
</p>

<emu-alg>
1. If _value_ is not *undefined*, then
1. Let _value_ be ? ToNumber(_value_).
1. If _value_ is *NaN* or less than _minimum_ or greater than _maximum_, throw a *RangeError* exception.
1. Return floor(_value_).
1. Else, return _fallback_.
1. If _value_ is *undefined*, return _fallback_.
1. Let _value_ be ? ToNumber(_value_).
1. If _value_ is *NaN* or less than _minimum_ or greater than _maximum_, throw a *RangeError* exception.
1. Return floor(_value_).
</emu-alg>
</emu-clause>

Expand Down
10 changes: 6 additions & 4 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -728,15 +728,17 @@ <h1>SetNumberFormatUnitOptions ( _intlObj_, _options_ )</h1>
1. Let _style_ be ? GetOption(_options_, *"style"*, *"string"*, &laquo; *"decimal"*, *"percent"*, *"currency"*, *"unit"* &raquo;, *"decimal"*).
1. Set _intlObj_.[[Style]] to _style_.
1. Let _currency_ be ? GetOption(_options_, *"currency"*, *"string"*, *undefined*, *undefined*).
1. If _currency_ is not *undefined*, then
1. If _currency_ is *undefined*, then
1. If _style_ is *"currency"*, throw a *TypeError* exception.
1. Else,
1. If the result of IsWellFormedCurrencyCode(_currency_) is *false*, throw a *RangeError* exception.
1. If _style_ is *"currency"* and _currency_ is *undefined*, throw a *TypeError* exception.
1. Let _currencyDisplay_ be ? GetOption(_options_, *"currencyDisplay"*, *"string"*, &laquo; *"code"*, *"symbol"*, *"narrowSymbol"*, *"name"* &raquo;, *"symbol"*).
1. Let _currencySign_ be ? GetOption(_options_, *"currencySign"*, *"string"*, &laquo; *"standard"*, *"accounting"* &raquo;, *"standard"*).
1. Let _unit_ be ? GetOption(_options_, *"unit"*, *"string"*, *undefined*, *undefined*).
1. If _unit_ is not *undefined*, then
1. If _unit_ is *undefined*, then
1. If _style_ is *"unit"*, throw a *TypeError* exception.
1. Else,
1. If the result of IsWellFormedUnitIdentifier(_unit_) is *false*, throw a *RangeError* exception.
1. If _style_ is *"unit"* and _unit_ is *undefined*, throw a *TypeError* exception.
1. Let _unitDisplay_ be ? GetOption(_options_, *"unitDisplay"*, *"string"*, &laquo; *"short"*, *"narrow"*, *"long"* &raquo;, *"short"*).
1. If _style_ is *"currency"*, then
1. Let _currency_ be the result of converting _currency_ to upper case as specified in <emu-xref href="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
Expand Down

0 comments on commit 7f83b8a

Please sign in to comment.