Travis build: 688

This commit is contained in:
30secondsofcode
2018-10-26 14:19:53 +00:00
parent db3c199beb
commit d6af04ac28
20 changed files with 97 additions and 53 deletions

View File

@ -5,10 +5,11 @@ Converts a string to title case.
Break the string into words, using a regexp, and combine them capitalizing the first letter of each word and adding a whitespace between them.
```js
const toTitleCase = str => str
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
.map(x => x.charAt(0).toUpperCase() + x.slice(1))
.join(' ');
const toTitleCase = str =>
str
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
.map(x => x.charAt(0).toUpperCase() + x.slice(1))
.join(' ');
```
```js