Skip to content

Commit

Permalink
fix buggy String#padStart and String#padEnd mobile Safari implementat…
Browse files Browse the repository at this point in the history
…ions, backport of 16dbccf
  • Loading branch information
zloirock committed Feb 15, 2019
1 parent 8d954ed commit 990ae2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/es7.string.pad-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ var $pad = require('./_string-pad');
var userAgent = require('./_user-agent');

// https://github.com/zloirock/core-js/issues/280
$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);

$export($export.P + $export.F * WEBKIT_BUG, 'String', {
padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
}
Expand Down
4 changes: 3 additions & 1 deletion modules/es7.string.pad-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ var $pad = require('./_string-pad');
var userAgent = require('./_user-agent');

// https://github.com/zloirock/core-js/issues/280
$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);

$export($export.P + $export.F * WEBKIT_BUG, 'String', {
padStart: function padStart(maxLength /* , fillString = ' ' */) {
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
}
Expand Down

0 comments on commit 990ae2f

Please sign in to comment.