Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: LEAP-381: Remove excess regexp from BEM module #285

Merged
merged 2 commits into from
Dec 27, 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
4 changes: 2 additions & 2 deletions src/utils/bem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const assembleClass = (block: string, elem?: string, mix?: CNMix | CNMix[], mod?
}

const attachNamespace = (cls: string) => {
if (new RegExp(CSS_PREFIX).test(cls)) return cls;
else return `${CSS_PREFIX}${cls}`;
if (typeof cls !== 'string') console.error('Non-string classname: ', cls);
return String(cls).startsWith(CSS_PREFIX) ? cls : `${CSS_PREFIX}${cls}`;
};

return finalClass.map(attachNamespace).join(" ");
Expand Down