xref: /third_party/node/deps/undici/src/lib/mock/pluralizer.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/deps/undici/src/lib/mock/
11cb0ef41Sopenharmony_ci'use strict'
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst singulars = {
41cb0ef41Sopenharmony_ci  pronoun: 'it',
51cb0ef41Sopenharmony_ci  is: 'is',
61cb0ef41Sopenharmony_ci  was: 'was',
71cb0ef41Sopenharmony_ci  this: 'this'
81cb0ef41Sopenharmony_ci}
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst plurals = {
111cb0ef41Sopenharmony_ci  pronoun: 'they',
121cb0ef41Sopenharmony_ci  is: 'are',
131cb0ef41Sopenharmony_ci  was: 'were',
141cb0ef41Sopenharmony_ci  this: 'these'
151cb0ef41Sopenharmony_ci}
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cimodule.exports = class Pluralizer {
181cb0ef41Sopenharmony_ci  constructor (singular, plural) {
191cb0ef41Sopenharmony_ci    this.singular = singular
201cb0ef41Sopenharmony_ci    this.plural = plural
211cb0ef41Sopenharmony_ci  }
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci  pluralize (count) {
241cb0ef41Sopenharmony_ci    const one = count === 1
251cb0ef41Sopenharmony_ci    const keys = one ? singulars : plurals
261cb0ef41Sopenharmony_ci    const noun = one ? this.singular : this.plural
271cb0ef41Sopenharmony_ci    return { ...keys, count, noun }
281cb0ef41Sopenharmony_ci  }
291cb0ef41Sopenharmony_ci}
30

Indexes created Thu Nov 07 10:32:03 CST 2024