mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-23 15:26:31 +00:00
15 lines
365 B
TypeScript
15 lines
365 B
TypeScript
|
export function titlecase(str: string) {
|
||
|
return str
|
||
|
.split(" ")
|
||
|
.map(word => word[0].toUpperCase() + word.slice(1))
|
||
|
.join(" ");
|
||
|
}
|
||
|
|
||
|
export function capitalize(str: string) {
|
||
|
return str[0].toUpperCase() + str.slice(1);
|
||
|
}
|
||
|
|
||
|
export function truncate(str: string, length: number) {
|
||
|
return str.length > length ? str.substring(0, length) + "..." : str;
|
||
|
}
|