UNPKG

@thenewboston/utils

Version:

Utility files for the thenewboston community

20 lines (17 loc) 396 B
export const bemify = ( classNames: string | undefined, suffix: string, isVisible: boolean = true ): { [className: string]: boolean } => { const classNameList = classNames?.split(' ') || null; if (classNameList) { return classNameList.reduce( (acc, className) => ({ ...acc, [`${className}${suffix}`]: isVisible, }), {} ); } return {}; };