mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 12:40:50 +00:00
fix(Util): support empty array for flatten (#4590)
This commit is contained in:
parent
fab3153de6
commit
317f24076e
1 changed files with 5 additions and 6 deletions
|
|
@ -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 = {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue