initial commit on github

This commit is contained in:
2021-05-02 16:00:16 +03:00
commit 3dc496b7a4
149 changed files with 19303 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
export interface ObjectClassNames {
[index: string]: boolean;
}
export type ClassName = number | string | ObjectClassNames | false | null | undefined;
export default function classNames(...classNames: ClassName[]) {
let result: string[] = [];
classNames.forEach((item: ClassName): void => {
if(!item) {
return;
}
switch(typeof item) {
case 'string':
result.push(item);
break;
case 'object':
Object.keys(item).forEach((key: string) => {
if(item[key]) {
result.push(key);
}
});
break;
default:
result.push(`${item}`);
}
});
return result.join(' ');
}