npm.io
1.0.2 • Published 7 years ago

@zmotivat0r/o0

Licence
MIT
Version
1.0.2
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
22
Async/await wrapper with error handling, retry and error override
Heavily inspired by await-to-js
Example

Install

npm i @zmotivat0r/o0

Usage

import { oO } from '@zmotivat0r/o0';

async function do() {
  const [err, user] = await oO(findUser(1));

  const [, projects] = await oO(findProjects(1), {
    retry: 5,
  });

  const [customError] = await oO(doStuff(), {
    err: new SomeCustomError('(>_<)'),
  });
}

Test

npm test

Keywords