Replace lodash
- Dominant language
- JavaScript
- Stars
- 35.8k
- Forks
- 4.1k
- Avg merge
- 2d 26m
- Merged PRs (30d)
- 33
Description
**Is your feature request related to a problem? Please describe.**
Lodash is a relatively large utility package but is only used for kebab-case, snake_case, and camelCase
**Describe the solution you'd like**
Use vanilla js. Below algorithms require fine tuning/testing
to kebab case
```
const kebabCase = string => string
.replace(/([a-z])([A-Z])/g, "$1-$2")
.replace(/[\s_]+/g, '-')
.toLowerCase();
```
to snake case
```
const snakeCase = string =>string
.replace(/\W+/g, " ")
.split(/ |\B(?=[A-Z])/)
.map(word => word.toLowerCase())
.join('_');
```
to camel case
```
const camelCase = string => string
.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
return index === 0 ? word.toLowerCase() : word.toUpperCase();
})
.replace(/\s+/g, '');
```
**Describe alternatives you've considered**
there are other solutions that don't require lodash
Contributor guide
Assessment
This issue has not been assessed yet.