Export list ESM from JSON

I would like to export a list using ESM from a JSON object. Let's say I have the following object:

const myList = {
    func1: function(){},
    func2: function(){}
}

And would like to export it such as:

export {myList.func1 as func1, myList.func2 as func2}

Is there a nice way to export all the functions (assuming we have a lot more functions) in myList such as each function inside it can be imported with its name (e.g. import {func1} from './myList.js')


Solution 1:

a) There is no such thing as a "JSON object". JSON is always a string; if it's an object, it's Javascript. JSON also cannot store functions.

That being said, you can make use of destructuring here:

export { func1, func2 } = myList;