Question: How to use it in async/await fasion?
See original GitHub issueI can use it as:
import * as jsonexport from 'jsonexport';
const csvData = await new Promise((resolve, reject) => jsonexport(data, (err, csv) => {
if (err) {
reject(err);
} else {
resolve(csv);
}
}));
Any better suggestions?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Async/await - The Modern JavaScript Tutorial
There's a special syntax to work with promises in a more comfortable fashion, called “async/await”. It's surprisingly easy to understand and ...
Read more >Interview question: async & await (C#) - DEV Community
Q : What is the purpose of async / await keywords? These keywords allow writing asynchronous non-blocking code in a synchronous fashion.
Read more >Javascript Async/Await - Interview Questions # 10 - Medium
Hello everyone, in this tutorial we will learn about how to use async functions, awaiting async functions, and the importance of async /...
Read more >async function - JavaScript - MDN Web Docs - Mozilla
The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly ...
Read more >Use async / await in parallel, and get results as they arrive?
This question is similar, but does not have the answer: Call async/await functions in parallel The accepted answer in this question is to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, thank you. I’m good with wrapping it with new Promise(), and
jsonexport
is really helpful for converting json to csv in my project.NOTE: previous comment was me signed in from my work account