diff --git a/lib/helpers/classes.tsx b/lib/helpers/classes.tsx index 1863652..876f8b6 100644 --- a/lib/helpers/classes.tsx +++ b/lib/helpers/classes.tsx @@ -14,27 +14,16 @@ interface ClassToggles { function scopedClassMaker(prefix: string) { - return function (name: string | ClassToggles, options?: Options) { - const namesObject = (typeof name === 'string' || name === undefined) ? - {[name]: name} : - name; - - const scoped = Object - .entries(namesObject) + return (name: string | ClassToggles, options?: Options) => + Object + .entries(name instanceof Object ? name : {[name]: name}) .filter(kv => kv[1] !== false) .map(kv => kv[0]) .map(name => [prefix, name] .filter(Boolean) .join('-')) + .concat(options && options.extra || []) .join(' '); - - if (options && options.extra) { - return [scoped, options && options.extra].filter(Boolean).join(' '); - } else { - return scoped; - } - }; - } export {scopedClassMaker}; \ No newline at end of file