Skip to content

Commit

Permalink
fix(Transformers): do not transform Date objects (#8463)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed Aug 10, 2022
1 parent 0fab869 commit 0e2a095
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/discord.js/src/util/Transformers.js
Expand Up @@ -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)]));
}
Expand Down

0 comments on commit 0e2a095

Please sign in to comment.