@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
31 lines • 715 B
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
export function OK(value) {
return { ok: true, value };
}
export function ERR(error) {
return { ok: false, error };
}
/**
* unwrap is a convenience function for extracting a value from a result or
* throwing if there was an error.
*/
export function unwrap(r) {
if (!r.ok) {
throw r.error;
}
return r.value;
}
/**
* unwrapAsync is a convenience function for resolving a value from a Promise
* of a result or rejecting if an error occurred.
*/
export async function unwrapAsync(pr) {
const r = await pr;
if (!r.ok) {
throw r.error;
}
return r.value;
}
//# sourceMappingURL=fp.js.map