UEA-PRODEM
This commit is contained in:
+7
-7
@@ -2,7 +2,7 @@ import * as core from "./core.js";
|
||||
import * as errors from "./errors.js";
|
||||
import * as util from "./util.js";
|
||||
export const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
||||
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
||||
const result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise) {
|
||||
throw new core.$ZodAsyncError();
|
||||
@@ -16,7 +16,7 @@ export const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
||||
};
|
||||
export const parse = /* @__PURE__*/ _parse(errors.$ZodRealError);
|
||||
export const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
||||
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
||||
let result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise)
|
||||
result = await result;
|
||||
@@ -43,7 +43,7 @@ export const _safeParse = (_Err) => (schema, value, _ctx) => {
|
||||
};
|
||||
export const safeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);
|
||||
export const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
||||
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
||||
let result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise)
|
||||
result = await result;
|
||||
@@ -56,7 +56,7 @@ export const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
||||
};
|
||||
export const safeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);
|
||||
export const _encode = (_Err) => (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
||||
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
||||
return _parse(_Err)(schema, value, ctx);
|
||||
};
|
||||
export const encode = /* @__PURE__*/ _encode(errors.$ZodRealError);
|
||||
@@ -65,7 +65,7 @@ export const _decode = (_Err) => (schema, value, _ctx) => {
|
||||
};
|
||||
export const decode = /* @__PURE__*/ _decode(errors.$ZodRealError);
|
||||
export const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
||||
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
||||
return _parseAsync(_Err)(schema, value, ctx);
|
||||
};
|
||||
export const encodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);
|
||||
@@ -74,7 +74,7 @@ export const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
||||
};
|
||||
export const decodeAsync = /* @__PURE__*/ _decodeAsync(errors.$ZodRealError);
|
||||
export const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
||||
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
||||
return _safeParse(_Err)(schema, value, ctx);
|
||||
};
|
||||
export const safeEncode = /* @__PURE__*/ _safeEncode(errors.$ZodRealError);
|
||||
@@ -83,7 +83,7 @@ export const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
||||
};
|
||||
export const safeDecode = /* @__PURE__*/ _safeDecode(errors.$ZodRealError);
|
||||
export const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
||||
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
||||
return _safeParseAsync(_Err)(schema, value, ctx);
|
||||
};
|
||||
export const safeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync(errors.$ZodRealError);
|
||||
|
||||
Reference in New Issue
Block a user