INFLECTOR-JS
Inflector pluralizes and singularizes English nouns. It also contains some other useful methods.
Download
NPM
npm install inflector-js --save
BOWER
bower install inflector-js --save
or download here
How to use
Node JS
var Inflector = require('inflector-js')
RequireJS
define(['bower_components/inflector-js/index'], function(Inflector) {
});
Manual
<script type="text/javascript" src="bower_components/inflector-js/index.js"></script>
API
Inflector.pluralize('person') -> 'people'
Inflector.pluralize('octopus') -> 'octopi'
Inflector.pluralize('Hat') -> 'Hats'
Inflector.pluralize('person', 'guys') -> 'guys'
Inflector.singularize('person') -> 'person'
Inflector.singularize('octopi') -> 'octopus'
Inflector.singularize('hats') -> 'hat'
Inflector.singularize('guys', 'person') -> 'person'
Inflector.camelize('message_properties') -> 'MessageProperties'
Inflector.camelize('message_properties', true) -> 'messageProperties'
Inflector.underscore('MessageProperties') -> 'message_properties'
Inflector.underscore('messageProperties') -> 'message_properties'
Inflector.humanize('message_properties') -> 'Message properties'
Inflector.humanize('message_properties') -> 'message properties'
Inflector.capitalize('message_properties') -> 'Message_properties'
Inflector.capitalize('message properties') -> 'Message properties'
Inflector.dasherize('message_properties') -> 'message-properties'
Inflector.dasherize('message properties') -> 'message-properties'
Inflector.camel2words('message_properties') -> 'Message Properties'
Inflector.camel2words('message properties') -> 'Message Properties'
Inflactor.camel2words('Message_propertyId', true) -> 'Message Properties Id'
Inflector.demodulize('Message::Bus::Properties') -> 'Properties'
Inflector.tableize('MessageBusProperty') -> 'message_bus_properties'
Inflector.classify('message_bus_properties') -> 'MessageBusProperty'
Inflector.foreignKey('MessageBusProperty') -> 'message_bus_property_id'
Inflector.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'
Inflector.ordinalize('the 1 pitch') -> 'the 1st pitch'