Skip to content

Instantly share code, notes, and snippets.

@danny-andrews
Created September 12, 2017 18:40
Show Gist options
  • Save danny-andrews/6cf3fda1b247975bae57d8e5e1e1b047 to your computer and use it in GitHub Desktop.
Save danny-andrews/6cf3fda1b247975bae57d8e5e1e1b047 to your computer and use it in GitHub Desktop.
Flow + functional programming = 💩
// Well, shit
const verticalModifiers = ['top', 'middle', 'bottom'];
const horizontalModifiers = ['start', 'center', 'end'];
const modifiers = verticalModifiers.concat(horizontalModifiers);
const getPassthroughClassNames = () => modifiers
.map(name => [name, props[name]])
.filter(([, value]) => value)
.map(([name, value]) => `${name}-${value}`)
.map(getClass);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment