@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
23 lines (22 loc) • 664 B
JavaScript
import { errorForUndefined as n } from "./consts.js";
import * as r from "zod/mini";
const c = r.string({ error: n }), m = r.number({ error: n }), p = r.boolean({ error: n }), f = r.array(r.unknown(), { error: n });
function l(e, ...o) {
const s = o.length ? e.check(...o) : e;
return async (a) => {
const t = await s.safeParseAsync(a, { reportInput: !0 });
return t.success ? !0 : t.error.issues[0]?.message ?? !1;
};
}
function g(e) {
return r.pipe(c, e);
}
export {
f as arrayScheme,
p as booleanScheme,
m as numberScheme,
g as pipeStringScheme,
c as stringScheme,
l as toRuleValidator
};
//# sourceMappingURL=zodRuleBuilders.js.map