15 lines
312 B
TypeScript

const specialized = {
"new activity": "new activities"
}
export function plural(count: number, singular: string): string {
if(count === 1 || count === -1) {
return count + " " + singular
}
if(specialized[singular]) {
return count + " " + specialized[singular]
}
return count + " " + singular + "s"
}