Replace forEach() with for()

This commit is contained in:
redphx
2024-10-22 10:42:09 +07:00
parent 01502363ab
commit 6cfff0274d
7 changed files with 25 additions and 16 deletions

View File

@@ -121,9 +121,12 @@ export function createButton<T=HTMLButtonElement>(options: BxButton): T {
}
const style = (options.style || 0) as number;
style && ButtonStyleIndices.forEach((index: keyof typeof ButtonStyleClass) => {
if (style) {
let index: keyof typeof ButtonStyleClass;
for (index of ButtonStyleIndices) {
(style & index) && $btn.classList.add(ButtonStyleClass[index] as string);
});
}
}
options.classes && $btn.classList.add(...options.classes);