You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pluralize gives a non-word or leaves the word unchanged for several common nouns. This is separate from the singularize reports in #123 and #128, and from the -s nouns in PR #127.
// npm i inflection@3.0.2, then nodeconst{ pluralize }=require('inflection');// -fe words that do not take -vesconsole.log(pluralize('safe'));// 'saves' (expected 'safes')console.log(pluralize('cafe'));// 'caves' (expected 'cafes')console.log(pluralize('carafe'));// 'caraves' (expected 'carafes')// -z / -zzconsole.log(pluralize('buzz'));// 'buzzs' (expected 'buzzes')console.log(pluralize('fez'));// 'fezs' (expected 'fezzes')// -s nouns returned unchangedconsole.log(pluralize('census'));// 'census' (expected 'censuses')console.log(pluralize('gas'));// 'gas' (expected 'gases')console.log(pluralize('lens'));// 'lens' (expected 'lenses')// -man compounds (man -> men works on its own)console.log(pluralize('policeman'));// 'policemans' (expected 'policemen')console.log(pluralize('fireman'));// 'firemans' (expected 'firemen')// hard -chconsole.log(pluralize('stomach'));// 'stomaches' (expected 'stomachs')console.log(pluralize('epoch'));// 'epoches' (expected 'epochs')console.log(pluralize('monarch'));// 'monarches' (expected 'monarchs')// f -> vesconsole.log(pluralize('leaf'));// 'leafs' (expected 'leaves')console.log(pluralize('thief'));// 'thiefs' (expected 'thieves')console.log(pluralize('loaf'));// 'loafs' (expected 'loaves')
Actual: the values in the comments (saves, caves, caraves, buzzs, fezs, census, gas, lens, policemans, firemans, stomaches, epoches, monarches, leafs, thiefs, loafs).
Expected: the standard English plurals (safes, cafes, carafes, buzzes, fezzes, censuses, gases, lenses, policemen, firemen, stomachs, epochs, monarchs, leaves, thieves, loaves).
In src/inflection.ts, regex.singular.ffe (/(?:([^f])fe|([lr])f)$/gi) turns any non-ffe word ending in fe into ves and only converts -f after l or r, regex.singular.man (/^(m|wom)an$/gi) is start-anchored so -man compounds miss it, regex.singular.x (/(x|ch|ss|sh)$/gi) lacks z/zz and treats every -ch as -ches, and regex.singular.s (/s$/gi -> 's') leaves singular -s nouns unchanged unless listed earlier.
Version: inflection@3.0.2, also on master 0c37535.
Activity