@@ -25,9 +25,9 @@ Checkout [Meteor Inflector](https://github.com/katrotz/meteor-inflector) from [V
2525## Installation
2626
2727Install inflection through npm
28-
29- npm install inflection
30-
28+ ``` bash
29+ npm install inflection
30+ ```
3131## API
3232
3333- inflection.pluralize( str, plural );
@@ -50,7 +50,9 @@ Install inflection through npm
5050
5151> Require the module before using
5252
53- const inflection = require( 'inflection' );
53+ ``` js
54+ const inflection = require ( ' inflection' );
55+ ```
5456
5557### inflection.pluralize( str, plural );
5658
@@ -69,13 +71,14 @@ This function adds pluralization support to every String object.
6971 desc: Overrides normal output with said String.(optional)
7072
7173#### Example code
74+ ``` js
75+ var inflection = require ( ' inflection' );
7276
73- var inflection = require( 'inflection' );
74-
75- inflection.pluralize( 'person' ); // === 'people'
76- inflection.pluralize( 'octopus' ); // === "octopi"
77- inflection.pluralize( 'Hat' ); // === 'Hats'
78- 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'
81+ ```
7982
8083### inflection.singularize( str, singular );
8184
@@ -94,13 +97,14 @@ This function adds singularization support to every String object.
9497 desc: Overrides normal output with said String.(optional)
9598
9699#### Example code
100+ ``` js
101+ var inflection = require ( ' inflection' );
97102
98- var inflection = require( 'inflection' );
99-
100- inflection.singularize( 'people' ); // === 'person'
101- inflection.singularize( 'octopi' ); // === "octopus"
102- inflection.singularize( 'Hats' ); // === 'Hat'
103- 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'
107+ ```
104108
105109### inflection.inflect( str, count, singular, plural );
106110
@@ -129,17 +133,18 @@ This function will pluralize or singularlize a String appropriately based on an
129133 desc: Overrides normal output with said String.(optional)
130134
131135#### Example code
132-
133- var inflection = require( 'inflection' );
134-
135- inflection.inflect( 'people', 1 ); // === 'person'
136- inflection.inflect( 'octopi', 1 ); // === 'octopus'
137- inflection.inflect( 'Hats', 1 ); // === 'Hat'
138- inflection.inflect( 'guys', 1 , 'person' ); // === 'person'
139- inflection.inflect( 'person', 2 ); // === 'people'
140- inflection.inflect( 'octopus', 2 ); // === 'octopi'
141- inflection.inflect( 'Hat', 2 ); // === 'Hats'
142- inflection.inflect( 'person', 2, null, 'guys' ); // === 'guys'
136+ ``` 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'
147+ ```
143148
144149### inflection.camelize( str, low_first_letter );
145150
@@ -158,11 +163,12 @@ This function transforms String object from underscore to camelcase.
158163 desc: Default is to capitalize the first letter of the results. Passing true will lowercase it. (optional)
159164
160165#### Example code
166+ ``` js
167+ var inflection = require ( ' inflection' );
161168
162- var inflection = require( 'inflection' );
163-
164- inflection.camelize( 'message_properties' ); // === 'MessageProperties'
165- inflection.camelize( 'message_properties', true ); // === 'messageProperties'
169+ inflection .camelize ( ' message_properties' ); // === 'MessageProperties'
170+ inflection .camelize ( ' message_properties' , true ); // === 'messageProperties'
171+ ```
166172
167173### inflection.underscore( str, all_upper_case );
168174
@@ -181,13 +187,14 @@ This function transforms String object from camelcase to underscore.
181187 desc: Default is to lowercase and add underscore prefix
182188
183189#### Example code
190+ ``` js
191+ var inflection = require ( ' inflection' );
184192
185- var inflection = require( 'inflection' );
186-
187- inflection.underscore( 'MessageProperties' ); // === 'message_properties'
188- inflection.underscore( 'messageProperties' ); // === 'message_properties'
189- inflection.underscore( 'MP' ); // === 'm_p'
190- 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'
197+ ```
191198
192199### inflection.humanize( str, low_first_letter );
193200
@@ -206,11 +213,12 @@ This function adds humanize support to every String object.
206213 desc: Default is to capitalize the first letter of the results. Passing true will lowercase it. (optional)
207214
208215#### Example code
216+ ``` js
217+ var inflection = require ( ' inflection' );
209218
210- var inflection = require( 'inflection' );
211-
212- inflection.humanize( 'message_properties' ); // === 'Message properties'
213- inflection.humanize( 'message_properties', true ); // === 'message properties'
219+ inflection .humanize ( ' message_properties' ); // === 'Message properties'
220+ inflection .humanize ( ' message_properties' , true ); // === 'message properties'
221+ ```
214222
215223### inflection.capitalize( str );
216224
@@ -224,11 +232,12 @@ This function adds capitalization support to every String object.
224232 desc: The subject string.
225233
226234#### Example code
235+ ``` js
236+ var inflection = require ( ' inflection' );
227237
228- var inflection = require( 'inflection' );
229-
230- inflection.capitalize( 'message_properties' ); // === 'Message_properties'
231- inflection.capitalize( 'message properties', true ); // === 'Message properties'
238+ inflection .capitalize ( ' message_properties' ); // === 'Message_properties'
239+ inflection .capitalize ( ' message properties' , true ); // === 'Message properties'
240+ ```
232241
233242### inflection.dasherize( str );
234243
@@ -242,11 +251,12 @@ This function replaces underscores with dashes in the string.
242251 desc: The subject string.
243252
244253#### Example code
254+ ``` js
255+ var inflection = require ( ' inflection' );
245256
246- var inflection = require( 'inflection' );
247-
248- inflection.dasherize( 'message_properties' ); // === 'message-properties'
249- inflection.dasherize( 'Message Properties' ); // === 'Message-Properties'
257+ inflection .dasherize ( ' message_properties' ); // === 'message-properties'
258+ inflection .dasherize ( ' Message Properties' ); // === 'Message-Properties'
259+ ```
250260
251261### inflection.titleize( str );
252262
@@ -260,11 +270,12 @@ This function adds titleize support to every String object.
260270 desc: The subject string.
261271
262272#### Example code
273+ ``` js
274+ var inflection = require ( ' inflection' );
263275
264- var inflection = require( 'inflection' );
265-
266- inflection.titleize( 'message_properties' ); // === 'Message Properties'
267- 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'
278+ ```
268279
269280### inflection.demodulize( str );
270281
@@ -278,10 +289,11 @@ This function adds demodulize support to every String object.
278289 desc: The subject string.
279290
280291#### Example code
292+ ``` js
293+ var inflection = require ( ' inflection' );
281294
282- var inflection = require( 'inflection' );
283-
284- inflection.demodulize( 'Message::Bus::Properties' ); // === 'Properties'
295+ inflection .demodulize ( ' Message::Bus::Properties' ); // === 'Properties'
296+ ```
285297
286298### inflection.tableize( str );
287299
@@ -295,10 +307,11 @@ This function adds tableize support to every String object.
295307 desc: The subject string.
296308
297309#### Example code
310+ ``` js
311+ var inflection = require ( ' inflection' );
298312
299- var inflection = require( 'inflection' );
300-
301- inflection.tableize( 'MessageBusProperty' ); // === 'message_bus_properties'
313+ inflection .tableize ( ' MessageBusProperty' ); // === 'message_bus_properties'
314+ ```
302315
303316### inflection.classify( str );
304317
@@ -312,10 +325,11 @@ This function adds classification support to every String object.
312325 desc: The subject string.
313326
314327#### Example code
328+ ``` js
329+ var inflection = require ( ' inflection' );
315330
316- var inflection = require( 'inflection' );
317-
318- inflection.classify( 'message_bus_properties' ); // === 'MessageBusProperty'
331+ inflection .classify ( ' message_bus_properties' ); // === 'MessageBusProperty'
332+ ```
319333
320334### inflection.foreign_key( str, drop_id_ubar );
321335
@@ -334,11 +348,12 @@ This function adds foreign key support to every String object.
334348 desc: Default is to seperate id with an underbar at the end of the class name, you can pass true to skip it.(optional)
335349
336350#### Example code
351+ ``` js
352+ var inflection = require ( ' inflection' );
337353
338- var inflection = require( 'inflection' );
339-
340- inflection.foreign_key( 'MessageBusProperty' ); // === 'message_bus_property_id'
341- 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'
356+ ```
342357
343358### inflection.ordinalize( str );
344359
@@ -352,10 +367,11 @@ This function adds ordinalize support to every String object.
352367 desc: The subject string.
353368
354369#### Example code
370+ ``` js
371+ var inflection = require ( ' inflection' );
355372
356- var inflection = require( 'inflection' );
357-
358- inflection.ordinalize( 'the 1 pitch' ); // === 'the 1st pitch'
373+ inflection .ordinalize ( ' the 1 pitch' ); // === 'the 1st pitch'
374+ ```
359375
360376### inflection.transform( str, arr );
361377
@@ -374,10 +390,11 @@ This function performs multiple inflection methods on a string.
374390 desc: An array of inflection methods.
375391
376392#### Example code
393+ ``` js
394+ var inflection = require ( ' inflection' );
377395
378- var inflection = require( 'inflection' );
379-
380- inflection.transform( 'all job', [ 'pluralize', 'capitalize', 'dasherize' ]); // === 'All-jobs'
396+ inflection .transform ( ' all job' , [ ' pluralize' , ' capitalize' , ' dasherize' ]); // === 'All-jobs'
397+ ```
381398
382399## Credit
383400
0 commit comments