unstructured-client
Version:
<h3 align="center"> <img src="https://raw.githubusercontent.com/Unstructured-IO/unstructured/main/img/unstructured_logo.png" height="200" > </h3>
38 lines • 934 B
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.unwrapAsync = exports.unwrap = exports.ERR = exports.OK = void 0;
function OK(value) {
return { ok: true, value };
}
exports.OK = OK;
function ERR(error) {
return { ok: false, error };
}
exports.ERR = ERR;
/**
* unwrap is a convenience function for extracting a value from a result or
* throwing if there was an error.
*/
function unwrap(r) {
if (!r.ok) {
throw r.error;
}
return r.value;
}
exports.unwrap = unwrap;
/**
* unwrapAsync is a convenience function for resolving a value from a Promise
* of a result or rejecting if an error occurred.
*/
async function unwrapAsync(pr) {
const r = await pr;
if (!r.ok) {
throw r.error;
}
return r.value;
}
exports.unwrapAsync = unwrapAsync;
//# sourceMappingURL=fp.js.map
;