Function hyphenate

  • Hyphenates camel-cased string.

    Applicable to CSS property names.

    Converts:

    • backgroundColor to background-color.

      Uppercase letters converted to lower case and prepended by hyphen,

    • MozTransition to -moz-transition.

      The very first uppercase letter is prepended by hyphen too.

    • MSTransition to -ms-transition.

      Subsequent upper-case letters converted to lower case. The first and the last ones prepended by hyphen.

    • someURL to some-url

      Subsequent upper-case letters in the very end of the string converted to lower case and prepended by hyphen.

    • color to color.

      All lower-case names remain as is.

    • padding-left to padding-left

    The leading upper-case letter is not prepended by hyphen. Thus, e.g. MozTransition would be converted to moz-transition rather to -moz-transition.

    Parameters

    • input: string

      Camel-cased input to hyphenate.

    Returns string

    Hyphenated name.

Generated using TypeDoc