Skip to content

Commit

Permalink
fix(Util): fix collection import (#6256)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckohen committed Aug 1, 2021
1 parent 6002825 commit 93e0239
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util/Util.js
@@ -1,6 +1,7 @@
'use strict';

const { parse } = require('path');
const { Collection } = require('@discordjs/collection');
const fetch = require('node-fetch');
const { Colors, Endpoints } = require('./Constants');
const Options = require('./Options');
Expand Down Expand Up @@ -38,9 +39,9 @@ class Util extends null {
const valueOf = elemIsObj && typeof element.valueOf === 'function' ? element.valueOf() : null;

// If it's a Collection, make the array of keys
if (element instanceof require('./Collection')) out[newProp] = Array.from(element.keys());
if (element instanceof Collection) out[newProp] = Array.from(element.keys());
// If the valueOf is a Collection, use its array of keys
else if (valueOf instanceof require('./Collection')) out[newProp] = Array.from(valueOf.keys());
else if (valueOf instanceof Collection) out[newProp] = Array.from(valueOf.keys());
// If it's an array, flatten each element
else if (Array.isArray(element)) out[newProp] = element.map(e => Util.flatten(e));
// If it's an object with a primitive `valueOf`, use that value
Expand Down

0 comments on commit 93e0239

Please sign in to comment.