UNPKG

@ffsm/factory

Version:

A powerful component factory for React that simplifies creation of reusable components with built-in support for composition patterns, conditional rendering, prop management, and TypeScript integration.

46 lines (45 loc) 1.17 kB
// SOURCE: https://www.npmjs.com/package/clsx function toVal(mix) { var k, y, str = ''; if (typeof mix === 'string' || typeof mix === 'number') { str += mix; } else if (typeof mix === 'object' && mix) { if (Array.isArray(mix)) { var len = mix.length; for (k = 0; k < len; k++) { if (mix[k]) { if ((y = toVal(mix[k]))) { str && (str += ' '); str += y; } } } } else { for (y in mix) { if (mix[y]) { str && (str += ' '); str += y; } } } } return str; } export function clsx() { var inputs = []; for (var _i = 0; _i < arguments.length; _i++) { inputs[_i] = arguments[_i]; } var i = 0, tmp, x, str = '', len = inputs.length; for (; i < len; i++) { if ((tmp = inputs[i])) { if ((x = toVal(tmp))) { str && (str += ' '); str += x; } } } return str; }