The value to be converted to camelCased string
Optional
upperFirst: booleanOptionally, uppercase the first character of the first word, so when true
this will produce a Pascal Cased result.
The camelCased
version of the provided value.
strCamelCase(null); // "null"
strCamelCase(undefined); // "undefined"
strCamelCase("hello darkness"); // "helloDarkness"
strCamelCase("hello_darkness"); // "helloDarkness"
strCamelCase("_hello_darkness"); // "helloDarkness"
strCamelCase("hello-darkness"); // "helloDarkness"
strCamelCase("-hello-darkness"); // "helloDarkness"
strCamelCase("hello darkness, my old friend."); // "helloDarknessMyOldFriend"
// Uppercase first character
strCamelCase("hello darkness", true); // "HelloDarkness"
strCamelCase("hello_darkness", true); // "HelloDarkness"
strCamelCase("_hello_darkness", true); // "HelloDarkness"
strCamelCase("hello-darkness", true); // "HelloDarkness"
strCamelCase("-hello-darkness", true); // "HelloDarkness"
strCamelCase("hello darkness, my old friend.", true); // "HelloDarknessMyOldFriend"
Convert the provided value to
camelCased
string, you can optionally specifify whether the first caracter is upper cased (lowercase by default)from kebab-
or snake_
case. All whitespace characters are removed If the value is not a string it will be converted.