kebabcase

Convert a string to kebab case.

Usage

var kebabcase = require( '@stdlib/string/base/kebabcase' );

kebabcase( str )

Converts a string to kebab case.

var str = kebabcase( 'Foo Bar' );
// returns 'foo-bar'

str = kebabcase( 'I am a tiny little house' );
// returns 'i-am-a-tiny-little-house'

str = kebabcase( 'Hello World!' );
// returns 'hello-world'

Examples

var kebabcase = require( '@stdlib/string/base/kebabcase' );

var str = 'foo bar baz';
var out = kebabcase( str );
// returns 'foo-bar-baz'

str = 'foo_baz';
out = kebabcase( str );
// returns 'foo-baz'

str = 'foo-bar-baz!';
out = kebabcase( str );
// returns 'foo-bar-baz'

str = 'beep    boop!';
out = kebabcase( str );
// returns 'beep-boop'

str = 'foo-baz';
out = kebabcase( str );
// returns 'foo-baz'

str = 'Welcome! ๐Ÿ˜€';
out = kebabcase( str );
// returns 'welcome-๐Ÿ˜€'
Did you find this page helpful?