toKebabCase

Commons
stable

Convert any string (camelCase, PascalCase, etc.) to kebab-case by replacing non-alpha characters with hyphens and inserting a hyphen before each uppercase letter. Results are cached for performance.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

str
string
''
The input string to convert. Defaults to an empty string when omitted.

API

Valeur de retour

La valeur retournée par cet util.

A lowercase, hyphen-separated string. Results are memoised in an internal Map so repeated calls with the same input are O(1).

Usage

Exemples

Extraits de code prêts à coller.

Convert different case conventions

typescript