@@ -30,21 +30,21 @@ 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+ - [ pluralize(str, plural)] ( #pluralizestr-plural )
34+ - [ singularize(str, singular)] ( #singularizestr-singular )
35+ - [ inflect(str, count, singular, plural)] ( #inflectstr-count-singular-plural )
36+ - [ camelize(str, low_first_letter)] ( #camelizestr-low_first_letter )
37+ - [ underscore(str, all_upper_case)] ( #underscorestr-all_upper_case )
38+ - [ humanize(str, low_first_letter)] ( #humanizestr-low_first_letter )
39+ - [ capitalize(str)] ( #capitalizestr )
40+ - [ dasherize(str)] ( #dasherizestr )
41+ - [ titleize(str)] ( #titleizestr )
42+ - [ demodulize(str)] ( #demodulizestr )
43+ - [ tableize(str)] ( #tableizestr )
44+ - [ classify(str)] ( #classifystr )
45+ - [ foreign_key(str, drop_id_ubar)] ( #foreign_keystr-drop_id_ubar )
46+ - [ ordinalize(str)] ( #ordinalizestr )
47+ - [ transform(str, arr)] ( #transformstr-arr )
4848
4949## Usage
5050
@@ -54,7 +54,7 @@ npm install inflection
5454const inflection = require (' inflection' );
5555```
5656
57- ### inflection. pluralize(str, plural);
57+ ### pluralize(str, plural)
5858
5959This function adds pluralization support to every String object.
6060
@@ -74,13 +74,13 @@ This function adds pluralization support to every String object.
7474``` js
7575var 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+ pluralize (' person' ); // === 'people'
78+ pluralize (' octopus' ); // === "octopi"
79+ pluralize (' Hat' ); // === 'Hats'
80+ pluralize (' person' , ' guys' ); // === 'guys'
8181```
8282
83- ### inflection. singularize(str, singular);
83+ ### singularize(str, singular)
8484
8585This function adds singularization support to every String object.
8686
@@ -100,13 +100,13 @@ This function adds singularization support to every String object.
100100``` js
101101var 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+ singularize (' people' ); // === 'person'
104+ singularize (' octopi' ); // === "octopus"
105+ singularize (' Hats' ); // === 'Hat'
106+ singularize (' guys' , ' person' ); // === 'person'
107107```
108108
109- ### inflection. inflect(str, count, singular, plural);
109+ ### inflect(str, count, singular, plural)
110110
111111This function will pluralize or singularlize a String appropriately based on an integer value.
112112
@@ -136,17 +136,17 @@ This function will pluralize or singularlize a String appropriately based on an
136136``` js
137137var inflection = require (' inflection' );
138138
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'
139+ inflect (' people' , 1 ); // === 'person'
140+ inflect (' octopi' , 1 ); // === 'octopus'
141+ inflect (' Hats' , 1 ); // === 'Hat'
142+ inflect (' guys' , 1 , ' person' ); // === 'person'
143+ inflect (' person' , 2 ); // === 'people'
144+ inflect (' octopus' , 2 ); // === 'octopi'
145+ inflect (' Hat' , 2 ); // === 'Hats'
146+ inflect (' person' , 2 , null , ' guys' ); // === 'guys'
147147```
148148
149- ### inflection. camelize(str, low_first_letter);
149+ ### camelize(str, low_first_letter)
150150
151151This function transforms String object from underscore to camelcase.
152152
@@ -166,11 +166,11 @@ This function transforms String object from underscore to camelcase.
166166``` js
167167var inflection = require (' inflection' );
168168
169- inflection . camelize (' message_properties' ); // === 'MessageProperties'
170- inflection . camelize (' message_properties' , true ); // === 'messageProperties'
169+ camelize (' message_properties' ); // === 'MessageProperties'
170+ camelize (' message_properties' , true ); // === 'messageProperties'
171171```
172172
173- ### inflection. underscore(str, all_upper_case);
173+ ### underscore(str, all_upper_case)
174174
175175This function transforms String object from camelcase to underscore.
176176
@@ -190,13 +190,13 @@ This function transforms String object from camelcase to underscore.
190190``` js
191191var 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+ underscore (' MessageProperties' ); // === 'message_properties'
194+ underscore (' messageProperties' ); // === 'message_properties'
195+ underscore (' MP' ); // === 'm_p'
196+ underscore (' MP' , true ); // === 'MP'
197197```
198198
199- ### inflection. humanize(str, low_first_letter);
199+ ### humanize(str, low_first_letter)
200200
201201This function adds humanize support to every String object.
202202
@@ -216,11 +216,11 @@ This function adds humanize support to every String object.
216216``` js
217217var inflection = require (' inflection' );
218218
219- inflection . humanize (' message_properties' ); // === 'Message properties'
220- inflection . humanize (' message_properties' , true ); // === 'message properties'
219+ humanize (' message_properties' ); // === 'Message properties'
220+ humanize (' message_properties' , true ); // === 'message properties'
221221```
222222
223- ### inflection. capitalize(str);
223+ ### capitalize(str)
224224
225225This function adds capitalization support to every String object.
226226
@@ -235,11 +235,11 @@ This function adds capitalization support to every String object.
235235``` js
236236var inflection = require (' inflection' );
237237
238- inflection . capitalize (' message_properties' ); // === 'Message_properties'
239- inflection . capitalize (' message properties' , true ); // === 'Message properties'
238+ capitalize (' message_properties' ); // === 'Message_properties'
239+ capitalize (' message properties' , true ); // === 'Message properties'
240240```
241241
242- ### inflection. dasherize(str);
242+ ### dasherize(str)
243243
244244This function replaces underscores with dashes in the string.
245245
@@ -254,11 +254,11 @@ This function replaces underscores with dashes in the string.
254254``` js
255255var inflection = require (' inflection' );
256256
257- inflection . dasherize (' message_properties' ); // === 'message-properties'
258- inflection . dasherize (' Message Properties' ); // === 'Message-Properties'
257+ dasherize (' message_properties' ); // === 'message-properties'
258+ dasherize (' Message Properties' ); // === 'Message-Properties'
259259```
260260
261- ### inflection. titleize(str);
261+ ### titleize(str)
262262
263263This function adds titleize support to every String object.
264264
@@ -273,11 +273,11 @@ This function adds titleize support to every String object.
273273``` js
274274var inflection = require (' inflection' );
275275
276- inflection . titleize (' message_properties' ); // === 'Message Properties'
277- inflection . titleize (' message properties to keep' ); // === 'Message Properties to Keep'
276+ titleize (' message_properties' ); // === 'Message Properties'
277+ titleize (' message properties to keep' ); // === 'Message Properties to Keep'
278278```
279279
280- ### inflection. demodulize(str);
280+ ### demodulize(str)
281281
282282This function adds demodulize support to every String object.
283283
@@ -292,10 +292,10 @@ This function adds demodulize support to every String object.
292292``` js
293293var inflection = require (' inflection' );
294294
295- inflection . demodulize (' Message::Bus::Properties' ); // === 'Properties'
295+ demodulize (' Message::Bus::Properties' ); // === 'Properties'
296296```
297297
298- ### inflection. tableize(str);
298+ ### tableize(str)
299299
300300This function adds tableize support to every String object.
301301
@@ -310,10 +310,10 @@ This function adds tableize support to every String object.
310310``` js
311311var inflection = require (' inflection' );
312312
313- inflection . tableize (' MessageBusProperty' ); // === 'message_bus_properties'
313+ tableize (' MessageBusProperty' ); // === 'message_bus_properties'
314314```
315315
316- ### inflection. classify(str);
316+ ### classify(str)
317317
318318This function adds classification support to every String object.
319319
@@ -328,10 +328,10 @@ This function adds classification support to every String object.
328328``` js
329329var inflection = require (' inflection' );
330330
331- inflection . classify (' message_bus_properties' ); // === 'MessageBusProperty'
331+ classify (' message_bus_properties' ); // === 'MessageBusProperty'
332332```
333333
334- ### inflection. foreign_key(str, drop_id_ubar);
334+ ### foreign_key(str, drop_id_ubar)
335335
336336This function adds foreign key support to every String object.
337337
@@ -351,11 +351,11 @@ This function adds foreign key support to every String object.
351351``` js
352352var inflection = require (' inflection' );
353353
354- inflection . foreign_key (' MessageBusProperty' ); // === 'message_bus_property_id'
355- inflection . foreign_key (' MessageBusProperty' , true ); // === 'message_bus_propertyid'
354+ foreign_key (' MessageBusProperty' ); // === 'message_bus_property_id'
355+ foreign_key (' MessageBusProperty' , true ); // === 'message_bus_propertyid'
356356```
357357
358- ### inflection. ordinalize(str);
358+ ### ordinalize(str)
359359
360360This function adds ordinalize support to every String object.
361361
@@ -370,10 +370,10 @@ This function adds ordinalize support to every String object.
370370``` js
371371var inflection = require (' inflection' );
372372
373- inflection . ordinalize (' the 1 pitch' ); // === 'the 1st pitch'
373+ ordinalize (' the 1 pitch' ); // === 'the 1st pitch'
374374```
375375
376- ### inflection. transform(str, arr);
376+ ### transform(str, arr)
377377
378378This function performs multiple inflection methods on a string.
379379
@@ -393,7 +393,7 @@ This function performs multiple inflection methods on a string.
393393``` js
394394var inflection = require (' inflection' );
395395
396- inflection . transform (' all job' , [ ' pluralize' , ' capitalize' , ' dasherize' ]); // === 'All-jobs'
396+ transform (' all job' , [ ' pluralize' , ' capitalize' , ' dasherize' ]); // === 'All-jobs'
397397```
398398
399399## Credit
0 commit comments