UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

23 lines 773 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.promiseRejectNull = void 0; const tslib_1 = require("tslib"); /** * @public * Returns a Promise of rejection with the supplied error if the value is `null` or `undefined`. * * @remarks * See {@link promiseRejectNull}. */ function promiseRejectNull(value, error) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const result = yield value; if (result == null) { return Promise.reject(error); } // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-return return result; }); } exports.promiseRejectNull = promiseRejectNull; //# sourceMappingURL=promise-reject-null.js.map