"classify" misleading #158

Closed
sleeper opened this Issue Nov 15, 2012 · 2 comments

Comments

Projects
None yet
4 participants
@sleeper

sleeper commented Nov 15, 2012

Hi,

It seems that classify is a misleading name. Reading the documentation the purpose of this class is to convert string to camelized class name (and if I understand correctly, to be used as a class name).

However, only the _ and space/tabs characters are removed from the original strings. Any other character will persist in the camelized name ... which is an issue if you intend to use the string as a class name:
e.g:

"my wonderfull class_name".classify() => "MyWonderfullClassName"
"my wonderfull.class.name".classify() => "MyWonderfull.Class.Name"

Would it be possible to prune other non-alphanum character ?
If yes I can prepare a PR.

@fotomut

This comment has been minimized.

Show comment Hide comment
@fotomut

fotomut Aug 2, 2013

I believe classify is STILL misleading. It doesn't seem to be keeping any camelCase that is already present in the string.

i.e.
'pagedListModuleName'.classify() returns 'Pagedlistmodulename'
but I would expect it to instead return 'PagedListModuleName'

in essence, I would think that classify is really just a wrapper for _(str).chain().camelize().capitalize().value()
Thoughts? Have I misread what classify is supposed to do?

fotomut commented Aug 2, 2013

I believe classify is STILL misleading. It doesn't seem to be keeping any camelCase that is already present in the string.

i.e.
'pagedListModuleName'.classify() returns 'Pagedlistmodulename'
but I would expect it to instead return 'PagedListModuleName'

in essence, I would think that classify is really just a wrapper for _(str).chain().camelize().capitalize().value()
Thoughts? Have I misread what classify is supposed to do?

@fotomut fotomut referenced this issue in yeoman/generator-angular Aug 2, 2013

Closed

use of _.classify() causes unintended results #301

@eddiemonge

This comment has been minimized.

Show comment Hide comment
@eddiemonge

eddiemonge Sep 16, 2013

Contributor

shouldnt the periods be allowed to signify subclasses?

Contributor

eddiemonge commented Sep 16, 2013

shouldnt the periods be allowed to signify subclasses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment