Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

pluralize

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Issues
File Explorer

Advanced tools

pluralize

Pluralize and singularize any word

    8.0.0latest

Version published
Maintainers
1
Weekly downloads
5,295,818
decreased by-19.5%

Weekly downloads

Changelog

Source

A Few Word Changes

Changed

  • Uncountable
    • Transportation
    • Mud
    • Only
    • Words ending in "ware"
    • Analytics
    • Aircraft
    • Pokemon
    • Personnel
  • Plural/Singular
    • Christmas
    • Words ending in "[ml]ice"
    • Passerby
    • Enterprise
  • Plural changes
    • "Octopi" to "octopuses"
    • "Whiskies" to "whiskeys" (only when pluralized with "whiskey", opposed to "whisky")
  • Singular
    • Words ending with "bases"
    • Words ending with "rises"
  • Numbers and symbols will be suffixed with lowercase additions

Readme

Source

Pluralize

NPM version NPM downloads Build status Test coverage File Size CDNJS

Pluralize and singularize any word.

Installation

npm install pluralize --save yarn add pluralize bower install pluralize --save

Node

var pluralize = require('pluralize')

AMD

define(function (require, exports, module) { var pluralize = require('pluralize') })

<script> tag

<script src="pluralize.js"></script>

Why?

This module uses a pre-defined list of rules, applied in order, to singularize or pluralize a given word. There are many cases where this is useful, such as any automation based on user input. For applications where the word(s) are known ahead of time, you can use a simple ternary (or function) which would be a much lighter alternative.

Usage

  • word: string The word to pluralize
  • count: number How many of the word exist
  • inclusive: boolean Whether to prefix with the number (e.g. 3 ducks)

Examples:

pluralize('test') //=> "tests" pluralize('test', 0) //=> "tests" pluralize('test', 1) //=> "test" pluralize('test', 5) //=> "tests" pluralize('test', 1, true) //=> "1 test" pluralize('test', 5, true) //=> "5 tests" pluralize('蘋果', 2, true) //=> "2 蘋果" // Example of new plural rule: pluralize.plural('regex') //=> "regexes" pluralize.addPluralRule(/gex$/i, 'gexii') pluralize.plural('regex') //=> "regexii" // Example of new singular rule: pluralize.singular('singles') //=> "single" pluralize.addSingularRule(/singles$/i, 'singular') pluralize.singular('singles') //=> "singular" // Example of new irregular rule, e.g. "I" -> "we": pluralize.plural('irregular') //=> "irregulars" pluralize.addIrregularRule('irregular', 'regular') pluralize.plural('irregular') //=> "regular" // Example of uncountable rule (rules without singular/plural in context): pluralize.plural('paper') //=> "papers" pluralize.addUncountableRule('paper') pluralize.plural('paper') //=> "paper" // Example of asking whether a word looks singular or plural: pluralize.isPlural('test') //=> false pluralize.isSingular('test') //=> true

License

MIT

Keywords

FAQs

What is pluralize?

Pluralize and singularize any word

Is pluralize popular?

The npm package pluralize receives a total of 4,462,706 weekly downloads. As such, pluralize popularity was classified as popular.

Is pluralize well maintained?

We found that pluralize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 25 May 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc