|
|
|
|
|
by evangow
2423 days ago
|
|
I use await-to-js[1] to clean this stuff up. You can pair it with destructuring arrays like so: const [err, result] = await to(funcThatReturnSomeType()); if(err) doSomethingWithErr(err); doSomething(result); [1] https://www.npmjs.com/package/await-to-js |
|