Skip to content

Commit

Permalink
resolving conflicts for PR #79
Browse files Browse the repository at this point in the history
  • Loading branch information
caridy committed Aug 14, 2016
2 parents a738740 + a131147 commit c1f61e1
Showing 1 changed file with 64 additions and 15 deletions.
79 changes: 64 additions & 15 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,17 @@ <h1>Number Format Functions</h1>
</p>
</emu-clause>

<emu-clause id="sec-formatnumber" aoid="FormatNumber">
<h1>FormatNumber(numberFormat, x)</h1>
<emu-clause id="sec-partitionnumberpattern" aoid="PartitionNumberPattern">
<h1>PartitionNumberPattern(numberFormat, x)</h1>

<p>
When the FormatNumber abstract operation is called with arguments _numberFormat_ (which must be an object initialized as a NumberFormat) and _x_ (which must be a Number value), it returns a String value representing _x_ according to the effective locale and the formatting options of _numberFormat_. This abstract operation functions as follows:
The *PartitionNumberPattern* abstract operation is called with arguments _numberFormat_ (which must be an object initialized as a NumberFormat) and _x_ (which must be a Number value), interprets _x_ as a numeric value, and creates the corresponding parts according to the effective locale and the formatting options of _numberFormat_. The following steps are taken:
</p>

<emu-alg>
1. Let _negative_ be *false*.
1. If the _result_ of isFinite(_x_) is *false*, then
1. If _x_ is *NaN*,
1. Let _n_ be an ILD String value indicating the *NaN* value.
1. Else,
1. Let _n_ be an ILD String value indicating infinity.
1. If _x_ < 0, let _negative_ be *true*.
1. If _x_ is not *NaN* and _x_ < 0, then:
1. Let _x_ be -_x_.
1. Let _pattern_ be _numberFormat_.[[negativePattern]].
1. Else,
1. If _x_ < 0, then
1. Let _negative_ be *true*.
Expand Down Expand Up @@ -151,7 +147,6 @@ <h1>FormatNumber(numberFormat, x)</h1>
1. Return _result_.
</emu-alg>


<emu-table id="table-numbering-system-digits">
<emu-caption>Numbering systems with simple digit mappings</emu-caption>
<table class="real-table">
Expand Down Expand Up @@ -257,10 +252,47 @@ <h1>FormatNumber(numberFormat, x)</h1>
</emu-note>

<emu-note>
It is recommended that implementations use the locale data provided by the Common Locale Data Repository (available at <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a>).
It is recommended that implementations use the locale provided by the Common Locale Data Repository (available at <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a>).
</emu-note>
</emu-clause>

<emu-clause id="sec-formatnumber" aoid="FormatNumber">
<h1>FormatNumber(numberFormat, x)</h1>

<p>
The FormatNumber abstract operation is called with arguments _numberFormat_ (which must be an object initialized as a NumberFormat) and _x_ (which must be a Number value), and performs the following steps:
</p>

<emu-alg>
1. Let _parts_ be ? PartitionNumberPattern(_numberFormat_, _x_).
1. Let _result_ be an empty String.
1. For each _part_ in _parts_, do:
1. Set _result_ to a String value produced by concatenating _result_ and _part_.[[value]].
1. Return _result_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-formatnumbertoparts" aoid="FormatNumberToParts">
<h1>FormatNumberToParts(numberFormat, x)</h1>

<p>
The FormatNumberToParts abstract operation is called with arguments _numberFormat_ (which must be an object initialized as a NumberFormat) and _x_ (which must be a Number value), and performs the following steps:
</p>

<emu-alg>
1. Let _parts_ be ? PartitionNumberPattern(_numberFormat_, _x_).
1. Let _result_ be ArrayCreate(0).
1. Let _n_ be 0.
1. For each _part_ in _parts_, do:
1. Let _O_ be ObjectCreate(%ObjectPrototype%).
1. Perform ? CreateDataPropertyOrThrow(_O_, "type", _part_.[[type]]).
1. Perform ? CreateDataPropertyOrThrow(_O_, "value", _part_.[[value]]).
1. Perform ? CreateDataPropertyOrThrow(_result_, ? ToString(_n_), _O_).
1. Increment _n_ by 1.
1. Return _result_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-torawprecision" aoid="ToRawPrecision">
<h1>ToRawPrecision(x, minPrecision, maxPrecision)</h1>

Expand Down Expand Up @@ -409,7 +441,7 @@ <h1>Internal slots</h1>

<ul>
<li>The array that is the value of the "nu" property of any locale property of [[localeData]] must not include the values "native", "traditio", or "finance".</li>
<li>[[localeData]][locale] must have a patterns property for all locale values. The value of this property must be an object, which must have properties with the names of the three number format styles: *"decimal"*, *"percent"*, and *"currency"*. Each of these properties in turn must be an object with the properties positivePattern and negativePattern. The value of these properties must be string values that contain a substring *"{number}"*; the values within the currency property must also contain a substring *"{currency}"*. The pattern strings must not contain any characters in the General Category “Number, decimal digit" as specified by the Unicode Standard.</li>
<li>[[localeData]][locale] must have a patterns property for all locale values. The value of this property must be an object, which must have properties with the names of the three number format styles: *"decimal"*, *"percent"*, and *"currency"*. Each of these properties in turn must be an object with the properties positivePattern and negativePattern. The value of these properties must be string values that must contain the substring *"{number}"* and may contain the substrings *"{plusSign}"*, and *"{minusSign}"*; the values within the percent property must also contain the substring *"{percentSign}"*; the values within the currency property must also contain the substring *"{currency}"*. The pattern strings must not contain any characters in the General Category “Number, decimal digit" as specified by the Unicode Standard.</li>
</ul>

<emu-note>
Expand Down Expand Up @@ -457,16 +489,33 @@ <h1>get Intl.NumberFormat.prototype.format</h1>
<emu-alg>
1. Let _nf_ be *this* value.
1. If Type(_nf_) is not Object, throw a *TypeError* exception.
1. If _nf_ does not have an [[initializedNumberFormat]] internal slot, throw a *TypeError* exception.
1. If _nf_.[[initializedNumberFormat]] is *true*, throw a *TypeError* exception.
1. If _nf_.[[boundFormat]] is *undefined*, then
1. Let _F_ be a new built-in function object as defined in Number Format Functions (<emu-xref href="#sec-number-format-functions"></emu-xref>).
1. Let _bf_ be BoundFunctionCreate(_F_, _nf_, « »).
1. Perform ! DefinePropertyOrThrow(_bf_, `"length"`, PropertyDescriptor {[[Value]]: 1, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}).
1. Set _nf_.[[boundFormat]] to bf.
1. Set _nf_.[[boundFormat]] to _bf_.
1. Return _nf_.[[boundFormat]].
</emu-alg>
</emu-clause>

<emu-clause id="sec-intl.numberformat.prototype.formattoparts">
<h1>Intl.NumberFormat.prototype.formatToParts ([ value ])</h1>

<p>
When the *Intl.NumberFormat.prototype.formatToParts* is called with an optional argument _value_, the following steps are taken:
</p>

<emu-alg>
1. Let _nf_ be *this* value.
1. If Type(_nf_) is not Object, throw a *TypeError* exception.
1. If _nf_ does not have an [[initializedNumberFormat]] internal slot, throw a *TypeError* exception.
1. If _value_ is not provided, let _value_ be *undefined*.
1. Let _x_ be ? ToNumber(_value_).
1. Return ? FormatNumberToParts(_nf_, _x_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-intl.numberformat.prototype.resolvedoptions">
<h1>Intl.NumberFormat.prototype.resolvedOptions ()</h1>

Expand Down

0 comments on commit c1f61e1

Please sign in to comment.