From f28b451b0c3f3126790bfc696a6ea720c8681fe9 Mon Sep 17 00:00:00 2001 From: Kizashi Nagata Date: Thu, 1 Oct 2020 22:57:41 +0900 Subject: [PATCH] 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 --- packages/common/upgrade/src/params.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/common/upgrade/src/params.ts b/packages/common/upgrade/src/params.ts index 51518ce8a2..67b53b2c68 100644 --- a/packages/common/upgrade/src/params.ts +++ b/packages/common/upgrade/src/params.ts @@ -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, ',')