File size: 197 Bytes
9a79ad0
 
 
 
 
1
2
3
4
5
6
export const kebabCase = (str: string): string =>
	(str.match(/[A-Z]{2,}(?=[A-Z][a-z0-9]*|\b)|[A-Z]?[a-z0-9]*|[A-Z]|[0-9]+/g) ?? [])
		.filter(Boolean)
		.map((x) => x.toLowerCase())
		.join('-');