Comparing version 4.0.0 to 5.0.0
/** | ||
Pluralize a word. | ||
@param word - Word to pluralize. | ||
@param plural - Pluralized word. | ||
@param word - The word to pluralize. | ||
@param plural - Explicitly provide the pluralized word. | ||
The plural suffix will match the case of the last letter in the word. | ||
@@ -11,3 +11,3 @@ This option is only for extreme edge-cases. You probably won't need it. | ||
- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json). | ||
- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/main/irregular-plurals.json). | ||
- Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es* (eg. *foxes*). | ||
@@ -17,7 +17,7 @@ - Words ending in *y* that are preceded by a consonant will be pluralized by replacing *y* with *-ies* (eg. *puppies*). | ||
@param count - Count to determine whether to use singular or plural. | ||
@param count - The count to determine whether to use singular or plural. | ||
@example | ||
``` | ||
import plur = require('plur'); | ||
import plur from 'plur'; | ||
@@ -37,5 +37,3 @@ plur('unicorn', 4); | ||
*/ | ||
declare function plur(word: string, count: number): string; | ||
declare function plur(word: string, plural: string, count: number): string; | ||
export = plur; | ||
export default function plur(word: string, count: number): string; | ||
export default function plur(word: string, plural: string, count: number): string; |
@@ -1,5 +0,4 @@ | ||
'use strict'; | ||
const irregularPlurals = require('irregular-plurals'); | ||
import irregularPlurals from 'irregular-plurals'; | ||
module.exports = (word, plural, count) => { | ||
export default function plur(word, plural, count) { | ||
if (typeof plural === 'number') { | ||
@@ -31,2 +30,2 @@ count = plural; | ||
return Math.abs(count) === 1 ? word : plural; | ||
}; | ||
} |
{ | ||
"name": "plur", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Pluralize a word", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -37,9 +39,9 @@ "scripts": { | ||
"dependencies": { | ||
"irregular-plurals": "^3.2.0" | ||
"irregular-plurals": "^3.3.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.11.0", | ||
"xo": "^0.26.1" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.18.0", | ||
"xo": "^0.46.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# plur [![Build Status](https://travis-ci.org/sindresorhus/plur.svg?branch=master)](https://travis-ci.org/sindresorhus/plur) | ||
# plur | ||
@@ -7,5 +7,5 @@ > Pluralize a word | ||
```sh | ||
npm install plur | ||
``` | ||
$ npm install plur | ||
``` | ||
@@ -15,3 +15,3 @@ ## Usage | ||
```js | ||
const plur = require('plur'); | ||
import plur from 'plur'; | ||
@@ -39,3 +39,3 @@ plur('unicorn', 4); | ||
Word to pluralize. | ||
The word to pluralize. | ||
@@ -47,3 +47,3 @@ #### plural | ||
- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json). | ||
- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/main/irregular-plurals.json). | ||
- Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es* (eg. *foxes*). | ||
@@ -53,3 +53,3 @@ - Words ending in *y* that are preceded by a consonant will be pluralized by replacing *y* with *-ies* (eg. *puppies*). | ||
Pluralized word. | ||
Explicitly provide the pluralized word. | ||
@@ -64,2 +64,2 @@ The plural suffix will match the case of the last letter in the word. | ||
Count to determine whether to use singular or plural. | ||
The count to determine whether to use singular or plural. |
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
Yes
4994
52
Updatedirregular-plurals@^3.3.0