Skip to content

Instantly share code, notes, and snippets.

@ahdinosaur
Created April 20, 2017 04:46
Show Gist options
  • Save ahdinosaur/f35617bd4c9e2d46362d87197b909c19 to your computer and use it in GitHub Desktop.
Save ahdinosaur/f35617bd4c9e2d46362d87197b909c19 to your computer and use it in GitHub Desktop.
fp
const toConstantCase = pipe(
map(toUpper),
join('_')
)
function pipe (...fns) {
return (value) => {
return fns.reduce((sofar, nextFn) {
return nextFn(sofar)
}, value)
}
}
function mapToUpper (items) {
return items.map(str => str.toUpperCase())
}
function joinItems (items) {
return items.join('_')
}
function toConstantCase (path) {
return path
.map(str => str.toUpperCase())
.join('_')
}
const TYPE = toConstantCase(['feathers', 'dogs', 'create'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment