New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@memberjunction/global

Package Overview
Dependencies
Maintainers
0
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@memberjunction/global - npm Package Compare versions

Comparing version 2.21.0 to 2.22.0

119

dist/util.js

@@ -222,2 +222,65 @@ "use strict";

exports.stripWhitespace = stripWhitespace;
const __irregularPlurals = {
child: 'children',
person: 'people',
mouse: 'mice',
foot: 'feet',
tooth: 'teeth',
goose: 'geese',
man: 'men',
woman: 'women',
ox: 'oxen',
cactus: 'cacti',
focus: 'foci',
fungus: 'fungi',
nucleus: 'nuclei',
syllabus: 'syllabi',
analysis: 'analyses',
diagnosis: 'diagnoses',
thesis: 'theses',
crisis: 'crises',
phenomenon: 'phenomena',
criterion: 'criteria',
datum: 'data',
appendix: 'appendices',
index: 'indices',
matrix: 'matrices',
vertex: 'vertices',
vortex: 'vortices',
radius: 'radii',
corpus: 'corpora',
genus: 'genera',
locus: 'loci',
alga: 'algae',
antenna: 'antennae',
formula: 'formulae',
nebula: 'nebulae',
vertebra: 'vertebrae',
memorandum: 'memoranda',
medium: 'media',
bacterium: 'bacteria',
curriculum: 'curricula',
referendum: 'referenda',
stimulus: 'stimuli',
automaton: 'automata',
beau: 'beaux',
bureau: 'bureaux',
tableau: 'tableaux',
cherub: 'cherubim',
seraph: 'seraphim',
elf: 'elves',
calf: 'calves',
half: 'halves',
knife: 'knives',
leaf: 'leaves',
life: 'lives',
loaf: 'loaves',
scarf: 'scarves',
self: 'selves',
sheaf: 'sheaves',
shelf: 'shelves',
thief: 'thieves',
wife: 'wives',
wolf: 'wolves',
};
/**

@@ -236,30 +299,31 @@ * Retrieves the plural form of a word if it is an irregular plural.

function getIrregularPlural(singularName) {
const irregularPlurals = {
child: 'children',
person: 'people',
mouse: 'mice',
foot: 'feet',
tooth: 'teeth',
goose: 'geese',
man: 'men',
woman: 'women',
ox: 'oxen',
cactus: 'cacti',
focus: 'foci',
fungus: 'fungi',
nucleus: 'nuclei',
syllabus: 'syllabi',
analysis: 'analyses',
diagnosis: 'diagnoses',
thesis: 'theses',
crisis: 'crises',
phenomenon: 'phenomena',
criterion: 'criteria',
datum: 'data',
};
const lowerSingular = singularName.toLowerCase();
return irregularPlurals[lowerSingular] || null;
return __irregularPlurals[singularName.toLowerCase()] || null;
}
exports.getIrregularPlural = getIrregularPlural;
/**
* Checks if a word is already plural by reversing common pluralization rules.
*
* @param word - The word to check.
* @returns The singular form if detected, otherwise null.
*/
function detectSingularForm(word) {
const lowerWord = word.toLowerCase();
// Reverse lookup from __irregularPlurals values to keys
const singularFromIrregular = Object.entries(__irregularPlurals).find(([singular, plural]) => plural === lowerWord);
if (singularFromIrregular) {
return singularFromIrregular[0]; // Return the singular form
}
// Detect regular plural forms
if (lowerWord.endsWith('ies')) {
return lowerWord.slice(0, -3) + 'y'; // "parties" -> "party"
}
if (/(s|ch|sh|x|z)es$/.test(lowerWord)) { // checks to see if the word ends with 'es'
return lowerWord.slice(0, -2); // "boxes" -> "box"
}
if (lowerWord.endsWith('s') && !lowerWord.endsWith('ss')) {
return lowerWord.slice(0, -1); // "dogs" -> "dog"
}
return null;
}
/**
* Converts a singular word to its plural form, handling common pluralization rules

@@ -280,2 +344,7 @@ * and irregular plurals.

function generatePluralName(singularName) {
// Check if it's already plural
const detectedSingular = detectSingularForm(singularName);
if (!detectedSingular) {
return singularName; // If no singular form is detected, assume it's already plural
}
// Check for irregular plurals

@@ -282,0 +351,0 @@ const irregularPlural = getIrregularPlural(singularName);

{
"name": "@memberjunction/global",
"version": "2.21.0",
"version": "2.22.0",
"description": "MemberJunction: Global Object - Needed for ALL other MJ components",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

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