Socket
Socket
Sign inDemoInstall

plur

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    plur

Pluralize a word


Version published
Weekly downloads
1.2M
decreased by-19.05%
Maintainers
1
Install size
13.2 kB
Created
Weekly downloads
 

Readme

Source

plur

Pluralize a word

Install

npm install plur

Usage

import plur from 'plur';

plur('rainbow');
//=> 'rainbows'

plur('unicorn', 4);
//=> 'unicorns'

plur('puppy', 2);
//=> 'puppies'

plur('box', 2);
//=> 'boxes'

plur('cactus', 2);
//=> 'cacti'

API

plur(word, plural?, count?)

word

Type: string

The word to pluralize.

plural

Type: string
Default:

  • Irregular nouns will use this list.
  • Words ending in s, x, z, ch, sh will be pluralized with -es (eg. foxes).
  • Words ending in y that are preceded by a consonant will be pluralized by replacing y with -ies (eg. puppies).
  • All other words will have "s" added to the end (eg. days).

Explicitly provide the pluralized word.

The plural suffix will match the case of the last letter in the word.

This option is only for extreme edge-cases. You probably won't need it.

count

Type: number

The count to determine whether to use singular or plural. If omitted, defaults to plural.

Keywords

FAQs

Last updated on 19 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc