mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-30 03:45:19 +00:00
30 lines
495 B
JavaScript
30 lines
495 B
JavaScript
|
'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 }
|
||
|
}
|
||
|
}
|