Skip to content
Elixir module to singularize and pluralize nouns
Elixir
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config init Mar 21, 2017
lib
test renamed due to hex conflict Apr 9, 2017
.gitignore init Mar 21, 2017
.travis.yml added script section Apr 9, 2017
LICENSE Create LICENSE Mar 25, 2017
README.md added language to the code snippet in the readme Apr 24, 2017
mix.exs pushing new version Apr 24, 2017
mix.lock renamed due to hex conflict Apr 9, 2017

README.md

Inflectorex

Build Status

Inflectorex pluralizes and singularizes English nouns.

Usage

Inflectorex.singularize("workers") # will give "worker"

Inflectorex.pluralize("secret") # will give "secrets"

Extending the regex lists

Currently the application has 4 regex lists. You can extend these lists using the config block. To extend each of the lists the keys are as follows -

  • @plural_regexps - plural
  • @singular_regexps - singular
  • @singular_uninflected - singular_uninflected
  • @plural_uninflected - plural_uninflected

Note - right is the key

Example config

config  :inflectorex, plural: [
    {~r/developer/ , "developers"},
    {~r/elixir/, "elixirs"}
]  

Todo

  • Implement caching
  • Error handling
  • code commenting
  • tests
  • publishing to hex.pm

Credits

  • CakePHP's inflector
  • degex/inflector

License

MIT

You can’t perform that action at this time.