Signed-off-by: Avior <github@avior.me>
This commit is contained in:
2021-10-06 17:57:59 +02:00
parent bb001148a5
commit 8d7a8c70f0
73 changed files with 1508 additions and 6817 deletions

26
src/Util.ts Normal file
View File

@ -0,0 +1,26 @@
export function buildClassName(...classes: Array<Array<any> | string | undefined>): string | undefined {
const classesFinal: Array<string> = []
root: for (const classe of classes) {
if (typeof classe === 'undefined') {
continue
}
if (typeof classe === 'string') {
classesFinal.push(classe)
continue
}
const classToPut = classe.shift()
if (typeof classToPut === 'undefined') {
continue
}
for (const iterator of classe) {
if (!iterator) {
continue root
}
}
classesFinal.push(classToPut)
}
if (classesFinal.length === 0) {
return undefined
}
return classesFinal.join(' ')
}