From 474f8c40a3056773df9342e22425cc7ae047d9ff Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 5 Jan 2023 12:53:34 +0100 Subject: [PATCH] ref(vue): Use `string.repeat()` --- packages/vue/src/components.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/vue/src/components.ts b/packages/vue/src/components.ts index 9aa78a5a23dc..86c7e8f2f65f 100644 --- a/packages/vue/src/components.ts +++ b/packages/vue/src/components.ts @@ -8,17 +8,8 @@ const ROOT_COMPONENT_NAME = ''; const ANONYMOUS_COMPONENT_NAME = ''; const repeat = (str: string, n: number): string => { - let res = ''; - while (n) { - if (n % 2 === 1) { - res += str; - } - if (n > 1) { - str += str; // eslint-disable-line no-param-reassign - } - n >>= 1; // eslint-disable-line no-bitwise, no-param-reassign - } - return res; + // string.repeat() is not supported by IE11, we fall back to just using the string in that case + return str.repeat ? str.repeat(n) : str; }; export const formatComponentName = (vm?: ViewModel, includeFile?: boolean): string => {