Skip to content

Commit 9b616b4

Browse files
committed
feat: create Strings util class
1 parent 1ccc542 commit 9b616b4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/utils/strings.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export class Strings {
2+
public static toKebabCase(str: string) {
3+
return str
4+
.split('')
5+
.map((letter, idx) => {
6+
return letter.toUpperCase() === letter
7+
? `${idx !== 0 ? '-' : ''}${letter.toLowerCase()}`
8+
: letter;
9+
})
10+
.join('');
11+
}
12+
}

0 commit comments

Comments
 (0)