question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to use it in async/await fasion?

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
Jeff-Tiancommented, Jan 24, 2019

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.

1reaction
AckerApplecommented, Jan 21, 2019

NOTE: previous comment was me signed in from my work account

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found