UNPKG

true-myth

Version:

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

19 lines (18 loc) 448 B
/** Helpers to make it easier to test `Maybe` and `Result`. @module */ import { isInstance as isMaybe } from './maybe.js'; export function unwrap(wrapped) { if (isMaybe(wrapped)) { return wrapped.value; } else { return wrapped.value; } } /** Unwrap the contained `Err` error. Throws if `result` is `Ok`. */ export function unwrapErr(result) { return result.error; } //# sourceMappingURL=test-support.js.map