Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / i / README.md
1 # inflect
2
3 customizable inflections for nodejs
4
5 **NOTE: 0.3.2 was accidentally unpublished from the server and npm doesn't allow me to publish it back. Please upgrade to 0.3.3**
6
7 ## Installation
8
9 ```bash
10 npm install i
11 ```
12
13 ## Usage
14
15 Require the module before using
16
17 ```js
18 var inflect = require('i')();
19 ```
20
21 All the below api functions can be called directly on a string
22
23 ```js
24 inflect.titleize('messages to store') // === 'Messages To Store'
25 'messages to store'.titleize // === 'Messages To Store'
26 ```
27
28 only if `true` is passed while initiating
29
30 ```js
31 var inflect = require('i')(true);
32 ```
33
34 ### Pluralize
35
36 ```js
37 inflect.pluralize('person'); // === 'people'
38 inflect.pluralize('octopus'); // === 'octopi'
39 inflect.pluralize('Hat'); // === 'Hats'
40 ```
41
42 ### Singularize
43
44 ```js
45 inflect.singularize('people'); // === 'person'
46 inflect.singularize('octopi'); // === 'octopus'
47 inflect.singularize('Hats'); // === 'Hat'
48 ```
49
50 ### Camelize
51
52 ```js
53 inflect.camelize('message_properties'); // === 'MessageProperties'
54 inflect.camelize('message_properties', false); // === 'messageProperties'
55 ```
56
57 ### Underscore
58
59 ```js
60 inflect.underscore('MessageProperties'); // === 'message_properties'
61 inflect.underscore('messageProperties'); // === 'message_properties'
62 ```
63
64 ### Humanize
65
66 ```js
67 inflect.humanize('message_id'); // === 'Message'
68 ```
69
70 ### Dasherize
71
72 ```js
73 inflect.dasherize('message_properties'); // === 'message-properties'
74 inflect.dasherize('Message Properties'); // === 'Message Properties'
75 ```
76
77 ### Titleize
78
79 ```js
80 inflect.titleize('message_properties'); // === 'Message Properties'
81 inflect.titleize('message properties to keep'); // === 'Message Properties to Keep'
82 ```
83
84 ### Demodulize
85
86 ```js
87 inflect.demodulize('Message.Bus.Properties'); // === 'Properties'
88 ```
89
90 ### Tableize
91
92 ```js
93 inflect.tableize('MessageBusProperty'); // === 'message_bus_properties'
94 ```
95
96 ### Classify
97
98 ```js
99 inflect.classify('message_bus_properties'); // === 'MessageBusProperty'
100 ```
101
102 ### Foreign key
103
104 ```js
105 inflect.foreign_key('MessageBusProperty'); // === 'message_bus_property_id'
106 inflect.foreign_key('MessageBusProperty', false); // === 'message_bus_propertyid'
107 ```
108
109 ### Ordinalize
110
111 ```js
112 inflect.ordinalize( '1' ); // === '1st'
113 ```
114
115 ## Custom rules for inflection
116
117 ### Custom plural
118
119 We can use regexp in any of these custom rules
120
121 ```js
122 inflect.inflections.plural('person', 'guys');
123 inflect.pluralize('person'); // === 'guys'
124 inflect.singularize('guys'); // === 'guy'
125 ```
126
127 ### Custom singular
128
129 ```js
130 inflect.inflections.singular('guys', 'person')
131 inflect.singularize('guys'); // === 'person'
132 inflect.pluralize('person'); // === 'people'
133 ```
134
135 ### Custom irregular
136
137 ```js
138 inflect.inflections.irregular('person', 'guys')
139 inflect.pluralize('person'); // === 'guys'
140 inflect.singularize('guys'); // === 'person'
141 ```
142
143 ### Custom human
144
145 ```js
146 inflect.inflections.human(/^(.*)_cnt$/i, '$1_count');
147 inflect.inflections.humanize('jargon_cnt'); // === 'Jargon count'
148 ```
149
150 ### Custom uncountable
151
152 ```js
153 inflect.inflections.uncountable('oil')
154 inflect.pluralize('oil'); // === 'oil'
155 inflect.singularize('oil'); // === 'oil'
156 ```
157
158 ## Contributors
159 Here is a list of [Contributors](http://github.com/pksunkara/inflect/contributors)
160
161 ### TODO
162
163 - More obscure test cases
164
165 __I accept pull requests and guarantee a reply back within a day__
166
167 ## License
168 MIT/X11
169
170 ## Bug Reports
171 Report [here](http://github.com/pksunkara/inflect/issues). __Guaranteed reply within a day__.
172
173 ## Contact
174 Pavan Kumar Sunkara (pavan.sss1991@gmail.com)
175
176 Follow me on [github](https://github.com/users/follow?target=pksunkara), [twitter](http://twitter.com/pksunkara)