UNPKG

mobile-react-infinite-calendar

Version:

A mobile-optimized infinite scroll calendar component for React

48 lines (47 loc) 1.05 kB
/** * 간단한 클래스명 조합 유틸리티 (clsx 대체) */ function toVal(mix) { let k; let y; let str = ''; if (typeof mix === 'string' || typeof mix === 'number') { str += mix; } else if (typeof mix === 'object') { if (Array.isArray(mix)) { for (k of mix) { if (k) { if ((y = toVal(k))) { str && (str += ' '); str += y; } } } } else if (mix) { for (k in mix) { if (mix[k]) { str && (str += ' '); str += k; } } } } return str; } export function cn(...inputs) { let i = 0; let tmp; let x; let str = ''; while (i < inputs.length) { if ((x = inputs[i++])) { if ((tmp = toVal(x))) { str && (str += ' '); str += tmp; } } } return str; }