File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 265
265
irregularPlurals [ plural ] = single ;
266
266
} ;
267
267
268
+ /**
269
+ * Get all known plural rules.
270
+ */
271
+ pluralize . getPluralRules = function ( ) {
272
+ return pluralRules ;
273
+ } ;
274
+
275
+ /**
276
+ * Get all known singular rules.
277
+ */
278
+ pluralize . getSingularRules = function ( ) {
279
+ return singularRules ;
280
+ } ;
281
+
282
+ /**
283
+ * Get all known uncountable words.
284
+ */
285
+ pluralize . getUncountables = function ( ) {
286
+ return uncountables ;
287
+ } ;
288
+
289
+ /**
290
+ * Get all known irregular plural words.
291
+ */
292
+ pluralize . getIrregularPlurals = function ( ) {
293
+ return irregularPlurals ;
294
+ } ;
295
+
296
+ /**
297
+ * Get all known irregular single words.
298
+ */
299
+ pluralize . getIrregularSingles = function ( ) {
300
+ return irregularSingles ;
301
+ } ;
302
+
268
303
/**
269
304
* Irregular rules.
270
305
*/
Original file line number Diff line number Diff line change @@ -833,4 +833,35 @@ describe('pluralize', function () {
833
833
expect ( pluralize . singular ( 'mornings' ) ) . to . equal ( 'suck' ) ;
834
834
} ) ;
835
835
} ) ;
836
+
837
+ describe ( 'getting existing rules' , function ( ) {
838
+ it ( 'should allow access to plural rules' , function ( ) {
839
+ var rules = pluralize . getPluralRules ( ) ;
840
+ expect ( rules ) . to . be . an ( 'array' ) ;
841
+ } ) ;
842
+
843
+ it ( 'should allow access to singular rules' , function ( ) {
844
+ var rules = pluralize . getSingularRules ( ) ;
845
+ expect ( rules ) . to . be . an ( 'array' ) ;
846
+ } ) ;
847
+ } ) ;
848
+
849
+ describe ( 'getting uncountable words' , function ( ) {
850
+ it ( 'should allow access to uncountable words' , function ( ) {
851
+ var uncountable = pluralize . getUncountables ( ) ;
852
+ expect ( uncountable ) . to . be . ok . and . an ( 'object' ) ;
853
+ } ) ;
854
+ } ) ;
855
+
856
+ describe ( 'getting irregular words' , function ( ) {
857
+ it ( 'should allow access to irregular plural words' , function ( ) {
858
+ var irregular = pluralize . getIrregularPlurals ( ) ;
859
+ expect ( irregular ) . to . be . ok . and . an ( 'object' ) ;
860
+ } ) ;
861
+
862
+ it ( 'should allow access to irregular singular words' , function ( ) {
863
+ var irregular = pluralize . getIrregularSingles ( ) ;
864
+ expect ( irregular ) . to . be . ok . and . an ( 'object' ) ;
865
+ } ) ;
866
+ } ) ;
836
867
} ) ;
You can’t perform that action at this time.
0 commit comments