Skip to content

Instantly share code, notes, and snippets.

View bvqbao's full-sized avatar
🏠
Working from home

Bao Bui bvqbao

🏠
Working from home
View GitHub Profile

Try-catch oneliner

If you search npm with query try await you will find a big modules list (you can find it in the boottom).

What all this developers want is just more clear way to use try catch. All of them suggest to use:

const tryCatch = require('try-catch');
const [error, data] = tryCatch(JSON.parse, 'hello');