camelize-identifier
v1.0.0
Published
Convert a string into a valid JS identifier
Downloads
10
Readme
camelize-identifier
Convert a string into a valid JS identifier
Installing
$ npm install camelize-identifier
API
camelize(name:String)
-> identifier:String
Given a name
, camelize
converts it to a camel cased JavaScript identifier. If name has a leading _
, it will be preserved. If the name
is a reserved word, begins with an illegal leading character (anything but a letter, $
, or _
), contains illegal characters (e.g. !
), camelize
will throw.
For a full set of handled cases, see the tests.