Skip to content

Instantly share code, notes, and snippets.

@6ewis
Forked from mrwithersea/ramda-title-case.js
Created January 22, 2019 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 6ewis/7a0d7bd7f489a3d0be42ecf2231d2864 to your computer and use it in GitHub Desktop.
Save 6ewis/7a0d7bd7f489a3d0be42ecf2231d2864 to your computer and use it in GitHub Desktop.
Ramda Title Case
import R from 'ramda';
const capitalize =
R.converge(
R.concat(),
[
R.compose(
R.toUpper,
R.head
),
R.tail,
]
);
const toTitleCase =
R.compose(
R.join(' '),
R.map(capitalize),
R.split(' ')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment