mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
showing comments left count
This commit is contained in:
parent
911beea4ad
commit
319e66616c
9 changed files with 101 additions and 115 deletions
|
@ -152,3 +152,13 @@ export const getYoutubeThumb = (url: string) => {
|
|||
|
||||
return match && match[1] ? `https://i.ytimg.com/vi/${match[1]}/hqdefault.jpg` : null;
|
||||
};
|
||||
|
||||
export function plural(n: number, one: string, two: string, five: string) {
|
||||
if (n % 10 === 1 && n % 100 !== 11) {
|
||||
return `${n} ${one}`;
|
||||
} else if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)) {
|
||||
return `${n} ${two}`;
|
||||
} else {
|
||||
return `${n} ${five}`;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue