Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
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')

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!