You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Replace any array element access (foo.1 => foo[1] or foo?.[1]).
511
511
replacementPath=replacementPath
512
-
.replace(/\.(\d+)/g,shouldIgnoreOptionalChaining ? '[$1]' : '.[$1]')// Usages in middle of path.
512
+
.replaceAll(/\.(\d+)/g,shouldIgnoreOptionalChaining ? '[$1]' : '.[$1]')// Usages in middle of path.
513
513
.replace(/^(\d+)\??\./,shouldIgnoreOptionalChaining ? '[$1].' : '[$1]?.')// Usage at beginning of path.
514
514
.replace(/^(\d+)$/,'[$1]');// Usage as entire string.
515
515
516
516
// Replace any array element access using `firstObject` and `lastObject` (foo.firstObject => foo[0] or foo?.[0]).
517
517
replacementPath=replacementPath
518
-
.replace(/\.firstObject/g,shouldIgnoreOptionalChaining ? '[0]' : '.[0]')// When `firstObject` is used in the middle of the path. e.g. foo.firstObject
518
+
.replaceAll('.firstObject',shouldIgnoreOptionalChaining ? '[0]' : '.[0]')// When `firstObject` is used in the middle of the path. e.g. foo.firstObject
519
519
.replace(/^firstObject\??\./,shouldIgnoreOptionalChaining ? '[0].' : '[0]?.')// When `firstObject` is used at the beginning of the path. e.g. firstObject.bar
520
520
.replace(/^firstObject$/,'[0]');// When `firstObject` is used as the entire path.
0 commit comments