@@ -30,31 +30,31 @@ npm install inflection
3030```
3131## API
3232
33- - inflection.pluralize( str, plural );
34- - inflection.singularize( str, singular );
35- - inflection.inflect( str, count, singular, plural );
36- - inflection.camelize( str, low_first_letter );
37- - inflection.underscore( str, all_upper_case );
38- - inflection.humanize( str, low_first_letter );
39- - inflection.capitalize( str );
40- - inflection.dasherize( str );
41- - inflection.titleize( str );
42- - inflection.demodulize( str );
43- - inflection.tableize( str );
44- - inflection.classify( str );
45- - inflection.foreign_key( str, drop_id_ubar );
46- - inflection.ordinalize( str );
47- - inflection.transform( str, arr );
33+ - inflection.pluralize(str, plural);
34+ - inflection.singularize(str, singular);
35+ - inflection.inflect(str, count, singular, plural);
36+ - inflection.camelize(str, low_first_letter);
37+ - inflection.underscore(str, all_upper_case);
38+ - inflection.humanize(str, low_first_letter);
39+ - inflection.capitalize(str);
40+ - inflection.dasherize(str);
41+ - inflection.titleize(str);
42+ - inflection.demodulize(str);
43+ - inflection.tableize(str);
44+ - inflection.classify(str);
45+ - inflection.foreign_key(str, drop_id_ubar);
46+ - inflection.ordinalize(str);
47+ - inflection.transform(str, arr);
4848
4949## Usage
5050
5151> Require the module before using
5252
5353``` js
54- const inflection = require ( ' inflection' );
54+ const inflection = require (' inflection' );
5555```
5656
57- ### inflection.pluralize( str, plural );
57+ ### inflection.pluralize(str, plural);
5858
5959This function adds pluralization support to every String object.
6060
@@ -72,15 +72,15 @@ This function adds pluralization support to every String object.
7272
7373#### Example code
7474``` js
75- var inflection = require ( ' inflection' );
75+ var inflection = require (' inflection' );
7676
77- inflection .pluralize ( ' person' ); // === 'people'
78- inflection .pluralize ( ' octopus' ); // === "octopi"
79- inflection .pluralize ( ' Hat' ); // === 'Hats'
80- inflection .pluralize ( ' person' , ' guys' ); // === 'guys'
77+ inflection .pluralize (' person' ); // === 'people'
78+ inflection .pluralize (' octopus' ); // === "octopi"
79+ inflection .pluralize (' Hat' ); // === 'Hats'
80+ inflection .pluralize (' person' , ' guys' ); // === 'guys'
8181```
8282
83- ### inflection.singularize( str, singular );
83+ ### inflection.singularize(str, singular);
8484
8585This function adds singularization support to every String object.
8686
@@ -98,15 +98,15 @@ This function adds singularization support to every String object.
9898
9999#### Example code
100100``` js
101- var inflection = require ( ' inflection' );
101+ var inflection = require (' inflection' );
102102
103- inflection .singularize ( ' people' ); // === 'person'
104- inflection .singularize ( ' octopi' ); // === "octopus"
105- inflection .singularize ( ' Hats' ); // === 'Hat'
106- inflection .singularize ( ' guys' , ' person' ); // === 'person'
103+ inflection .singularize (' people' ); // === 'person'
104+ inflection .singularize (' octopi' ); // === "octopus"
105+ inflection .singularize (' Hats' ); // === 'Hat'
106+ inflection .singularize (' guys' , ' person' ); // === 'person'
107107```
108108
109- ### inflection.inflect( str, count, singular, plural );
109+ ### inflection.inflect(str, count, singular, plural);
110110
111111This function will pluralize or singularlize a String appropriately based on an integer value.
112112
@@ -134,19 +134,19 @@ This function will pluralize or singularlize a String appropriately based on an
134134
135135#### Example code
136136``` js
137- var inflection = require ( ' inflection' );
138-
139- inflection .inflect ( ' people' , 1 ); // === 'person'
140- inflection .inflect ( ' octopi' , 1 ); // === 'octopus'
141- inflection .inflect ( ' Hats' , 1 ); // === 'Hat'
142- inflection .inflect ( ' guys' , 1 , ' person' ); // === 'person'
143- inflection .inflect ( ' person' , 2 ); // === 'people'
144- inflection .inflect ( ' octopus' , 2 ); // === 'octopi'
145- inflection .inflect ( ' Hat' , 2 ); // === 'Hats'
146- inflection .inflect ( ' person' , 2 , null , ' guys' ); // === 'guys'
137+ var inflection = require (' inflection' );
138+
139+ inflection .inflect (' people' , 1 ); // === 'person'
140+ inflection .inflect (' octopi' , 1 ); // === 'octopus'
141+ inflection .inflect (' Hats' , 1 ); // === 'Hat'
142+ inflection .inflect (' guys' , 1 , ' person' ); // === 'person'
143+ inflection .inflect (' person' , 2 ); // === 'people'
144+ inflection .inflect (' octopus' , 2 ); // === 'octopi'
145+ inflection .inflect (' Hat' , 2 ); // === 'Hats'
146+ inflection .inflect (' person' , 2 , null , ' guys' ); // === 'guys'
147147```
148148
149- ### inflection.camelize( str, low_first_letter );
149+ ### inflection.camelize(str, low_first_letter);
150150
151151This function transforms String object from underscore to camelcase.
152152
@@ -164,13 +164,13 @@ This function transforms String object from underscore to camelcase.
164164
165165#### Example code
166166``` js
167- var inflection = require ( ' inflection' );
167+ var inflection = require (' inflection' );
168168
169- inflection .camelize ( ' message_properties' ); // === 'MessageProperties'
170- inflection .camelize ( ' message_properties' , true ); // === 'messageProperties'
169+ inflection .camelize (' message_properties' ); // === 'MessageProperties'
170+ inflection .camelize (' message_properties' , true ); // === 'messageProperties'
171171```
172172
173- ### inflection.underscore( str, all_upper_case );
173+ ### inflection.underscore(str, all_upper_case);
174174
175175This function transforms String object from camelcase to underscore.
176176
@@ -188,15 +188,15 @@ This function transforms String object from camelcase to underscore.
188188
189189#### Example code
190190``` js
191- var inflection = require ( ' inflection' );
191+ var inflection = require (' inflection' );
192192
193- inflection .underscore ( ' MessageProperties' ); // === 'message_properties'
194- inflection .underscore ( ' messageProperties' ); // === 'message_properties'
195- inflection .underscore ( ' MP' ); // === 'm_p'
196- inflection .underscore ( ' MP' , true ); // === 'MP'
193+ inflection .underscore (' MessageProperties' ); // === 'message_properties'
194+ inflection .underscore (' messageProperties' ); // === 'message_properties'
195+ inflection .underscore (' MP' ); // === 'm_p'
196+ inflection .underscore (' MP' , true ); // === 'MP'
197197```
198198
199- ### inflection.humanize( str, low_first_letter );
199+ ### inflection.humanize(str, low_first_letter);
200200
201201This function adds humanize support to every String object.
202202
@@ -214,13 +214,13 @@ This function adds humanize support to every String object.
214214
215215#### Example code
216216``` js
217- var inflection = require ( ' inflection' );
217+ var inflection = require (' inflection' );
218218
219- inflection .humanize ( ' message_properties' ); // === 'Message properties'
220- inflection .humanize ( ' message_properties' , true ); // === 'message properties'
219+ inflection .humanize (' message_properties' ); // === 'Message properties'
220+ inflection .humanize (' message_properties' , true ); // === 'message properties'
221221```
222222
223- ### inflection.capitalize( str );
223+ ### inflection.capitalize(str);
224224
225225This function adds capitalization support to every String object.
226226
@@ -233,13 +233,13 @@ This function adds capitalization support to every String object.
233233
234234#### Example code
235235``` js
236- var inflection = require ( ' inflection' );
236+ var inflection = require (' inflection' );
237237
238- inflection .capitalize ( ' message_properties' ); // === 'Message_properties'
239- inflection .capitalize ( ' message properties' , true ); // === 'Message properties'
238+ inflection .capitalize (' message_properties' ); // === 'Message_properties'
239+ inflection .capitalize (' message properties' , true ); // === 'Message properties'
240240```
241241
242- ### inflection.dasherize( str );
242+ ### inflection.dasherize(str);
243243
244244This function replaces underscores with dashes in the string.
245245
@@ -252,13 +252,13 @@ This function replaces underscores with dashes in the string.
252252
253253#### Example code
254254``` js
255- var inflection = require ( ' inflection' );
255+ var inflection = require (' inflection' );
256256
257- inflection .dasherize ( ' message_properties' ); // === 'message-properties'
258- inflection .dasherize ( ' Message Properties' ); // === 'Message-Properties'
257+ inflection .dasherize (' message_properties' ); // === 'message-properties'
258+ inflection .dasherize (' Message Properties' ); // === 'Message-Properties'
259259```
260260
261- ### inflection.titleize( str );
261+ ### inflection.titleize(str);
262262
263263This function adds titleize support to every String object.
264264
@@ -271,13 +271,13 @@ This function adds titleize support to every String object.
271271
272272#### Example code
273273``` js
274- var inflection = require ( ' inflection' );
274+ var inflection = require (' inflection' );
275275
276- inflection .titleize ( ' message_properties' ); // === 'Message Properties'
277- inflection .titleize ( ' message properties to keep' ); // === 'Message Properties to Keep'
276+ inflection .titleize (' message_properties' ); // === 'Message Properties'
277+ inflection .titleize (' message properties to keep' ); // === 'Message Properties to Keep'
278278```
279279
280- ### inflection.demodulize( str );
280+ ### inflection.demodulize(str);
281281
282282This function adds demodulize support to every String object.
283283
@@ -290,12 +290,12 @@ This function adds demodulize support to every String object.
290290
291291#### Example code
292292``` js
293- var inflection = require ( ' inflection' );
293+ var inflection = require (' inflection' );
294294
295- inflection .demodulize ( ' Message::Bus::Properties' ); // === 'Properties'
295+ inflection .demodulize (' Message::Bus::Properties' ); // === 'Properties'
296296```
297297
298- ### inflection.tableize( str );
298+ ### inflection.tableize(str);
299299
300300This function adds tableize support to every String object.
301301
@@ -308,12 +308,12 @@ This function adds tableize support to every String object.
308308
309309#### Example code
310310``` js
311- var inflection = require ( ' inflection' );
311+ var inflection = require (' inflection' );
312312
313- inflection .tableize ( ' MessageBusProperty' ); // === 'message_bus_properties'
313+ inflection .tableize (' MessageBusProperty' ); // === 'message_bus_properties'
314314```
315315
316- ### inflection.classify( str );
316+ ### inflection.classify(str);
317317
318318This function adds classification support to every String object.
319319
@@ -326,12 +326,12 @@ This function adds classification support to every String object.
326326
327327#### Example code
328328``` js
329- var inflection = require ( ' inflection' );
329+ var inflection = require (' inflection' );
330330
331- inflection .classify ( ' message_bus_properties' ); // === 'MessageBusProperty'
331+ inflection .classify (' message_bus_properties' ); // === 'MessageBusProperty'
332332```
333333
334- ### inflection.foreign_key( str, drop_id_ubar );
334+ ### inflection.foreign_key(str, drop_id_ubar);
335335
336336This function adds foreign key support to every String object.
337337
@@ -349,13 +349,13 @@ This function adds foreign key support to every String object.
349349
350350#### Example code
351351``` js
352- var inflection = require ( ' inflection' );
352+ var inflection = require (' inflection' );
353353
354- inflection .foreign_key ( ' MessageBusProperty' ); // === 'message_bus_property_id'
355- inflection .foreign_key ( ' MessageBusProperty' , true ); // === 'message_bus_propertyid'
354+ inflection .foreign_key (' MessageBusProperty' ); // === 'message_bus_property_id'
355+ inflection .foreign_key (' MessageBusProperty' , true ); // === 'message_bus_propertyid'
356356```
357357
358- ### inflection.ordinalize( str );
358+ ### inflection.ordinalize(str);
359359
360360This function adds ordinalize support to every String object.
361361
@@ -368,12 +368,12 @@ This function adds ordinalize support to every String object.
368368
369369#### Example code
370370``` js
371- var inflection = require ( ' inflection' );
371+ var inflection = require (' inflection' );
372372
373- inflection .ordinalize ( ' the 1 pitch' ); // === 'the 1st pitch'
373+ inflection .ordinalize (' the 1 pitch' ); // === 'the 1st pitch'
374374```
375375
376- ### inflection.transform( str, arr );
376+ ### inflection.transform(str, arr);
377377
378378This function performs multiple inflection methods on a string.
379379
@@ -391,9 +391,9 @@ This function performs multiple inflection methods on a string.
391391
392392#### Example code
393393``` js
394- var inflection = require ( ' inflection' );
394+ var inflection = require (' inflection' );
395395
396- inflection .transform ( ' all job' , [ ' pluralize' , ' capitalize' , ' dasherize' ]); // === 'All-jobs'
396+ inflection .transform (' all job' , [ ' pluralize' , ' capitalize' , ' dasherize' ]); // === 'All-jobs'
397397```
398398
399399## Credit
0 commit comments