Function strCamelCase

  • 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.

    Type Parameters

    • T

    Parameters

    • value: T

      The value to be converted to camelCased string

    • OptionalupperFirst: boolean

      Optionally, uppercase the first character of the first word, so when true this will produce a Pascal Cased result.

    Returns string

    The camelCased version of the provided value.

    0.9.0

    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"