constantCase es-toolkit
Converts a string to constant case.
Usage
constantCase(str)
Use constantCase when you want to convert a string to constant case. Constant case is a naming convention where all characters are uppercase and words are separated by underscores (_).
It's a commonly used naming convention when defining constants in JavaScript or other programming languages.
It also properly handles strings with spaces or special characters.
Parameters
strstringrequired
The string to convert to constant case.
Returns
Returns a new string converted to constant case.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.