Function: decamelize()
ts
function decamelize(text: string, options?: {
preserveConsecutiveUppercase?: boolean;
separator?: string;
}): string;Convert camelCase or PascalCase text to separated lowercase text.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Text to convert. |
options | { preserveConsecutiveUppercase?: boolean; separator?: string; } | Conversion options. |
options.preserveConsecutiveUppercase? | boolean | Whether consecutive uppercase runs keep their casing. Defaults to false. |
options.separator? | string | Separator inserted between words. Defaults to _. |
Returns
string
Converted text.
Remarks
When preserveConsecutiveUppercase is enabled, acronym runs such as URL keep their original casing unless the last uppercase letter starts the following lowercase word.