Skip to content

Commit

Permalink
Per May 2016 TC39 consensus, String#{padStart,padEnd} is now stage 4!
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 25, 2016
1 parent 9b49a88 commit 8b72d16
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -27130,6 +27130,46 @@ <h1>String.prototype [ @@iterator ] ( )</h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-string.prototype.padstart">
<h1>String.prototype.padStart( maxLength [ , fillString ] )</h1>
<p>When the `padStart` method is called, the following steps are taken:</p>
<emu-alg>
1. Let _O_ be ? RequireObjectCoercible(*this* value).
1. Let _S_ be ? ToString(_O_).
1. Let _intMaxLength_ be ? ToLength(_maxLength_).
1. Let _stringLength_ be the number of elements in _S_.
1. If _intMaxLength_ is not greater than _stringLength_, return _S_.
1. If _fillString_ is *undefined*, let _filler_ be a String consisting solely of the code unit 0x0020 (SPACE).
1. Else, let _filler_ be ? ToString(_fillString_).
1. If _filler_ is the empty String, return _S_.
1. Let _fillLen_ be _intMaxLength_ - _stringLength_.
1. Let _truncatedStringFiller_ be a new String value consisting of repeated concatenations of _filler_ truncated to length _fillLen_.
1. Return a new String value computed by the concatenation of _truncatedStringFiller_ and _S_.
</emu-alg>
<emu-note>The first argument _maxLength_ will be clamped such that it can be no smaller than the length of the *this* value.</emu-note>
<emu-note>The optional second argument _fillString_ defaults to *" "* (a String consisting of 0x0020 SPACE).</emu-note>
</emu-clause>

<emu-clause id="sec-string.prototype.padend">
<h1>String.prototype.padEnd( maxLength [ , fillString ] )</h1>
<p>When the `padEnd` method is called, the following steps are taken:</p>
<emu-alg>
1. Let _O_ be ? RequireObjectCoercible(*this* value).
1. Let _S_ be ? ToString(_O_).
1. Let _intMaxLength_ be ? ToLength(_maxLength_).
1. Let _stringLength_ be the number of elements in _S_.
1. If _intMaxLength_ is not greater than _stringLength_, return _S_.
1. If _fillString_ is *undefined*, let _filler_ be a String consisting solely of the code unit 0x0020 (SPACE).
1. Else, let _filler_ be ? ToString(_fillString_).
1. If _filler_ is the empty String, return _S_.
1. Let _fillLen_ be _intMaxLength_ - _stringLength_.
1. Let _truncatedStringFiller_ be a new String value consisting of repeated concatenations of _filler_ truncated to length _fillLen_.
1. Return a new String value computed by the concatenation of _S_ and _truncatedStringFiller_.
</emu-alg>
<emu-note>The first argument _maxLength_ will be clamped such that it can be no smaller than the length of the *this* value.</emu-note>
<emu-note>The optional second argument _fillString_ defaults to *" "* (a String consisting of 0x0020 SPACE).</emu-note>
</emu-clause>

<!-- es6num="21.1.4" -->
<emu-clause id="sec-properties-of-string-instances">
<h1>Properties of String Instances</h1>
Expand Down

0 comments on commit 8b72d16

Please sign in to comment.