@ar.io/sdk
Version:
[](https://codecov.io/gh/ar-io/ar-io-sdk)
16 lines (15 loc) • 487 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseSchemaResult = parseSchemaResult;
/**
* @param schema - zod schema
* @param v - value to parse
* @throws {z.SafeParseError<any>} - if the value fails to parse
*/
function parseSchemaResult(schema, v) {
const schemaResult = schema.safeParse(v);
if (!schemaResult.success) {
throw new Error(JSON.stringify(schemaResult.error.format(), null, 2));
}
return schemaResult;
}
;