UNPKG
@infinum/plop-next-ts-generators
Version:
beta (0.0.1-4)
latest (2.0.0)
2.0.0
1.0.3
1.0.2
1.0.1
1.0.0
0.0.1-5
0.0.1-4
0.0.1-3
0.0.1-2
0.0.1-1
0.0.1-0
Next.js generators
@infinum/plop-next-ts-generators
/
tests
/
helpers
/
utils.js
10 lines
(8 loc)
•
191 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
const
kebabCase
= (
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.
toLowerCase
()) .
join
(
'-'
);
module
.
exports
= { kebabCase, };