mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-26 21:36:23 +00:00
37c6231e79
Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
21 lines
456 B
TypeScript
21 lines
456 B
TypeScript
export function pluralize(count: number, s: string): string {
|
|
if (count === 1) {
|
|
return `1 ${s}`
|
|
} else {
|
|
return `${count} ${s}s`
|
|
}
|
|
}
|
|
|
|
export function capitalize(s: string): string {
|
|
return s.substring(0, 1).toUpperCase() + s.substring(1)
|
|
}
|
|
|
|
export function classNames(
|
|
displayClass?: "mobile-only" | "desktop-only",
|
|
...classes: string[]
|
|
): string {
|
|
if (displayClass) {
|
|
classes.push(displayClass)
|
|
}
|
|
return classes.join(" ")
|
|
}
|