The value to be converted to kebab-case string
Optional
scream: booleanOptionally return the result as UpperCase (Screaming).
The kebab-cased
version of the provided value
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-"
Convert the provided value to
kebab-cased
string, you can optionally specify whther the result is all uppercased by passingtrue
as the optionalscream
argument, otherwise the entire result will be lowercased. If the value is not a string it will be converted.