mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(Transformers): do not transform Date objects (#8463)
This commit is contained in:
@@ -9,6 +9,7 @@ const snakeCase = require('lodash.snakecase');
|
||||
*/
|
||||
function toSnakeCase(obj) {
|
||||
if (typeof obj !== 'object' || !obj) return obj;
|
||||
if (obj instanceof Date) return obj;
|
||||
if (Array.isArray(obj)) return obj.map(toSnakeCase);
|
||||
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), toSnakeCase(value)]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user