@eodomius/promiser
v1.0.0
Published
Wrapper for Promises
Downloads
1
Maintainers
Readme
Eodomius utilities : promiser
This module provide a function that can wait for a promise to be resolved or rejected. The function return an array of two values: te result and the error.
Installation
NPM:
npm i @eodomius/promiser
Yarn:
yarn add @eodomius/promiser
Importation
CommonJS:
const { promiser } = require("@eodomius/promiser");
EcmaScript modules:
import { promiser } from "@eodomius/promiser";
Usage
import { promiser } from "@eodomius/promiser";
const [result, error] = promiser(Promise.resolve(1));
if (error) {
console.error(error);
return;
} else {
console.log(result);
}