Created
June 26, 2017 18:25
-
-
Save estrattonbailey/10223b66d64ff9395b37c984c45adcbe to your computer and use it in GitHub Desktop.
CX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const triage = obj => Object.keys(obj).reduce((res, key) => { | |
res += !!(obj[key]) ? ` ${key}` : '' | |
return res | |
}, ' ') | |
const cx = (...args) => args.reduce((res, arg) => { | |
res += typeof arg === 'string' ? ` ${arg}` : triage(arg) | |
return res | |
}, ' ').trim().replace(/\s\s/, ' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment