Function strKebabCase

  • Convert the provided value to kebab-cased string, you can optionally specify whther the result is all uppercased by passing true as the optional scream argument, otherwise the entire result will be lowercased. If the value is not a string it will be converted.

    Type Parameters

    • T

    Parameters

    • value: T

      The value to be converted to kebab-case string

    • Optional scream: boolean

      Optionally return the result as UpperCase (Screaming).

    Returns string

    The kebab-cased version of the provided value

    Since

    0.9.0

    Example

    strKebabCase(null);              // "null"
    strKebabCase(undefined); // "undefined"
    strKebabCase("hello darkness"); // "hello-darkness"
    strKebabCase("hello_darkness"); // "hello-darkness"
    strKebabCase("_hello_darkness"); // "-hello-darkness"
    strKebabCase("hello darkness, my old friend."); // "hello-darkness-my-old-friend-"

    // Add optional SCREAM flag
    strKebabCase("hello darkness", true); // "HELLO-DARKNESS"
    strKebabCase("hello_darkness", true); // "HELLO-DARKNESS"
    strKebabCase("_hello_darkness", true); // "-HELLO-DARKNESS"
    strKebabCase("hello darkness, my old friend.", true); // "HELLO-DARKNESS-MY-OLD-FRIEND-"