jpvanhal / inflection

A port of Ruby on Rails' inflector to Python
https://inflection.readthedocs.io
MIT License
495 stars 62 forks source link

Dasherize doesn’t work on CamelCase string #28

Closed batisteo closed 4 years ago

batisteo commented 6 years ago

Expected

>>> inflection.dasherize('ModelForm')
'model-form'

Getting:

>>> inflection.dasherize('ModelForm')
'ModelForm'
drozdvadym commented 5 years ago

As from docs:

Replace underscores with dashes in the string.

https://inflection.readthedocs.io/en/latest/#inflection.dasherize

jpvanhal commented 4 years ago

Yes, that is expected behavior. Use underscore to first convert the string to snake case:

>>> inflection.dasherize(inflection.underscore('ModelForm'))
'model-form'