bootstrap-vue-3
Version:
Early (but lovely) implementation of Vue 3, Bootstrap 5 and Typescript
24 lines (20 loc) • 568 B
text/typescript
interface ComponentProps {
[key: string]: {type: any[]; default: any}
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default (
props: any,
els: ComponentProps,
propPrefix: string,
classPrefix: string = propPrefix
): string[] =>
Object.keys(els).reduce((arr: string[], prop) => {
if (!props[prop]) return arr
arr.push(
[classPrefix, prop.replace(propPrefix, ''), props[prop]]
.filter((e) => e && typeof e !== 'boolean')
.join('-')
.toLowerCase()
)
return arr
}, [])