UNPKG

true-myth

Version:

A library for safe functional programming in JavaScript, with first-class support for TypeScript

24 lines (23 loc) 623 B
"use strict"; /** Helpers to make it easier to test `Maybe` and `Result`. @module */ Object.defineProperty(exports, "__esModule", { value: true }); exports.unwrapErr = exports.unwrap = void 0; const maybe_js_1 = require("./maybe.cjs"); function unwrap(wrapped) { if ((0, maybe_js_1.isInstance)(wrapped)) { return wrapped.value; } else { return wrapped.value; } } exports.unwrap = unwrap; /** Unwrap the contained `Err` error. Throws if `result` is `Ok`. */ function unwrapErr(result) { return result.error; } exports.unwrapErr = unwrapErr; //# sourceMappingURL=test-support.cjs.map