UNPKG

tsoid

Version:

Typed functional library to deal with async operations.

15 lines (14 loc) 342 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Returns a promise that resolves to an error. * * @param err Error instance or reason. */ function fail(err) { if (err instanceof Error) { return Promise.resolve(err); } return Promise.resolve(new Error(err)); } exports.default = fail;