mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1export function pluralize(n: number, base: string, plural?: string): string {
2 if (n === 1) {
3 return base
4 }
5 if (plural) {
6 return plural
7 }
8 return base + 's'
9}
10
11export function enforceLen(str: string, len: number, ellipsis = false): string {
12 str = str || ''
13 if (str.length > len) {
14 return str.slice(0, len) + (ellipsis ? '...' : '')
15 }
16 return str
17}