js-convert-case
js-convert-case copied to clipboard
Possible to convert an array directly?
Just discovered that I'm unable to convert an array unfortunately.
const data = [
{ id: 1, user_id: 1, created_at: '2021-07-20T15:40:20.170121+00:00'},
{id: 2, user_id: 2, created_at: '2021-07-20T15:40:20.170121+00:00'},
];
const response = camelKeys(data, {
recursive: true,
recursiveInArray: true,
});
console.log(response); // returns null
Are there any plans to allow for this feature?
Hi @jimmiejackson414,
Sorry for the late reply. For your case, since your data type is structured, a workaround can be as follows
const response = data.map(x => camelKeys(x))