From c55fbcb8edca1fe118a44f68c9f9436a4719d171 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Tue, 10 Jan 2023 15:29:06 +0100 Subject: Remove more unnecessary polyfills from webapi for Node 16 (#5814) * feat(webapi): Remove unnecessary polyfills now that we dropped support for Node 14 * feat(webapi): Removed more unnecessary polyfills for Node 16 * chore: changeset --- packages/webapi/src/lib/String.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 packages/webapi/src/lib/String.ts (limited to 'packages/webapi/src/lib/String.ts') diff --git a/packages/webapi/src/lib/String.ts b/packages/webapi/src/lib/String.ts deleted file mode 100644 index 92d39f39a..000000000 --- a/packages/webapi/src/lib/String.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as _ from './utils' - -export const replaceAll = { - replaceAll( - this: string, - searchValue: RegExp | string, - replaceValue: string | ((substring: string, ...args: any[]) => string) - ) { - return _.__object_isPrototypeOf(RegExp.prototype, searchValue) - ? this.replace(searchValue as RegExp, replaceValue as string) - : this.replace( - new RegExp(_.__string_escapeRegExp(searchValue as string), 'g'), - replaceValue as string - ) - }, -}.replaceAll - -export const initString = (target: any, exclude: Set) => { - if (exclude.has('String') || exclude.has('replaceAll')) return - - const Class = target.String || globalThis.String - - if (!Class.prototype.replaceAll) - Object.defineProperty(Class.prototype, 'replaceAll', { - value: replaceAll, - writable: true, - enumerable: false, - configurable: true, - }) -} -- cgit v1.2.3