https://github.com/iobaixas/angular-inflector
Angular inflection service.
https://github.com/iobaixas/angular-inflector
angular inflector-functions javascript
Last synced: 6 months ago
JSON representation
Angular inflection service.
- Host: GitHub
- URL: https://github.com/iobaixas/angular-inflector
- Owner: iobaixas
- License: mit
- Created: 2013-12-09T19:03:58.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T18:44:49.000Z (over 8 years ago)
- Last Synced: 2025-08-17T13:30:47.920Z (8 months ago)
- Topics: angular, inflector-functions, javascript
- Language: JavaScript
- Size: 28.3 KB
- Stars: 17
- Watchers: 0
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Platanus Angular Inflector Utilities [](https://travis-ci.org/iobaixas/angular-inflector)
===============
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
```javascript
angular.module('platanus.inflector')
```
## Usage
This library registers the `inflector` service, the following methods are provided by the service.
```html
inflector.camelize('the-snake'); // should output theSnake
inflector.camelize('the-snake', true); // should output TheSnake
inflector.parameterize('TheCamel'); // should output the-camel
inflector.parameterize('TheCamel', '_'); // should output the_camel
inflector.dasherize('the_snake'); // should output the-snake
inflector.dasherize('the_snake', '&'); // should output the&snake
inflector.pluralize('index'); // should output indexes
inflector.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](https://code.google.com/p/inflection-js/source/browse/trunk/inflection.js).
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!**