Urara-Blog/node_modules/.pnpm-store/v3/files/dd/2614150c9bee87b5a0a677e978003ed785f76172bc0a3a0dc505a45ab741b89f5aba6c7895ee51aa253bda000e514c7ea0248ad6f51fefb3e72715fa30a0df
2022-08-14 01:14:53 +08:00

29 lines
495 B
Text

'use strict'
const singulars = {
pronoun: 'it',
is: 'is',
was: 'was',
this: 'this'
}
const plurals = {
pronoun: 'they',
is: 'are',
was: 'were',
this: 'these'
}
module.exports = class Pluralizer {
constructor (singular, plural) {
this.singular = singular
this.plural = plural
}
pluralize (count) {
const one = count === 1
const keys = one ? singulars : plurals
const noun = one ? this.singular : this.plural
return { ...keys, count, noun }
}
}