toConstantCaseKeys es-toolkit
Returns a new object with all keys in objects and arrays converted to CONSTANT_CASE.
Constant case is a naming convention where each word in an identifier is written in uppercase and connected with underscores (_). For example, it's written as CONSTANT_CASE.
Usage
toConstantCaseKeys(obj)
Use toConstantCaseKeys when you want to convert all keys of an object to CONSTANT_CASE. Nested objects and objects within arrays are also converted recursively.
For example, object keys are converted as follows:
camelCase→CONSTANT_CASE(e.g.userId→USER_ID)PascalCase→CONSTANT_CASE(e.g.UserId→USER_ID)snake_case→CONSTANT_CASE(e.g.first_name→FIRST_NAME,last→LAST)
Parameters
The object, array, or primitive value to convert keys to CONSTANT_CASE.
Returns
Returns a new object with all keys 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.