Export multiple workspaces

This commit is contained in:
Gregory Schier
2024-03-19 13:43:33 -07:00
parent bb561d7b98
commit 351cfae042
10 changed files with 224 additions and 61 deletions

View File

@@ -5,6 +5,16 @@ export function pluralize(word: string, count: number): string {
return `${word}s`;
}
export function count(word: string, count: number): string {
export function count(
word: string,
count: number,
opt: { omitSingle?: boolean; noneWord?: string } = {},
): string {
if (opt.omitSingle && count === 1) {
return word;
}
if (opt.noneWord && count === 0) {
return opt.noneWord;
}
return `${count} ${pluralize(word, count)}`;
}