code/config/case.ts

10 lines
190 B
TypeScript

export function convertCase(str: string): string {
return str
.split(' ')
.reduce((p: string[], c) => {
p.push(c.toLowerCase());
return p;
}, [])
.join('-');
}