Skip to content

Commit b6d5345

Browse files
committed
🐛 fix drive(s)
1 parent 11816b2 commit b6d5345

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/inflection.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@
352352
children : new RegExp( '(child)ren$' , 'gi' ),
353353
tia : new RegExp( '([ti])a$' , 'gi' ),
354354
analyses : new RegExp( '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi' ),
355+
drives : new RegExp( '(drive)s$' , 'gi' ),
355356
hives : new RegExp( '(hi|ti)ves$' , 'gi' ),
356357
curves : new RegExp( '(curve)s$' , 'gi' ),
357358
lrves : new RegExp( '([lr])ves$' , 'gi' ),
@@ -387,6 +388,7 @@
387388
man : new RegExp( '^(m|wom)an$' , 'gi' ),
388389
person : new RegExp( '(pe)rson$' , 'gi' ),
389390
child : new RegExp( '(child)$' , 'gi' ),
391+
drive : new RegExp( '(drive)$' , 'gi' ),
390392
ox : new RegExp( '^(ox)$' , 'gi' ),
391393
axis : new RegExp( '(ax|test)is$' , 'gi' ),
392394
octopus : new RegExp( '(octop|vir)us$' , 'gi' ),
@@ -423,6 +425,7 @@
423425
[ regex.plural.children ],
424426
[ regex.plural.tia ],
425427
[ regex.plural.analyses ],
428+
[ regex.plural.drives ],
426429
[ regex.plural.hives ],
427430
[ regex.plural.curves ],
428431
[ regex.plural.lrves ],
@@ -453,6 +456,7 @@
453456
[ regex.singular.man , '$1en' ],
454457
[ regex.singular.person , '$1ople' ],
455458
[ regex.singular.child , '$1ren' ],
459+
[ regex.singular.drive , '$1s' ],
456460
[ regex.singular.ox , '$1en' ],
457461
[ regex.singular.axis , '$1es' ],
458462
[ regex.singular.octopus , '$1uses' ],
@@ -491,6 +495,7 @@
491495
[ regex.singular.man ],
492496
[ regex.singular.person ],
493497
[ regex.singular.child ],
498+
[ regex.singular.drive ],
494499
[ regex.singular.ox ],
495500
[ regex.singular.axis ],
496501
[ regex.singular.octopus ],
@@ -518,6 +523,7 @@
518523
[ regex.plural.men , '$1an' ],
519524
[ regex.plural.people , '$1rson' ],
520525
[ regex.plural.children , '$1' ],
526+
[ regex.plural.drives , '$1'],
521527
[ regex.plural.genera , 'genus'],
522528
[ regex.plural.criteria , '$1on'],
523529
[ regex.plural.tia , '$1um' ],

test/inflection.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ describe( 'test .pluralize', function (){
5757
inflection.pluralize( 'genera' ).should.equal( 'genera' );
5858
inflection.pluralize( 'bonus' ).should.equal( 'bonuses' );
5959
inflection.pluralize( 'grammar' ).should.equal( 'grammars' );
60+
inflection.pluralize( 'drive' ).should.equal( 'drives' );
6061
});
6162
});
6263

@@ -105,6 +106,7 @@ describe( 'test .singularize', function (){
105106
inflection.singularize( 'minus' ).should.equal( 'minus' );
106107
inflection.singularize( 'bonuses' ).should.equal( 'bonus' );
107108
inflection.singularize( 'grammars' ).should.equal( 'grammar' );
109+
inflection.singularize( 'drives' ).should.equal( 'drive' );
108110
});
109111
});
110112

@@ -119,6 +121,7 @@ describe( 'test .inflect', function (){
119121
inflection.inflect( 'data', 0 ).should.equal( 'data' );
120122
inflection.inflect( 'meta', 0 ).should.equal( 'meta' );
121123
inflection.inflect( 'person', 0, 'guy', 'guys' ).should.equal( 'guys' );
124+
inflection.inflect( 'drive', 0 ).should.equal( 'drives' );
122125
// greater than 1 should use plural state
123126
inflection.inflect( 'people', 2 ).should.equal( 'people' );
124127
inflection.inflect( 'men', 2 ).should.equal( 'men' );
@@ -128,6 +131,7 @@ describe( 'test .inflect', function (){
128131
inflection.inflect( 'data', 2 ).should.equal( 'data' );
129132
inflection.inflect( 'meta', 2 ).should.equal( 'meta' );
130133
inflection.inflect( 'person', 2, 'guy', 'guys' ).should.equal( 'guys' );
134+
inflection.inflect( 'drive', 2 ).should.equal( 'drives' );
131135
// 1 should use singular state
132136
inflection.inflect( 'status', 1 ).should.equal( 'status' );
133137
inflection.inflect( 'child', 1 ).should.equal( 'child' );
@@ -144,6 +148,8 @@ describe( 'test .inflect', function (){
144148
inflection.inflect( 'guys', 1, 'person', 'people' ).should.equal( 'person' );
145149
// not a number should return original value
146150
inflection.inflect( 'original', 'not a number' ).should.equal( 'original' );
151+
inflection.inflect( 'drive', 1 ).should.equal( 'drive' );
152+
inflection.inflect( 'drives', 1 ).should.equal( 'drive' );
147153
});
148154
});
149155

0 commit comments

Comments
 (0)