Browse Source

Removes suffix from pluralize

main
Eric Amodio 3 years ago
parent
commit
2cbe7f2762
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/commands/git/branch.ts
  2. +2
    -2
      src/system/string.ts

+ 1
- 1
src/commands/git/branch.ts View File

@ -349,7 +349,7 @@ export class BranchGitCommand extends QuickCommand {
context.title = getTitle( context.title = getTitle(
Strings.pluralize('Branch', state.references.length, { Strings.pluralize('Branch', state.references.length, {
number: '', number: '',
suffix: 'es',
plural: 'Branches',
}).trim(), }).trim(),
state.subcommand, state.subcommand,
); );

+ 2
- 2
src/system/string.ts View File

@ -349,13 +349,13 @@ export function padRightOrTruncate(s: string, max: number, padding?: string, wid
export function pluralize( export function pluralize(
s: string, s: string,
count: number, count: number,
options?: { infix?: string; number?: string; plural?: string; suffix?: string; zero?: string },
options?: { infix?: string; number?: string; plural?: string; zero?: string },
) { ) {
if (options == null) return `${count} ${s}${count === 1 ? emptyStr : 's'}`; if (options == null) return `${count} ${s}${count === 1 ? emptyStr : 's'}`;
return `${ return `${
count === 0 ? (options.zero != null ? options.zero : count) : options.number != null ? options.number : count count === 0 ? (options.zero != null ? options.zero : count) : options.number != null ? options.number : count
}${options.infix ?? ' '}${count === 1 ? s : options.plural ?? `${s}${options.suffix ?? 's'}`}`;
}${options.infix ?? ' '}${count === 1 ? s : options.plural ?? `${s}s`}`;
} }
// Removes \ / : * ? " < > | and C0 and C1 control codes // Removes \ / : * ? " < > | and C0 and C1 control codes

Loading…
Cancel
Save