mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
fix(Util): support empty array for flatten (#4590)
This commit is contained in:
@@ -24,12 +24,11 @@ class Util {
|
|||||||
static flatten(obj, ...props) {
|
static flatten(obj, ...props) {
|
||||||
if (!isObject(obj)) return obj;
|
if (!isObject(obj)) return obj;
|
||||||
|
|
||||||
props = Object.assign(
|
const objProps = Object.keys(obj)
|
||||||
...Object.keys(obj)
|
.filter(k => !k.startsWith('_'))
|
||||||
.filter(k => !k.startsWith('_'))
|
.map(k => ({ [k]: true }));
|
||||||
.map(k => ({ [k]: true })),
|
|
||||||
...props,
|
props = objProps.length ? Object.assign(...objProps, ...props) : Object.assign({}, ...props);
|
||||||
);
|
|
||||||
|
|
||||||
const out = {};
|
const out = {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user