Comparing version 2.0.0 to 2.1.0
'use strict'; | ||
var irregularPlurals = require('irregular-plurals'); | ||
module.exports = function (str, plural, count) { | ||
if (typeof plural === 'number') { | ||
if (str in irregularPlurals) { | ||
plural = irregularPlurals[str]; | ||
} else if (typeof plural === 'number') { | ||
count = plural; | ||
@@ -5,0 +9,0 @@ |
{ | ||
"name": "plur", | ||
"version": "2.0.0", | ||
"description": "Naively pluralize a word", | ||
"version": "2.1.0", | ||
"description": "Pluralize a word", | ||
"license": "MIT", | ||
@@ -16,3 +16,3 @@ "repository": "sindresorhus/plur", | ||
"scripts": { | ||
"test": "node test.js" | ||
"test": "xo && ava" | ||
}, | ||
@@ -32,8 +32,13 @@ "files": [ | ||
"str", | ||
"naive", | ||
"simple" | ||
"irregular", | ||
"noun", | ||
"nouns" | ||
], | ||
"dependencies": { | ||
"irregular-plurals": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4" | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
# plur [![Build Status](https://travis-ci.org/sindresorhus/plur.svg?branch=master)](https://travis-ci.org/sindresorhus/plur) | ||
> Naively pluralize a word | ||
> Pluralize a word | ||
@@ -16,3 +16,3 @@ | ||
```js | ||
var plur = require('plur'); | ||
const plur = require('plur'); | ||
@@ -22,9 +22,12 @@ plur('unicorn', 4); | ||
plur('hero', 'heroes', 4); | ||
//=> 'heroes' | ||
plur('puppy', 2); | ||
//=> 'puppies' | ||
plur('box', 2); | ||
//=> 'boxes' | ||
plur('cactus', 2); | ||
//=> 'cacti' | ||
``` | ||
Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es*, like | ||
*foxes*. Words ending in *y* will be pluralized by replacing *y* with *-ies* as | ||
in *puppies*. The plural suffix will match the case of the last letter in the word. | ||
@@ -44,6 +47,12 @@ ## API | ||
Type: `string` | ||
Default: `word` + `s` | ||
Default: Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es*, like | ||
*foxes*. Words ending in *y* will be pluralized by replacing *y* with *-ies* as | ||
in *puppies*. Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json). | ||
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 | ||
@@ -50,0 +59,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3456
15
65
1
2
+ Addedirregular-plurals@^1.0.0
+ Addedirregular-plurals@1.4.0(transitive)