Platanus Angular Inflector Utilities
Small suite of inflector functions, hopefully this lib will no longer be needed when angular makes the inflector functions they use part of the public api.
Installation:
Optional Use bower to retrieve package
bower install angular-inflector --save
Include angular module
angular
Usage
This library registers the inflector
service, the following methods are provided by the service.
inflector.camelize('the-snake'); // should output theSnakeinflector.camelize('the-snake', true); // should output TheSnakeinflector.parameterize('TheCamel'); // should output the-camelinflector.parameterize('TheCamel', '_'); // should output the_camelinflector.dasherize('the_snake'); // should output the-snakeinflector.dasherize('the_snake', '&'); // should output the&snakeinflector.pluralize('index'); // should output indexesinflector.singularize('mice'); // should output mouse
Credit for the general singularize and pluralize implementation and the english locale rules goes to Ryan Schuft with his ActiveSupport's Inflector port.
For now only the english transformation rules are included for the singularize
and pluralize
functions.
Contributed locales:
We thank the following developers for contributing with new locales rulesets:
- pt-BR: Daniel Fernando Lourusso
Contributions for new locale rules are very welcomed!