Travis build: 132

This commit is contained in:
Travis CI
2017-12-22 16:19:18 +00:00
parent 85d9882623
commit dfc910b28c
2 changed files with 0 additions and 29 deletions

View File

@ -140,7 +140,6 @@
* [`reverseString`](#reversestring)
* [`sortCharactersInString`](#sortcharactersinstring)
* [`toCamelCase`](#tocamelcase)
* [`toSnakeCase`](#tosnakecase)
* [`truncateString`](#truncatestring)
* [`words`](#words)
@ -1912,23 +1911,6 @@ const toCamelCase = str =>
[⬆ back to top](#table-of-contents)
### toSnakeCase
Converts a string to snakecase.
Use `replace()` to add underscores before capital letters, convert `toLowerCase()`, then `replace()` hyphens and spaces with underscores.
```js
const toSnakeCase = str =>
str.replace(/[A-Z]/g, (match, p1, p2, offset) => '_' + match).toLowerCase().replace(/[\s-]+/g,'_');
// toSnakeCase("camelCase") -> 'camel_case'
// toSnakeCase("some text") -> 'some_text'
// toSnakeCase("some-javascript-property") -> 'some_javascript_property'
// toSnakeCase("some-mixed_string With spaces_underscores-and-hyphens") -> 'some_mixed_string_with_spaces_underscores_and_hyphens'
```
[⬆ back to top](#table-of-contents)
### truncateString
Truncates a string up to a specified length.