| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| 11 | 11 |
| 12 var GlobalString = global.String; | 12 var GlobalString = global.String; |
| 13 var MakeTypeError; | |
| 14 | |
| 15 utils.Import(function(from) { | |
| 16 MakeTypeError = from.MakeTypeError; | |
| 17 }); | |
| 18 | 13 |
| 19 // ------------------------------------------------------------------- | 14 // ------------------------------------------------------------------- |
| 20 // http://tc39.github.io/proposal-string-pad-start-end/ | 15 // http://tc39.github.io/proposal-string-pad-start-end/ |
| 21 | 16 |
| 22 function StringPad(thisString, maxLength, fillString) { | 17 function StringPad(thisString, maxLength, fillString) { |
| 23 maxLength = TO_LENGTH(maxLength); | 18 maxLength = TO_LENGTH(maxLength); |
| 24 var stringLength = thisString.length; | 19 var stringLength = thisString.length; |
| 25 | 20 |
| 26 if (maxLength <= stringLength) return ""; | 21 if (maxLength <= stringLength) return ""; |
| 27 | 22 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return thisString + StringPad(thisString, maxLength, fillString); | 64 return thisString + StringPad(thisString, maxLength, fillString); |
| 70 } | 65 } |
| 71 %FunctionSetLength(StringPadEnd, 1); | 66 %FunctionSetLength(StringPadEnd, 1); |
| 72 | 67 |
| 73 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ | 68 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ |
| 74 "padStart", StringPadStart, | 69 "padStart", StringPadStart, |
| 75 "padEnd", StringPadEnd | 70 "padEnd", StringPadEnd |
| 76 ]); | 71 ]); |
| 77 | 72 |
| 78 }); | 73 }); |
| OLD | NEW |