Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

plur

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plur - npm Package Compare versions

Comparing version 2.1.2 to 3.0.0

16

index.js
'use strict';
var irregularPlurals = require('irregular-plurals');
const irregularPlurals = require('irregular-plurals');
module.exports = function (str, plural, count) {
module.exports = (word, plural, count) => {
if (typeof plural === 'number') {

@@ -9,8 +9,8 @@ count = plural;

if (str in irregularPlurals) {
plural = irregularPlurals[str];
if (irregularPlurals.has(word)) {
plural = irregularPlurals.get(word);
} else if (typeof plural !== 'string') {
plural = (str.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's')
.replace(/i?e?s$/i, function (m) {
var isTailLowerCase = str.slice(-1) === str.slice(-1).toLowerCase();
plural = (word.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's')
.replace(/i?e?s$/i, m => {
const isTailLowerCase = word.slice(-1) === word.slice(-1).toLowerCase();
return isTailLowerCase ? m.toLowerCase() : m.toUpperCase();

@@ -20,3 +20,3 @@ });

return count === 1 ? str : plural;
return Math.abs(count) === 1 ? word : plural;
};
{
"name": "plur",
"version": "2.1.2",
"description": "Pluralize a word",
"license": "MIT",
"repository": "sindresorhus/plur",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"plur",
"plural",
"plurals",
"pluralize",
"singular",
"count",
"word",
"string",
"str",
"irregular",
"noun",
"nouns"
],
"dependencies": {
"irregular-plurals": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "plur",
"version": "3.0.0",
"description": "Pluralize a word",
"license": "MIT",
"repository": "sindresorhus/plur",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"plur",
"plural",
"plurals",
"pluralize",
"singular",
"count",
"word",
"string",
"str",
"irregular",
"noun",
"nouns"
],
"dependencies": {
"irregular-plurals": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

@@ -9,3 +9,3 @@ # plur [![Build Status](https://travis-ci.org/sindresorhus/plur.svg?branch=master)](https://travis-ci.org/sindresorhus/plur)

```
$ npm install --save plur
$ npm install plur
```

@@ -45,3 +45,3 @@

Type: `string`
Type: `string`<br>
Default:

@@ -69,2 +69,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc