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.

remove async/await

See original GitHub issue

I have a class definition that looks like

class X {

    constructor() {
        this._analyzer = null;
    }

    async init(arg) {
       await something()
    }
}

and I need to strip async and await from/in method init. This is a source that is not under my control, but which I know will work without async in my own context, where I need it to be sync. How would I do this with putout?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
retorquerecommented, Apr 19, 2021

Man, I’m dump. There’s no need for me to strip citeproc – the dead code elimination of the bundler I use does a better job than I did, automatically.

1reaction
retorquerecommented, Apr 19, 2021

Superb – the promise unwrapper does the job and emove-nested-blocks does the rest.

File citeproc is generated, would be better to work with src directory and build this file after transformations.

I’m installing the node package, and that only has the generated file. I’ll see if I can put together a replacer that strips them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unnecessary async/await when await is last? - Stack Overflow
When thread reaches await workTask; it split the method to 2 sections . so after SimulateWork is finished - the continuation of the...
Read more >
Removing async void - John Thiriet
Async propagation​​ Any code that calls PrepareCoffeeAsync will then need to await it's completion. Repeat the same process enough and you will ...
Read more >
How to escape async/await hell - freeCodeCamp
This means that await is not required for executing the function. The async function will return a promise, which you can use later....
Read more >
Avoiding simple mistakes in async await - Anthony Steele
Let the async flow. Use await not .Result to get the result of a task. Avoid becoming synchronous again wherever possible. Avoid Task.Run ......
Read more >
Asynchronous Programming - EF Core - Microsoft Learn
Querying and saving data asynchronously with Entity Framework Core. ... This is typically done by using the await keyword on each async ......
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