refactor(common): remove `i` (ignore case) regex flag where it is not needed (#39077)

It is not necessary to set IGNORECASE flag when the regex pattern does
not contain alphabetic characters

PR Close #39077
This commit is contained in:
Kizashi Nagata 2020-10-01 22:57:41 +09:00 committed by Joey Perrott
parent 5fa012efb8
commit f28b451b0c
1 changed files with 2 additions and 5 deletions

View File

@ -309,10 +309,7 @@ function toKeyValue(obj: {[k: string]: unknown}) {
* Logic from https://github.com/angular/angular.js/blob/864c7f0/src/Angular.js#L1437
*/
function encodeUriSegment(val: string) {
return encodeUriQuery(val, true)
.replace(/%26/gi, '&')
.replace(/%3D/gi, '=')
.replace(/%2B/gi, '+');
return encodeUriQuery(val, true).replace(/%26/g, '&').replace(/%3D/gi, '=').replace(/%2B/gi, '+');
}
@ -331,7 +328,7 @@ function encodeUriSegment(val: string) {
*/
function encodeUriQuery(val: string, pctEncodeSpaces: boolean = false) {
return encodeURIComponent(val)
.replace(/%40/gi, '@')
.replace(/%40/g, '@')
.replace(/%3A/gi, ':')
.replace(/%24/g, '$')
.replace(/%2C/gi, ',')