File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,20 @@ if (!String.prototype.startsWith) {
1919 return this.indexOf(searchString, position) === position;
2020 };
2121}
22+
23+ if (!String.prototype.padStart) {
24+ String.prototype.padStart = function padStart(targetLength,padString) {
25+ targetLength = targetLength>>0; //truncate if number or convert non-number to 0;
26+ padString = String((typeof padString !== 'undefined' ? padString : ' '));
27+ if (this.length > targetLength) {
28+ return String(this);
29+ }
30+ else {
31+ targetLength = targetLength-this.length;
32+ if (targetLength > padString.length) {
33+ padString += padString.repeat(targetLength/padString.length); //append to original to ensure we are longer than needed
34+ }
35+ return padString.slice(0,targetLength) + String(this);
36+ }
37+ };
38+ }
You can’t perform that action at this time.
0 commit comments