Skip to content

ref(vue): Use string.repeat() #6663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions packages/vue/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,8 @@ const ROOT_COMPONENT_NAME = '<Root>';
const ANONYMOUS_COMPONENT_NAME = '<Anonymous>';

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 => {
Expand Down