I'm trying to categorize my commands and make an array or object like:
my commands = [Music[mymusiccommand1,mymusiccommand2], Fun[myfuncommand1,myfuncommand2]]
I've got all my commands into different files and I'm exporting their categories
module.exports ={category:"Music",name:"Play",description: "Plays music"},
I can access their categories and make an array using them
commands = commands.array();
categorydup = commands.map(function (obj){return obj.category});
categories = [...new Set(categorydup)]
console.log(categories);
Console:
[ 'Music', 'Fun', 'etc.', 'etc.' ]
But I can't go further and I can't push my commands into them because they are not arrays, but I couldn't figure out how to turn category names into arrays or objects.
Note: I want to get category names from module.exports
; not write them by hand