mirror of
https://github.com/danbulant/discord.js
synced 2026-05-31 21:31:29 +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) {
|
||||
if (!isObject(obj)) return obj;
|
||||
|
||||
props = Object.assign(
|
||||
...Object.keys(obj)
|
||||
.filter(k => !k.startsWith('_'))
|
||||
.map(k => ({ [k]: true })),
|
||||
...props,
|
||||
);
|
||||
const objProps = Object.keys(obj)
|
||||
.filter(k => !k.startsWith('_'))
|
||||
.map(k => ({ [k]: true }));
|
||||
|
||||
props = objProps.length ? Object.assign(...objProps, ...props) : Object.assign({}, ...props);
|
||||
|
||||
const out = {};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue