0.1.0 • Published 6 years ago

await-parse-error v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

await-parse-error

Simple module to bind await-to-js with parse-error modules as described in this article.

Pre-requisites

The pre-requisites from await-to-js:

You need to use Node 7.6 (or later) or an ES7 transpiler in order to use async/await functionality. You can use babel or typescript for that.

Install

npm i -s await-parse-error

Usage

Use it just like in await-to-js but now the error will be a parse error object as described in parse-error

const tope = require('await-parse-error'); // use whatever name you like... I like to as in the original but it may be confusing if I use it at the same time

[ err, user ] = await tope(UserModel.findById(1));
if(!user) return cb('No user found');