Socket
Socket
Sign inDemoInstall

pluralizers

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pluralizers

Repository of localized pluralization functions


Version published
Weekly downloads
5.8K
decreased by-18.94%
Maintainers
1
Install size
5.27 kB
Created
Weekly downloads
 

Readme

Source

pluralizers

Repository of localized pluralization functions. Usable in Node.js or in the browser.

Installation

Install via npm:

% npm install pluralizers

Usage

The default locale is en (English). Thus, a require('pluralizers') implicitly does require('pluralizers/en').

var sprintf   = require('sprintf').sprintf;
var pluralize = require('pluralizers');

var entry = { zero: 'no items', one: 'one item', other: '%(count)s items' };

pluralize(entry, 0)   // => 'no items'
pluralize(entry, 1)   // => 'one item'
pluralize(entry, 2)   // => '%(count)s items'

sprintf(pluralize(entry, 42), { count: 42 })   // => '42 items'

You can fetch a different localization by requiring a specific locale:

var pluralize = require('pluralizers/de');

English (en), Dutch (nl), German (de), Brazilian Portuguese (pt-br), Russian (ru) and Spanish (es) are currently the only supported locales. Pull requests welcome.

Contributing

Here's a quick guide:

  1. Fork the repo and make install.

  2. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: make test.

  3. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or are fixing a bug, we need a test!

  4. Make the test pass.

  5. Push to your fork and submit a pull request.

Licence

Released under The MIT License.

Keywords

FAQs

Last updated on 16 Nov 2017

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