or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-lodash-kebabcase

The lodash method kebabCase exported as a standalone Node.js module for converting strings to kebab-case format

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/lodash.kebabcase@4.1.x

To install, run

npx @tessl/cli install tessl/npm-lodash-kebabcase@4.1.0

index.mddocs/

Lodash Kebab Case

The lodash method kebabCase exported as a standalone Node.js module for converting strings to kebab-case format. It transforms strings to kebab case by splitting words on boundaries (camelCase, PascalCase, snake_case, spaces, etc.) and joining them with hyphens in lowercase.

Package Information

  • Package Name: lodash.kebabcase
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install lodash.kebabcase

Core Imports

var kebabCase = require('lodash.kebabcase');

The module exports the kebabCase function as the default export.

Basic Usage

var kebabCase = require('lodash.kebabcase');

// Convert different string formats to kebab-case
console.log(kebabCase('Foo Bar'));      // => 'foo-bar'
console.log(kebabCase('fooBar'));       // => 'foo-bar'
console.log(kebabCase('__FOO_BAR__'));  // => 'foo-bar'
console.log(kebabCase('XMLHttpRequest')); // => 'xml-http-request'

Capabilities

String to Kebab Case Conversion

Converts strings to kebab case by splitting words and joining them with hyphens in lowercase.

/**
 * Converts string to kebab case
 * @param {string} [string=''] - The string to convert
 * @returns {string} Returns the kebab cased string
 */
function kebabCase(string = '')

Examples:

kebabCase('Foo Bar');
// => 'foo-bar'

kebabCase('fooBar');
// => 'foo-bar'

kebabCase('__FOO_BAR__');
// => 'foo-bar'

kebabCase('XMLHttpRequest');
// => 'xml-http-request'

kebabCase('hello world 123');
// => 'hello-world-123'

kebabCase('camelCaseString');
// => 'camel-case-string'

kebabCase('PascalCaseString');
// => 'pascal-case-string'

kebabCase('snake_case_string');
// => 'snake-case-string'

kebabCase('  Multiple   Spaces  ');
// => 'multiple-spaces'

kebabCase('Special-Characters!@#');
// => 'special-characters'

kebabCase('unicode-café');
// => 'unicode-cafe'

kebabCase('');
// => ''

kebabCase();
// => ''