pluralize

Pluralize and singularize any English word based on a count, with customizable rules.

Library
npm
v8.0.0
2,213stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
75/100Good
Architecture72
Code Quality78
Innovation60
Learning Curve90

pluralize is a zero-dependency JavaScript library that converts words between singular and plural form using an ordered list of regex-based rules layered with explicit irregular-word and uncountable-word overrides (“person” → “people”, “sheep” stays “sheep”). A single pluralize(word, count, inclusive) call handles the common case of formatting a count alongside a word.

Because the rule set is exposed and mutable (addPluralRule, addSingularRule, addIrregularRule, addUncountableRule), consumers can extend or override the built-in English rules for domain-specific vocabulary without forking the library, which is why it’s a common dependency inside larger NLP, ORM, and code-generation tools.

What You Get

  • pluralize(word, count?, inclusive?) to pluralize or singularize based on a count, optionally prefixing the count itself
  • pluralize.plural(word) / pluralize.singular(word) for direct, count-independent conversion
  • pluralize.isPlural(word) / pluralize.isSingular(word) for detection without conversion
  • pluralize.addPluralRule(rule, replacement) / addSingularRule to register custom regex-based conversion rules
  • pluralize.addIrregularRule(single, plural) for exception pairs that don’t follow any regular pattern
  • pluralize.addUncountableRule(word) to mark a word as invariant between singular and plural

Common Use Cases

  • Generating human-readable counts in UI copy (e.g. “1 comment” vs “3 comments”) without hardcoding plural forms
  • Deriving table/model names from singular class names in ORMs and code generators
  • Normalizing user search terms to a canonical singular or plural form before matching
  • Building domain-specific vocabularies (medical, legal, gaming terms) by registering custom irregular/uncountable rules on top of the English defaults

Under The Hood

Architecture The entire library is a single UMD-wrapped file (pluralize.js, ~500 lines) exposing a function object. Internally it keeps four ordered collections — pluralRules, singularRules, uncountables, and irregularPlurals/irregularSingles — and a replaceWord/checkWord pair of higher-order functions that apply them in the correct precedence (irregular and uncountable lookups first, then the most-recently-added regex rule that matches). The bundled English rule set (addPluralRule/addSingularRule/addIrregularRule calls at the bottom of the file) is itself just data fed through the same public API consumers use to extend it, so there’s no special-cased internal path.

Tech Stack Zero runtime dependencies — the entire implementation is vanilla JavaScript wrapped in a UMD shim supporting CommonJS, AMD, and browser globals simultaneously. Tests use Mocha/Chai with Istanbul for coverage, and linting is done via semistandard. No build step is required since the published file is the source file.

Code Quality test.js runs a large table-driven suite of singular/plural word pairs alongside edge cases (case restoration, custom rule registration, uncountables), giving broad regression coverage for a rule-based system where a single regex change can silently break unrelated words. The rule precedence logic (restoreCase, sanitizeRule) is compact but has been stable since the last major version; the project has seen no commits in the last year, so any newly discovered English edge cases won’t be fixed upstream.

API Design The core function overloads pluralization and singularization based on the count argument’s relationship to 1, which keeps call sites terse (pluralize('item', n)) but means the same function name does two conceptually different things depending on the second argument — the explicit .plural()/.singular() methods exist specifically to avoid that ambiguity when the caller already knows the direction. The rule-registration functions accept both string and RegExp rules, letting simple cases stay declarative while power users get full regex control.

Used by 24 apps in this directory

TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

64,914

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
68
Dependency
Built with
JavaScript95%
Updated today
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,936

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
64
Dependency
Built with
JavaScript100%
Updated 6 months ago
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

3,846

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript97%
Updated yesterday
Go
62%
Apache 2.0

Coroot

Analytics · Monitoring

7,877

eBPF-powered observability with AI root cause analysis — zero code changes required, full-stack visibility out of the box.

View details
88
Repo Health
80
Technical
65
Dependency
Built with
Go62%
Vue36%
Updated yesterday
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,761

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
67
Dependency
Built with
TypeScript75%
Updated today
JavaScript
51%
MIT

Ghost

CMS · Blogging

54,795

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
69
Dependency
Built with
JavaScript51%
TypeScript43%
Updated today
TypeScript
48%
AGPL 3.0

Grafana

Monitoring · Analytics

76,300

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
65
Dependency
Built with
TypeScript48%
Go46%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search