keysToSnakeCase (source code)
- Curried: false
- Failsafe status: failsafe by default
The keysToSnakeCase
function recursively converts the camel-cased object keys
to snake case.
object
: An object withcamelCase
keys.
keysToSnakeCase({
address: { city: "Miami", phoneNumber: "389791382" },
firstName: "Oliver",
lastName: "Smith",
});
/*
{
first_name: "Oliver",
last_name: "Smith",
address: { city: "Miami", phone_number: "389791382" },
}
*/