This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.html
136 lines (126 loc) · 9.02 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!doctype html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./spec.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<title>String.prototype.padStart / padEnd</title>
<script type="application/json" id="menu-search-biblio">
[{
"type": "clause",
"id": "String.prototype.padStart",
"aoid": null,
"title": "String.prototype.padStart( maxLength [ , fillString ] )",
"number": "1",
"location": "",
"key": "String.prototype.padStart( maxLength [ , fillString ] )"
}, {
"type": "clause",
"id": "String.prototype.padEnd",
"aoid": null,
"title": "String.prototype.padEnd( maxLength [ , fillString ] )",
"number": "2",
"location": "",
"key": "String.prototype.padEnd( maxLength [ , fillString ] )"
}, {
"type": "clause",
"id": "sec-copyright-and-software-license",
"aoid": null,
"title": "Copyright & Software License",
"number": "A",
"location": "",
"key": "Copyright & Software License"
}]
</script>
</head>
<body>
<div id="menu-toggle">☰</div>
<div id="menu">
<div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search...">
<div id="menu-search-results" class="inactive"></div>
</div>
<div id="menu-toc">
<ol class="toc">
<li><span class="item-toggle-none"></span><a href="#String.prototype.padStart" title="String.prototype.padStart( maxLength [ , fillString ] )"><span class="secnum">1</span> String.prototype.padStart( maxLength [ , fillString ] )</a></li>
<li><span class="item-toggle-none"></span><a href="#String.prototype.padEnd" title="String.prototype.padEnd( maxLength [ , fillString ] )"><span class="secnum">2</span> String.prototype.padEnd( maxLength [ , fillString ] )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright & Software License"><span class="secnum">A</span> Copyright & Software License</a></li>
</ol>
</div>
</div>
<h1 class="version">Stage 3 Draft / March 29, 2016</h1>
<h1 class="title">String.prototype.padStart / padEnd</h1>
<emu-clause id="String.prototype.padStart">
<h1><span class="secnum">1</span>String.prototype.padStart( maxLength [ , fillString ] )<span class="utils"><span class="anchor"><a href="#String.prototype.padStart">#</a></span></span></h1>
<p>When the <code>padStart</code> method is called, the following steps are taken:</p>
<emu-alg>
<ol>
<li>Let <var>O</var> be ?
<emu-xref aoid="RequireObjectCoercible"><a href="https://tc39.github.io/ecma262#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(
<emu-val>this</emu-val> value).</li>
<li>Let <var>S</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>O</var>).</li>
<li>Let <var>intMaxLength</var> be ?
<emu-xref aoid="ToLength"><a href="https://tc39.github.io/ecma262#sec-tolength">ToLength</a></emu-xref>(<var>maxLength</var>).</li>
<li>Let <var>stringLength</var> be the number of elements in S.</li>
<li>If <var>intMaxLength</var> is not greater than <var>stringLength</var>, return <var>S</var>.</li>
<li>If <var>fillString</var> is
<emu-val>undefined</emu-val>, let <var>filler</var> be a string consisting solely of the code unit U+0020 (SPACE).</li>
<li>Else, let <var>filler</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>fillString</var>).</li>
<li>If <var>filler</var> is the empty String, return <var>S</var>.</li>
<li>Let <var>fillLen</var> be <var>intMaxLength</var> - <var>stringLength</var>.</li>
<li>Let <var>truncatedStringFiller</var> be a new String value consisting of repeated concatenations of <var>filler</var> truncated to length <var>fillLen</var>.</li>
<li>Return a new String value computed by the concatenation of <var>truncatedStringFiller</var> and <var>S</var>.
</li>
</ol>
</emu-alg>
<emu-note><span class="note">Note 1</span>The first argument <var>maxLength</var> will be clamped such that it can be no smaller than the length of the
<emu-val>this</emu-val> value.</emu-note>
<emu-note><span class="note">Note 2</span>The optional second argument <var>fillString</var> defaults to
<emu-val>" "</emu-val> (a string consisting of U+0020 SPACE).</emu-note>
</emu-clause>
<emu-clause id="String.prototype.padEnd">
<h1><span class="secnum">2</span>String.prototype.padEnd( maxLength [ , fillString ] )<span class="utils"><span class="anchor"><a href="#String.prototype.padEnd">#</a></span></span></h1>
<p>When the <code>padEnd</code> method is called, the following steps are taken:</p>
<emu-alg>
<ol>
<li>Let <var>O</var> be ?
<emu-xref aoid="RequireObjectCoercible"><a href="https://tc39.github.io/ecma262#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(
<emu-val>this</emu-val> value).</li>
<li>Let <var>S</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>O</var>).</li>
<li>Let <var>intMaxLength</var> be ?
<emu-xref aoid="ToLength"><a href="https://tc39.github.io/ecma262#sec-tolength">ToLength</a></emu-xref>(<var>maxLength</var>).</li>
<li>Let <var>stringLength</var> be the number of elements in S.</li>
<li>If <var>intMaxLength</var> is not greater than <var>stringLength</var>, return <var>S</var>.</li>
<li>If <var>fillString</var> is
<emu-val>undefined</emu-val>, let <var>filler</var> be a string consisting solely of the code unit U+0020 (SPACE).</li>
<li>Else, let <var>filler</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>fillString</var>).</li>
<li>If <var>filler</var> is the empty String, return <var>S</var>.</li>
<li>Let <var>fillLen</var> be <var>intMaxLength</var> - <var>stringLength</var>.</li>
<li>Let <var>truncatedStringFiller</var> be a new String value consisting of repeated concatenations of <var>filler</var> truncated to length <var>fillLen</var>.</li>
<li>Return a new String value computed by the concatenation of <var>S</var> and <var>truncatedStringFiller</var>.
</li>
</ol>
</emu-alg>
<emu-note><span class="note">Note 1</span>The first argument <var>maxLength</var> will be clamped such that it can be no smaller than the length of the
<emu-val>this</emu-val> value.</emu-note>
<emu-note><span class="note">Note 2</span>The optional second argument <var>fillString</var> defaults to
<emu-val>" "</emu-val> (a string consisting of U+0020 SPACE).</emu-note>
</emu-clause>
<emu-annex id="sec-copyright-and-software-license">
<h1><span class="secnum">A</span>Copyright & Software License<span class="utils"><span class="anchor"><a href="#sec-copyright-and-software-license">#</a></span></span></h1>
<h2>Copyright Notice</h2>
<p>© 2016 Jordan Harband</p>
<h2>Software License</h2>
<p>All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<ol>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li>Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.</li>
</ol>
<p>THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
</emu-annex>
</body>