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
In extensions.ts the string prototype function replaceAll is replaced by a non-standard implementation. The new implementation in this extension does not comply with the standard signature of replaceAll which causes other extension to fail.
src/client/common/extensions.ts
/** * String.replaceAll implementation * Replaces all instances of a substring with a new substring. */String.prototype.replaceAll=function(this: string,substr: string,newSubstr: string): string{if(!this){returnthis;}/** Escaping function from the MDN web docs site * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping * Escapes all the following special characters in a string . * + ? ^ $ { } ( ) | \ \\ */functionescapeRegExp(unescapedStr: string): string{returnunescapedStr.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');// $& means the whole matched string}returnthis.replace(newRegExp(escapeRegExp(substr),'g'),newSubstr);};
This will fail when the substr argument is a RegExp; but the etandard spec defined that replaceAll should accept a RegExp.
But apart from the correctness of the replacement no extension should replace a functions oon common prototypes such as string.
Would it be possible to revert this and instead use a custom extension function?
Uh oh!
There was an error while loading. Please reload this page.
In extensions.ts the string prototype function
replaceAll
is replaced by a non-standard implementation. The new implementation in this extension does not comply with the standard signature ofreplaceAll
which causes other extension to fail.src/client/common/extensions.ts
This will fail when the
substr
argument is aRegExp
; but the etandard spec defined that replaceAll should accept a RegExp.But apart from the correctness of the replacement no extension should replace a functions oon common prototypes such as string.
Would it be possible to revert this and instead use a custom extension function?
-or-
The text was updated successfully, but these errors were encountered: