UNPKG

@ar.io/sdk

Version:

[![codecov](https://codecov.io/gh/ar-io/ar-io-sdk/graph/badge.svg?token=7dXKcT7dJy)](https://codecov.io/gh/ar-io/ar-io-sdk)

16 lines (15 loc) 487 B
"use strict"; 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; }