@fibery/pluralize 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,835 +0,0 @@
1
- /* eslint-disable max-lines */
2
-
3
- import {pluralize} from "./pluralize";
4
-
5
- /**
6
- * Standard singular/plural matches.
7
- *
8
- * @type {Array}
9
- */
10
- const BASIC_TESTS = [
11
- // Uncountables.
12
- ["firmware", "firmware"],
13
- ["fish", "fish"],
14
- ["media", "media"],
15
- ["moose", "moose"],
16
- ["police", "police"],
17
- ["sheep", "sheep"],
18
- ["series", "series"],
19
- ["agenda", "agenda"],
20
- ["news", "news"],
21
- ["reindeer", "reindeer"],
22
- ["starfish", "starfish"],
23
- ["smallpox", "smallpox"],
24
- ["tennis", "tennis"],
25
- ["chickenpox", "chickenpox"],
26
- ["shambles", "shambles"],
27
- ["garbage", "garbage"],
28
- ["you", "you"],
29
- ["wildlife", "wildlife"],
30
- ["Staff", "Staff"],
31
- ["STAFF", "STAFF"],
32
- ["turquois", "turquois"],
33
- ["carnivorous", "carnivorous"],
34
- ["only", "only"],
35
- ["aircraft", "aircraft"],
36
- // Latin.
37
- ["veniam", "veniam"],
38
- // Pluralization.
39
- ["this", "these"],
40
- ["that", "those"],
41
- ["is", "are"],
42
- ["man", "men"],
43
- ["superman", "supermen"],
44
- ["ox", "oxen"],
45
- ["bus", "buses"],
46
- ["airbus", "airbuses"],
47
- ["railbus", "railbuses"],
48
- ["wife", "wives"],
49
- ["guest", "guests"],
50
- ["thing", "things"],
51
- ["mess", "messes"],
52
- ["guess", "guesses"],
53
- ["person", "people"],
54
- ["meteor", "meteors"],
55
- ["chateau", "chateaus"],
56
- ["lap", "laps"],
57
- ["cough", "coughs"],
58
- ["death", "deaths"],
59
- ["coach", "coaches"],
60
- ["boy", "boys"],
61
- ["toy", "toys"],
62
- ["guy", "guys"],
63
- ["girl", "girls"],
64
- ["chair", "chairs"],
65
- ["toe", "toes"],
66
- ["tiptoe", "tiptoes"],
67
- ["tomato", "tomatoes"],
68
- ["potato", "potatoes"],
69
- ["tornado", "tornadoes"],
70
- ["torpedo", "torpedoes"],
71
- ["hero", "heroes"],
72
- ["superhero", "superheroes"],
73
- ["volcano", "volcanoes"],
74
- ["canto", "cantos"],
75
- ["hetero", "heteros"],
76
- ["photo", "photos"],
77
- ["portico", "porticos"],
78
- ["quarto", "quartos"],
79
- ["kimono", "kimonos"],
80
- ["albino", "albinos"],
81
- ["cherry", "cherries"],
82
- ["piano", "pianos"],
83
- ["pro", "pros"],
84
- ["combo", "combos"],
85
- ["turbo", "turbos"],
86
- ["bar", "bars"],
87
- ["crowbar", "crowbars"],
88
- ["van", "vans"],
89
- ["tobacco", "tobaccos"],
90
- ["afficionado", "afficionados"],
91
- ["monkey", "monkeys"],
92
- ["neutrino", "neutrinos"],
93
- ["rhino", "rhinos"],
94
- ["steno", "stenos"],
95
- ["latino", "latinos"],
96
- ["casino", "casinos"],
97
- ["avocado", "avocados"],
98
- ["commando", "commandos"],
99
- ["tuxedo", "tuxedos"],
100
- ["speedo", "speedos"],
101
- ["dingo", "dingoes"],
102
- ["echo", "echoes"],
103
- ["nacho", "nachos"],
104
- ["motto", "mottos"],
105
- ["psycho", "psychos"],
106
- ["poncho", "ponchos"],
107
- ["pass", "passes"],
108
- ["ghetto", "ghettos"],
109
- ["mango", "mangos"],
110
- ["lady", "ladies"],
111
- ["bath", "baths"],
112
- ["professional", "professionals"],
113
- ["dwarf", "dwarves"], // Proper spelling is "dwarfs".
114
- ["encyclopedia", "encyclopedias"],
115
- ["louse", "lice"],
116
- ["roof", "roofs"],
117
- ["woman", "women"],
118
- ["formula", "formulas"],
119
- ["polyhedron", "polyhedra"],
120
- ["index", "indices"], // Maybe "indexes".
121
- ["matrix", "matrices"],
122
- ["vertex", "vertices"],
123
- ["axe", "axes"], // Could also be plural of "ax".
124
- ["pickaxe", "pickaxes"],
125
- ["crisis", "crises"],
126
- ["criterion", "criteria"],
127
- ["phenomenon", "phenomena"],
128
- ["addendum", "addenda"],
129
- ["datum", "data"],
130
- ["forum", "forums"],
131
- ["millennium", "millennia"],
132
- ["alumnus", "alumni"],
133
- ["medium", "mediums"],
134
- ["census", "censuses"],
135
- ["genus", "genera"],
136
- ["dogma", "dogmata"],
137
- ["life", "lives"],
138
- ["hive", "hives"],
139
- ["kiss", "kisses"],
140
- ["dish", "dishes"],
141
- ["human", "humans"],
142
- ["knife", "knives"],
143
- ["phase", "phases"],
144
- ["judge", "judges"],
145
- ["class", "classes"],
146
- ["witch", "witches"],
147
- ["church", "churches"],
148
- ["massage", "massages"],
149
- ["prospectus", "prospectuses"],
150
- ["syllabus", "syllabi"],
151
- ["viscus", "viscera"],
152
- ["cactus", "cacti"],
153
- ["hippopotamus", "hippopotamuses"],
154
- ["octopus", "octopuses"],
155
- ["platypus", "platypuses"],
156
- ["kangaroo", "kangaroos"],
157
- ["atlas", "atlases"],
158
- ["stigma", "stigmata"],
159
- ["schema", "schemata"],
160
- ["phenomenon", "phenomena"],
161
- ["diagnosis", "diagnoses"],
162
- ["mongoose", "mongooses"],
163
- ["mouse", "mice"],
164
- ["liturgist", "liturgists"],
165
- ["box", "boxes"],
166
- ["gas", "gases"],
167
- ["self", "selves"],
168
- ["chief", "chiefs"],
169
- ["quiz", "quizzes"],
170
- ["child", "children"],
171
- ["shelf", "shelves"],
172
- ["fizz", "fizzes"],
173
- ["tooth", "teeth"],
174
- ["thief", "thieves"],
175
- ["day", "days"],
176
- ["loaf", "loaves"],
177
- ["fix", "fixes"],
178
- ["spy", "spies"],
179
- ["vertebra", "vertebrae"],
180
- ["clock", "clocks"],
181
- ["lap", "laps"],
182
- ["cuff", "cuffs"],
183
- ["leaf", "leaves"],
184
- ["calf", "calves"],
185
- ["moth", "moths"],
186
- ["mouth", "mouths"],
187
- ["house", "houses"],
188
- ["proof", "proofs"],
189
- ["hoof", "hooves"],
190
- ["elf", "elves"],
191
- ["turf", "turfs"],
192
- ["craft", "crafts"],
193
- ["die", "dice"],
194
- ["penny", "pennies"],
195
- ["campus", "campuses"],
196
- ["virus", "viri"],
197
- ["iris", "irises"],
198
- ["bureau", "bureaus"],
199
- ["kiwi", "kiwis"],
200
- ["wiki", "wikis"],
201
- ["igloo", "igloos"],
202
- ["ninja", "ninjas"],
203
- ["pizza", "pizzas"],
204
- ["kayak", "kayaks"],
205
- ["canoe", "canoes"],
206
- ["tiding", "tidings"],
207
- ["pea", "peas"],
208
- ["drive", "drives"],
209
- ["nose", "noses"],
210
- ["movie", "movies"],
211
- ["status", "statuses"],
212
- ["alias", "aliases"],
213
- ["memorandum", "memorandums"],
214
- ["language", "languages"],
215
- ["plural", "plurals"],
216
- ["word", "words"],
217
- ["multiple", "multiples"],
218
- ["reward", "rewards"],
219
- ["sandwich", "sandwiches"],
220
- ["subway", "subways"],
221
- ["direction", "directions"],
222
- ["land", "lands"],
223
- ["row", "rows"],
224
- ["grow", "grows"],
225
- ["flow", "flows"],
226
- ["rose", "roses"],
227
- ["raise", "raises"],
228
- ["friend", "friends"],
229
- ["follower", "followers"],
230
- ["male", "males"],
231
- ["nail", "nails"],
232
- ["sex", "sexes"],
233
- ["tape", "tapes"],
234
- ["ruler", "rulers"],
235
- ["king", "kings"],
236
- ["queen", "queens"],
237
- ["zero", "zeros"],
238
- ["quest", "quests"],
239
- ["goose", "geese"],
240
- ["foot", "feet"],
241
- ["ex", "exes"],
242
- ["reflex", "reflexes"],
243
- ["heat", "heats"],
244
- ["train", "trains"],
245
- ["test", "tests"],
246
- ["pie", "pies"],
247
- ["fly", "flies"],
248
- ["eye", "eyes"],
249
- ["lie", "lies"],
250
- ["node", "nodes"],
251
- ["trade", "trades"],
252
- ["chinese", "chinese"],
253
- ["please", "pleases"],
254
- ["japanese", "japanese"],
255
- ["regex", "regexes"],
256
- ["license", "licenses"],
257
- ["zebra", "zebras"],
258
- ["general", "generals"],
259
- ["corps", "corps"],
260
- ["pliers", "pliers"],
261
- ["flyer", "flyers"],
262
- ["scissors", "scissors"],
263
- ["fireman", "firemen"],
264
- ["chirp", "chirps"],
265
- ["harp", "harps"],
266
- ["corpse", "corpses"],
267
- ["dye", "dyes"],
268
- ["move", "moves"],
269
- ["zombie", "zombies"],
270
- ["variety", "varieties"],
271
- ["talkie", "talkies"],
272
- ["walkie-talkie", "walkie-talkies"],
273
- ["groupie", "groupies"],
274
- ["goonie", "goonies"],
275
- ["lassie", "lassies"],
276
- ["genie", "genies"],
277
- ["foodie", "foodies"],
278
- ["faerie", "faeries"],
279
- ["collie", "collies"],
280
- ["obloquy", "obloquies"],
281
- ["looey", "looies"],
282
- ["osprey", "ospreys"],
283
- ["cover", "covers"],
284
- ["tie", "ties"],
285
- ["groove", "grooves"],
286
- ["bee", "bees"],
287
- ["ave", "aves"],
288
- ["wave", "waves"],
289
- ["wolf", "wolves"],
290
- ["airwave", "airwaves"],
291
- ["archive", "archives"],
292
- ["arch", "arches"],
293
- ["dive", "dives"],
294
- ["aftershave", "aftershaves"],
295
- ["cave", "caves"],
296
- ["grave", "graves"],
297
- ["gift", "gifts"],
298
- ["nerve", "nerves"],
299
- ["nerd", "nerds"],
300
- ["carve", "carves"],
301
- ["rave", "raves"],
302
- ["scarf", "scarves"],
303
- ["sale", "sales"],
304
- ["sail", "sails"],
305
- ["swerve", "swerves"],
306
- ["love", "loves"],
307
- ["dove", "doves"],
308
- ["glove", "gloves"],
309
- ["wharf", "wharves"],
310
- ["valve", "valves"],
311
- ["werewolf", "werewolves"],
312
- ["view", "views"],
313
- ["emu", "emus"],
314
- ["menu", "menus"],
315
- ["wax", "waxes"],
316
- ["fax", "faxes"],
317
- ["nut", "nuts"],
318
- ["crust", "crusts"],
319
- ["lemma", "lemmata"],
320
- ["anathema", "anathemata"],
321
- ["analysis", "analyses"],
322
- ["locus", "loci"],
323
- ["uterus", "uteri"],
324
- ["curriculum", "curricula"],
325
- ["quorum", "quora"],
326
- ["genius", "geniuses"],
327
- ["flower", "flowers"],
328
- ["crash", "crashes"],
329
- ["soul", "souls"],
330
- ["career", "careers"],
331
- ["planet", "planets"],
332
- ["son", "sons"],
333
- ["sun", "suns"],
334
- ["drink", "drinks"],
335
- ["diploma", "diplomas"],
336
- ["dilemma", "dilemmas"],
337
- ["grandma", "grandmas"],
338
- ["no", "nos"],
339
- ["yes", "yeses"],
340
- ["employ", "employs"],
341
- ["employee", "employees"],
342
- ["history", "histories"],
343
- ["story", "stories"],
344
- ["purchase", "purchases"],
345
- ["order", "orders"],
346
- ["key", "keys"],
347
- ["bomb", "bombs"],
348
- ["city", "cities"],
349
- ["sanity", "sanities"],
350
- ["ability", "abilities"],
351
- ["activity", "activities"],
352
- ["cutie", "cuties"],
353
- ["validation", "validations"],
354
- ["floaty", "floaties"],
355
- ["nicety", "niceties"],
356
- ["goalie", "goalies"],
357
- ["crawly", "crawlies"],
358
- ["duty", "duties"],
359
- ["scrutiny", "scrutinies"],
360
- ["deputy", "deputies"],
361
- ["beauty", "beauties"],
362
- ["bank", "banks"],
363
- ["family", "families"],
364
- ["tally", "tallies"],
365
- ["ally", "allies"],
366
- ["alley", "alleys"],
367
- ["valley", "valleys"],
368
- ["medley", "medleys"],
369
- ["melody", "melodies"],
370
- ["trolly", "trollies"],
371
- ["thunk", "thunks"],
372
- ["koala", "koalas"],
373
- ["special", "specials"],
374
- ["book", "books"],
375
- ["knob", "knobs"],
376
- ["crab", "crabs"],
377
- ["plough", "ploughs"],
378
- ["high", "highs"],
379
- ["low", "lows"],
380
- ["hiccup", "hiccups"],
381
- ["bonus", "bonuses"],
382
- ["circus", "circuses"],
383
- ["abacus", "abacuses"],
384
- ["phobia", "phobias"],
385
- ["case", "cases"],
386
- ["lace", "laces"],
387
- ["trace", "traces"],
388
- ["mage", "mages"],
389
- ["lotus", "lotuses"],
390
- ["motorbus", "motorbuses"],
391
- ["cutlas", "cutlases"],
392
- ["tequila", "tequilas"],
393
- ["liar", "liars"],
394
- ["delta", "deltas"],
395
- ["visa", "visas"],
396
- ["flea", "fleas"],
397
- ["favela", "favelas"],
398
- ["cobra", "cobras"],
399
- ["finish", "finishes"],
400
- ["gorilla", "gorillas"],
401
- ["mass", "masses"],
402
- ["face", "faces"],
403
- ["rabbit", "rabbits"],
404
- ["adventure", "adventures"],
405
- ["breeze", "breezes"],
406
- ["brew", "brews"],
407
- ["canopy", "canopies"],
408
- ["copy", "copies"],
409
- ["spy", "spies"],
410
- ["cave", "caves"],
411
- ["charge", "charges"],
412
- ["cinema", "cinemas"],
413
- ["coffee", "coffees"],
414
- ["favourite", "favourites"],
415
- ["themself", "themselves"],
416
- ["country", "countries"],
417
- ["issue", "issues"],
418
- ["authority", "authorities"],
419
- ["force", "forces"],
420
- ["objective", "objectives"],
421
- ["present", "presents"],
422
- ["industry", "industries"],
423
- ["believe", "believes"],
424
- ["century", "centuries"],
425
- ["category", "categories"],
426
- ["eve", "eves"],
427
- ["fee", "fees"],
428
- ["gene", "genes"],
429
- ["try", "tries"],
430
- ["currency", "currencies"],
431
- ["pose", "poses"],
432
- ["cheese", "cheeses"],
433
- ["clue", "clues"],
434
- ["cheer", "cheers"],
435
- ["litre", "litres"],
436
- ["money", "monies"],
437
- ["attorney", "attorneys"],
438
- ["balcony", "balconies"],
439
- ["cockney", "cockneys"],
440
- ["donkey", "donkeys"],
441
- ["honey", "honeys"],
442
- ["smiley", "smilies"],
443
- ["survey", "surveys"],
444
- ["whiskey", "whiskeys"],
445
- ["whisky", "whiskies"],
446
- ["volley", "volleys"],
447
- ["tongue", "tongues"],
448
- ["suit", "suits"],
449
- ["suite", "suites"],
450
- ["cruise", "cruises"],
451
- ["eave", "eaves"],
452
- ["consultancy", "consultancies"],
453
- ["pouch", "pouches"],
454
- ["wallaby", "wallabies"],
455
- ["abyss", "abysses"],
456
- ["weekly", "weeklies"],
457
- ["whistle", "whistles"],
458
- ["utilise", "utilises"],
459
- ["utilize", "utilizes"],
460
- ["mercy", "mercies"],
461
- ["mercenary", "mercenaries"],
462
- ["take", "takes"],
463
- ["flush", "flushes"],
464
- ["gate", "gates"],
465
- ["evolve", "evolves"],
466
- ["slave", "slaves"],
467
- ["native", "natives"],
468
- ["revolve", "revolves"],
469
- ["twelve", "twelves"],
470
- ["sleeve", "sleeves"],
471
- ["subjective", "subjectives"],
472
- ["stream", "streams"],
473
- ["beam", "beams"],
474
- ["foam", "foams"],
475
- ["callus", "calluses"],
476
- ["use", "uses"],
477
- ["beau", "beaus"],
478
- ["gateau", "gateaus"],
479
- ["fetus", "fetuses"],
480
- ["luau", "luaus"],
481
- ["pilau", "pilaus"],
482
- ["shoe", "shoes"],
483
- ["sandshoe", "sandshoes"],
484
- ["zeus", "zeuses"],
485
- ["nucleus", "nuclei"],
486
- ["sky", "skies"],
487
- ["beach", "beaches"],
488
- ["brush", "brushes"],
489
- ["hoax", "hoaxes"],
490
- ["scratch", "scratches"],
491
- ["nanny", "nannies"],
492
- ["negro", "negroes"],
493
- ["taco", "tacos"],
494
- ["cafe", "cafes"],
495
- ["cave", "caves"],
496
- ["giraffe", "giraffes"],
497
- ["goodwife", "goodwives"],
498
- ["housewife", "housewives"],
499
- ["safe", "safes"],
500
- ["save", "saves"],
501
- ["pocketknife", "pocketknives"],
502
- ["tartufe", "tartufes"],
503
- ["tartuffe", "tartuffes"],
504
- ["truffle", "truffles"],
505
- ["jefe", "jefes"],
506
- ["agrafe", "agrafes"],
507
- ["agraffe", "agraffes"],
508
- ["bouffe", "bouffes"],
509
- ["carafe", "carafes"],
510
- ["chafe", "chafes"],
511
- ["pouffe", "pouffes"],
512
- ["pouf", "poufs"],
513
- ["piaffe", "piaffes"],
514
- ["gaffe", "gaffes"],
515
- ["executive", "executives"],
516
- ["cove", "coves"],
517
- ["dove", "doves"],
518
- ["fave", "faves"],
519
- ["positive", "positives"],
520
- ["solve", "solves"],
521
- ["trove", "troves"],
522
- ["treasure", "treasures"],
523
- ["suave", "suaves"],
524
- ["bluff", "bluffs"],
525
- ["half", "halves"],
526
- ["knockoff", "knockoffs"],
527
- ["handkerchief", "handkerchiefs"],
528
- ["reed", "reeds"],
529
- ["reef", "reefs"],
530
- ["yourself", "yourselves"],
531
- ["sunroof", "sunroofs"],
532
- ["plateau", "plateaus"],
533
- ["radius", "radii"],
534
- ["stratum", "strata"],
535
- ["stratus", "strati"],
536
- ["focus", "foci"],
537
- ["fungus", "fungi"],
538
- ["appendix", "appendices"],
539
- ["seraph", "seraphim"],
540
- ["cherub", "cherubim"],
541
- ["memo", "memos"],
542
- ["cello", "cellos"],
543
- ["automaton", "automata"],
544
- ["button", "buttons"],
545
- ["crayon", "crayons"],
546
- ["captive", "captives"],
547
- ["abrasive", "abrasives"],
548
- ["archive", "archives"],
549
- ["additive", "additives"],
550
- ["hive", "hives"],
551
- ["beehive", "beehives"],
552
- ["olive", "olives"],
553
- ["black olive", "black olives"],
554
- ["chive", "chives"],
555
- ["adjective", "adjectives"],
556
- ["cattle drive", "cattle drives"],
557
- ["explosive", "explosives"],
558
- ["executive", "executives"],
559
- ["negative", "negatives"],
560
- ["fugitive", "fugitives"],
561
- ["progressive", "progressives"],
562
- ["laxative", "laxatives"],
563
- ["incentive", "incentives"],
564
- ["genesis", "geneses"],
565
- ["surprise", "surprises"],
566
- ["enterprise", "enterprises"],
567
- ["relative", "relatives"],
568
- ["positive", "positives"],
569
- ["perspective", "perspectives"],
570
- ["superlative", "superlatives"],
571
- ["afterlife", "afterlives"],
572
- ["native", "natives"],
573
- ["detective", "detectives"],
574
- ["collective", "collectives"],
575
- ["lowlife", "lowlives"],
576
- ["low-life", "low-lives"],
577
- ["strife", "strifes"],
578
- ["pony", "ponies"],
579
- ["phony", "phonies"],
580
- ["felony", "felonies"],
581
- ["colony", "colonies"],
582
- ["symphony", "symphonies"],
583
- ["semicolony", "semicolonies"],
584
- ["radiotelephony", "radiotelephonies"],
585
- ["company", "companies"],
586
- ["ceremony", "ceremonies"],
587
- ["carnivore", "carnivores"],
588
- ["emphasis", "emphases"],
589
- ["abuse", "abuses"],
590
- ["ass", "asses"],
591
- ["mile", "miles"],
592
- ["consensus", "consensuses"],
593
- ["coatdress", "coatdresses"],
594
- ["courthouse", "courthouses"],
595
- ["playhouse", "playhouses"],
596
- ["crispness", "crispnesses"],
597
- ["racehorse", "racehorses"],
598
- ["greatness", "greatnesses"],
599
- ["demon", "demons"],
600
- ["lemon", "lemons"],
601
- ["pokemon", "pokemon"],
602
- ["pokémon", "pokémon"],
603
- ["christmas", "christmases"],
604
- ["zymase", "zymases"],
605
- ["accomplice", "accomplices"],
606
- ["amice", "amices"],
607
- ["titmouse", "titmice"],
608
- ["slice", "slices"],
609
- ["base", "bases"],
610
- ["database", "databases"],
611
- ["rise", "rises"],
612
- ["uprise", "uprises"],
613
- ["size", "sizes"],
614
- ["prize", "prizes"],
615
- ["booby", "boobies"],
616
- ["hobby", "hobbies"],
617
- ["baby", "babies"],
618
- ["cookie", "cookies"],
619
- ["budgie", "budgies"],
620
- ["calorie", "calories"],
621
- ["brownie", "brownies"],
622
- ["lolly", "lollies"],
623
- ["hippie", "hippies"],
624
- ["smoothie", "smoothies"],
625
- ["techie", "techies"],
626
- ["specie", "species"],
627
- ["quickie", "quickies"],
628
- ["pixie", "pixies"],
629
- ["rotisserie", "rotisseries"],
630
- ["porkpie", "porkpies"],
631
- ["newbie", "newbies"],
632
- ["veggie", "veggies"],
633
- ["bourgeoisie", "bourgeoisies"],
634
- ["party", "parties"],
635
- ["apology", "apologies"],
636
- ["ancestry", "ancestries"],
637
- ["anomaly", "anomalies"],
638
- ["anniversary", "anniversaries"],
639
- ["battery", "batteries"],
640
- ["nappy", "nappies"],
641
- ["hanky", "hankies"],
642
- ["junkie", "junkies"],
643
- ["hogtie", "hogties"],
644
- ["footsie", "footsies"],
645
- ["curry", "curries"],
646
- ["fantasy", "fantasies"],
647
- ["housefly", "houseflies"],
648
- ["falsy", "falsies"],
649
- ["doggy", "doggies"],
650
- ["carny", "carnies"],
651
- ["cabby", "cabbies"],
652
- ["charlie", "charlies"],
653
- ["bookie", "bookies"],
654
- ["auntie", "aunties"],
655
- // Prototype inheritance.
656
- ["constructor", "constructors"],
657
- // Non-standard case.
658
- ["randomWord", "randomWords"],
659
- ["camelCase", "camelCases"],
660
- ["PascalCase", "PascalCases"],
661
- ["Alumnus", "Alumni"],
662
- ["CHICKEN", "CHICKENS"],
663
- ["日本語", "日本語"],
664
- ["한국", "한국"],
665
- ["中文", "中文"],
666
- ["اللغة العربية", "اللغة العربية"],
667
- ["四 chicken", "四 chickens"],
668
- ["Order2", "Order2s"],
669
- ["Work Order2", "Work Order2s"],
670
- ["SoundFX2", "SoundFX2s"],
671
- ["oDonald", "oDonalds"],
672
- ];
673
-
674
- /**
675
- * Odd plural to singular tests.
676
- *
677
- * @type {Array}
678
- */
679
- const SINGULAR_TESTS = [
680
- ["dingo", "dingos"],
681
- ["mango", "mangoes"],
682
- ["echo", "echos"],
683
- ["ghetto", "ghettoes"],
684
- ["nucleus", "nucleuses"],
685
- ["bureau", "bureaux"],
686
- ["seraph", "seraphs"],
687
- ];
688
-
689
- /**
690
- * Odd singular to plural tests.
691
- *
692
- * @type {Array}
693
- */
694
- const PLURAL_TESTS = [
695
- ["plateaux", "plateaux"],
696
- ["axis", "axes"],
697
- ["basis", "bases"],
698
- ["automatum", "automata"],
699
- ["thou", "you"],
700
- ["axiS", "axes"],
701
- ["passerby", "passersby"],
702
- ];
703
-
704
- /**
705
- * Test suite.
706
- */
707
- describe("pluralize", () => {
708
- describe("methods", () => {
709
- describe("plural", () => {
710
- BASIC_TESTS.concat(PLURAL_TESTS).forEach((test) => {
711
- it(`${test[0]} -> ${test[1]}`, () => {
712
- expect(pluralize.plural(test[0])).toBe(test[1]);
713
- });
714
- });
715
- });
716
-
717
- describe("isPlural", () => {
718
- BASIC_TESTS.concat(PLURAL_TESTS).forEach((test) => {
719
- it(`isPlural(${test[1]})`, () => {
720
- expect(pluralize.isPlural(test[1])).toBe(true);
721
- });
722
- });
723
- });
724
-
725
- describe("singular", () => {
726
- BASIC_TESTS.concat(SINGULAR_TESTS).forEach((test) => {
727
- it(`${test[1]} -> ${test[0]}`, () => {
728
- expect(pluralize.singular(test[1])).toBe(test[0]);
729
- });
730
- });
731
- });
732
-
733
- describe("isSingular", () => {
734
- BASIC_TESTS.concat(SINGULAR_TESTS).forEach((test) => {
735
- it(`isSingular(${test[0]})`, () => {
736
- expect(pluralize.isSingular(test[0])).toBe(true);
737
- });
738
- });
739
- });
740
- });
741
-
742
- describe("automatically convert", () => {
743
- describe("plural", () => {
744
- BASIC_TESTS.concat(PLURAL_TESTS).forEach((test) => {
745
- // Make sure the word stays pluralized.
746
- it(`5 ${test[1]} -> ${test[1]}`, () => {
747
- expect(pluralize(test[1], 5)).toBe(test[1]);
748
- });
749
-
750
- // Make sure the word becomes a plural.
751
- if (test[0] !== test[1]) {
752
- it(`5 ${test[0]} -> ${test[1]}`, () => {
753
- expect(pluralize(test[0], 5)).toBe(test[1]);
754
- });
755
- }
756
- });
757
- });
758
-
759
- describe("singular", () => {
760
- BASIC_TESTS.concat(SINGULAR_TESTS).forEach((test) => {
761
- // Make sure the word stays singular.
762
- it(`1 ${test[0]} -> ${test[0]}`, () => {
763
- expect(pluralize(test[0], 1)).toBe(test[0]);
764
- });
765
-
766
- // Make sure the word becomes singular.
767
- if (test[0] !== test[1]) {
768
- it(`1 ${test[1]} -> ${test[0]}`, () => {
769
- expect(pluralize(test[1], 1)).toBe(test[0]);
770
- });
771
- }
772
- });
773
- });
774
- });
775
-
776
- describe("prepend count", () => {
777
- it("plural words", () => {
778
- expect(pluralize("test", 5, true)).toBe("5 tests");
779
- });
780
-
781
- it("singular words", () => {
782
- expect(pluralize("test", 1, true)).toBe("1 test");
783
- });
784
- });
785
-
786
- describe("adding new rules", () => {
787
- it("uncountable rules", () => {
788
- expect(pluralize("paper")).toBe("papers");
789
-
790
- pluralize.addUncountableRule("paper");
791
-
792
- expect(pluralize("paper")).toBe("paper");
793
- });
794
-
795
- it("should allow new irregular words", () => {
796
- expect(pluralize("irregular")).toBe("irregulars");
797
-
798
- pluralize.addIrregularRule("irregular", "regular");
799
-
800
- expect(pluralize("irregular")).toBe("regular");
801
- });
802
-
803
- it("should allow new plural matching rules", () => {
804
- expect(pluralize.plural("regex")).toBe("regexes");
805
-
806
- pluralize.addPluralRule(/gex$/i, "gexii");
807
-
808
- expect(pluralize.plural("regex")).toBe("regexii");
809
- });
810
-
811
- it("should allow new singular matching rules", () => {
812
- expect(pluralize.singular("singles")).toBe("single");
813
-
814
- pluralize.addSingularRule(/singles$/, "singular");
815
-
816
- expect(pluralize.singular("singles")).toBe("singular");
817
- });
818
-
819
- it("should allow new plural matching rules to be strings", () => {
820
- expect(pluralize.plural("person")).toBe("people");
821
-
822
- pluralize.addPluralRule("person", "peeps");
823
-
824
- expect(pluralize.plural("person")).toBe("peeps");
825
- });
826
-
827
- it("should allow new singular matching rules to be strings", () => {
828
- expect(pluralize.singular("mornings")).toBe("morning");
829
-
830
- pluralize.addSingularRule("mornings", "suck");
831
-
832
- expect(pluralize.singular("mornings")).toBe("suck");
833
- });
834
- });
835
- });