Skip to content

Commit

Permalink
Refactor singularisation of words ending in "ies" (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey authored Jun 23, 2016
1 parent 7ec8e1e commit 350b309
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pluralize.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@
['proof', 'proofs'],
['carve', 'carves'],
['valve', 'valves'],
['looey', 'looies'],
['thief', 'thieves'],
['genie', 'genies'],
['groove', 'grooves'],
['pickaxe', 'pickaxes'],
['whiskey', 'whiskies']
Expand Down Expand Up @@ -333,9 +333,9 @@
[/(^analy)(?:sis|ses)$/i, '$1sis'],
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'],
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],
[/([^aeiouy]|qu)ies$/i, '$1y'],
[/(^[pl]|zomb|^(?:neck)?t|[aeo][lt]|cut)ies$/i, '$1ie'],
[/(\b(?:mon|smil))ies$/i, '$1ey'],
[/ies$/i, 'y'],
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],
[/\b(mon|smil)ies$/i, '$1ey'],
[/(m|l)ice$/i, '$1ouse'],
[/(seraph|cherub)im$/i, '$1'],
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|tlas|gas|(?:her|at|gr)o|ris)(?:es)?$/i, '$1'],
Expand Down
17 changes: 15 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ var BASIC_TESTS = [
['dye', 'dyes'],
['move', 'moves'],
['zombie', 'zombies'],
['variety', 'varieties'],
['talkie', 'talkies'],
['walkie-talkie', 'walkie-talkies'],
['groupie', 'groupies'],
['goonie', 'goonies'],
['lassie', 'lassies'],
['genie', 'genies'],
['foodie', 'foodies'],
['faerie', 'faeries'],
['collie', 'collies'],
['obloquy', 'obloquies'],
['looey', 'looies'],
['osprey', 'ospreys'],
['cover', 'covers'],
['tie', 'ties'],
['groove', 'grooves'],
Expand Down Expand Up @@ -332,7 +345,8 @@ var BASIC_TESTS = [
['activity', 'activities'],
['cutie', 'cuties'],
['validation', 'validations'],
['floatie', 'floaties'],
['floaty', 'floaties'],
['nicety', 'niceties'],
['goalie', 'goalies'],
['crawly', 'crawlies'],
['duty', 'duties'],
Expand Down Expand Up @@ -553,7 +567,6 @@ var BASIC_TESTS = [
['strife', 'strifes'],
['pony', 'ponies'],
['phony', 'phonies'],
['goony', 'goonies'],
['felony', 'felonies'],
['colony', 'colonies'],
['symphony', 'symphonies'],
Expand Down

0 comments on commit 350b309

Please sign in to comment.