diff --git a/esmeta-ignore.json b/esmeta-ignore.json index 7ed0c500ef..4bd20a1cb3 100644 --- a/esmeta-ignore.json +++ b/esmeta-ignore.json @@ -51,5 +51,6 @@ "Statement[0,0].LabelledEvaluation", "Statement[1,0].LabelledEvaluation", "Statement[2,0].LabelledEvaluation", - "StringCreate" + "StringCreate", + "StringPad" ] diff --git a/spec.html b/spec.html index 26226fde50..a023159ed6 100644 --- a/spec.html +++ b/spec.html @@ -29073,7 +29073,7 @@

1. Let _Octets_ be the List of octets resulting by applying the UTF-8 transformation to _cp_.[[CodePoint]]. 1. For each element _octet_ of _Octets_, do 1. Let _hex_ be the String representation of _octet_, formatted as an uppercase hexadecimal number. - 1. Set _R_ to the string-concatenation of _R_, *"%"*, and ! StringPad(_hex_, *2*𝔽, *"0"*, ~start~). + 1. Set _R_ to the string-concatenation of _R_, *"%"*, and StringPad(_hex_, 2, *"0"*, ~start~). 1. Return _R_. @@ -34326,7 +34326,7 @@

String.prototype.padEnd ( _maxLength_ [ , _fillString_ ] )

This method performs the following steps when called:

1. Let _O_ be ? RequireObjectCoercible(*this* value). - 1. Return ? StringPad(_O_, _maxLength_, _fillString_, ~end~). + 1. Return ? StringPaddingBuiltinsImpl(_O_, _maxLength_, _fillString_, ~end~). @@ -34335,12 +34335,12 @@

String.prototype.padStart ( _maxLength_ [ , _fillString_ ] )

This method performs the following steps when called:

1. Let _O_ be ? RequireObjectCoercible(*this* value). - 1. Return ? StringPad(_O_, _maxLength_, _fillString_, ~start~). + 1. Return ? StringPaddingBuiltinsImpl(_O_, _maxLength_, _fillString_, ~start~). - +

- StringPad ( + StringPaddingBuiltinsImpl ( _O_: an ECMAScript language value, _maxLength_: an ECMAScript language value, _fillString_: an ECMAScript language value, @@ -34354,11 +34354,29 @@

1. Let _intMaxLength_ be ℝ(? ToLength(_maxLength_)). 1. Let _stringLength_ be the length of _S_. 1. If _intMaxLength_ ≤ _stringLength_, return _S_. - 1. If _fillString_ is *undefined*, let _filler_ be the String value 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 the String value consisting of repeated concatenations of _filler_ truncated to length _fillLen_. + 1. If _fillString_ is *undefined*, set _fillString_ to the String value consisting solely of the code unit 0x0020 (SPACE). + 1. Else, set _fillString_ to ? ToString(_fillString_). + 1. Return StringPad(_S_, _intMaxLength_, _fillString_, _placement_). + + + + +

+ StringPad ( + _S_: a String, + _maxLength_: a non-negative integer, + _fillString_: a String, + _placement_: ~start~ or ~end~, + ): a String +

+
+
+ + 1. Let _stringLength_ be the length of _S_. + 1. If _maxLength_ ≤ _stringLength_, return _S_. + 1. If _fillString_ is the empty String, return _S_. + 1. Let _fillLen_ be _maxLength_ - _stringLength_. + 1. Let _truncatedStringFiller_ be the String value consisting of repeated concatenations of _fillString_ truncated to length _fillLen_. 1. If _placement_ is ~start~, return the string-concatenation of _truncatedStringFiller_ and _S_. 1. Else, return the string-concatenation of _S_ and _truncatedStringFiller_. @@ -34381,7 +34399,7 @@

1. Let _S_ be the String representation of _n_, formatted as a decimal number. - 1. Return ! StringPad(_S_, 𝔽(_minLength_), *"0"*, ~start~). + 1. Return StringPad(_S_, _minLength_, *"0"*, ~start~). @@ -44220,7 +44238,7 @@

1. Let _n_ be the numeric value of _C_. 1. Assert: _n_ ≤ 0xFFFF. 1. Let _hex_ be the String representation of _n_, formatted as a lowercase hexadecimal number. - 1. Return the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS), *"u"*, and ! StringPad(_hex_, *4*𝔽, *"0"*, ~start~). + 1. Return the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS), *"u"*, and StringPad(_hex_, 4, *"0"*, ~start~). @@ -49034,10 +49052,10 @@

escape ( _string_ )

1. Let _n_ be the numeric value of _C_. 1. If _n_ < 256, then 1. Let _hex_ be the String representation of _n_, formatted as an uppercase hexadecimal number. - 1. Let _S_ be the string-concatenation of *"%"* and ! StringPad(_hex_, *2*𝔽, *"0"*, ~start~). + 1. Let _S_ be the string-concatenation of *"%"* and StringPad(_hex_, 2, *"0"*, ~start~). 1. Else, 1. Let _hex_ be the String representation of _n_, formatted as an uppercase hexadecimal number. - 1. Let _S_ be the string-concatenation of *"%u"* and ! StringPad(_hex_, *4*𝔽, *"0"*, ~start~). + 1. Let _S_ be the string-concatenation of *"%u"* and StringPad(_hex_, 4, *"0"*, ~start~). 1. Set _R_ to the string-concatenation of _R_ and _S_. 1. Set _k_ to _k_ + 1. 1. Return _R_.