
Security News
gem.coop Tests Dependency Cooldowns as Package Ecosystems Move to Slow Down Attacks
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.
Simple, versatile string pluralization
npm i simplur
Use CommonJS or ESM to import
const simplur = require('simplur');
import simplur from 'simplur';
simplur is applied as an ES6 template tag. Tokens of the form "[singular|plural]" are replaced based on the values injected before (or after) them.
The singular/plural string is chosen based on the value injected to the left of each token or, if no left-value is provided, the first value injected to the right of the token.
simplur`I have ${1} kitt[en|ies]`; // ⇨ 'I have 1 kitten'
simplur`I have ${3} kitt[en|ies]`; // ⇨ 'I have 3 kitties'
simplur`There [is|are] ${1} m[an|en]`; // ⇨ 'There is 1 man'
simplur`There [is|are] ${5} m[an|en]`; // ⇨ 'There are 5 men'
Multiple tokens and quantities are allowed. These follow the same rules as above.
simplur`There [is|are] ${1} fox[|es] and ${4} octop[us|i]`; // ⇨ 'There is 1 fox and 4 octopi'
simplur`There [is|are] ${4} fox[|es] and ${1} octop[us|i]`; // ⇨ 'There are 4 foxes and 1 octopus'
Custom quantities may be specified by providing an Array value of the form [quantity, formatFunction].
function formatQuantity(v) {
return v < 1 ? 'no' :
v == 1 ? 'one annoying' :
v < 3 ? 'a few' :
null;
}
simplur`She has ${[0, formatQuantity]} br[other|ethren]`; // ⇨ 'She has no brethren'
simplur`She has ${[1, formatQuantity]} br[other|ethren]`; // ⇨ 'She has one annoying brother'
simplur`She has ${[2, formatQuantity]} br[other|ethren]`; // ⇨ 'She has a few brethren'
simplur`She has ${[3, formatQuantity]} br[other|ethren]`; // ⇨ 'She has 3 brethren'
FAQs
Simple, versatile string pluralization
The npm package simplur receives a total of 3,340 weekly downloads. As such, simplur popularity was classified as popular.
We found that simplur demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.

Security News
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.