Skip to content

Commit

Permalink
Backport #472 (Fix #471)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jan 8, 2019
1 parent a5def74 commit bc3feb1
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
8 changes: 4 additions & 4 deletions client/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* core-js 2.6.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2018 Denis Pushkarev
* © 2019 Denis Pushkarev
*/
!function(__e, __g, undefined){
'use strict';
Expand Down Expand Up @@ -6393,12 +6393,12 @@ __webpack_require__(62)('replace', 2, function (defined, REPLACE, $replace, mayb
break;
default: // \d\d?
var n = +ch;
if (n === 0) return ch;
if (n === 0) return match;
if (n > m) {
var f = floor(n / 10);
if (f === 0) return ch;
if (f === 0) return match;
if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
return ch;
return match;
}
capture = captures[n - 1];
}
Expand Down
4 changes: 2 additions & 2 deletions client/core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/core.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* core-js 2.6.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2018 Denis Pushkarev
* © 2019 Denis Pushkarev
*/
!function(__e, __g, undefined){
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion client/library.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions modules/es6.regexp.replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ require('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace, may
break;
default: // \d\d?
var n = +ch;
if (n === 0) return ch;
if (n === 0) return match;
if (n > m) {
var f = floor(n / 10);
if (f === 0) return ch;
if (f === 0) return match;
if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
return ch;
return match;
}
capture = captures[n - 1];
}
Expand Down
4 changes: 3 additions & 1 deletion tests/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/tests/es6.regexp.replace.ls
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ run = (assert)->
assert.strictEqual 'uid=31'replace(/(uid=)(\d+)/, '$11A15'), 'uid=1A15', 'S15.5.4.11_A3_T3'
assert.strictEqual 'abc12 def34'replace(/([a-z]+)([0-9]+)/, -> &.2 + &.1), '12abc def34', 'S15.5.4.11_A4_T1'
assert.strictEqual 'aaaaaaaaaa,aaaaaaaaaaaaaaa'replace(/^(a+)\1*,\1+$/, '$1'), \aaaaa, 'S15.5.4.11_A5_T1'
# https://github.com/zloirock/core-js/issues/471
assert.strictEqual '{price} Retail'replace(/{price}/g, '$25.00'), '$25.00 Retail'
assert.strictEqual 'a'replace(/(.)/, '$0'), '$0'

test 'String#replace regression' run

Expand Down

0 comments on commit bc3feb1

Please sign in to comment.