+9
-1
lines changedFilter options
+9
-1
lines changed Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
const { isJSONEncodable } = require('@discordjs/util');
4
4
const snakeCase = require('lodash.snakecase');
5
+
const { resolvePartialEmoji } = require('./Util');
5
6
6
7
/**
7
8
* Transforms camel-cased keys into snake cased keys
@@ -13,7 +14,14 @@ function toSnakeCase(obj) {
13
14
if (obj instanceof Date) return obj;
14
15
if (isJSONEncodable(obj)) return toSnakeCase(obj.toJSON());
15
16
if (Array.isArray(obj)) return obj.map(toSnakeCase);
16
-
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), toSnakeCase(value)]));
17
+
return Object.fromEntries(
18
+
Object.entries(obj).map(([key, value]) => [
19
+
snakeCase(key),
20
+
// TODO: The special handling of 'emoji' is just a temporary fix for v14, will be dropped in v15.
21
+
// See https://github.com/discordjs/discord.js/issues/10909
22
+
key === 'emoji' && typeof value === 'string' ? resolvePartialEmoji(value) : toSnakeCase(value),
23
+
]),
24
+
);
17
25
}
18
26
19
27
/**
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4