import type { Field, Schema } from "../schema.ts"; // A field's schema with its optional and nullable wrappers peeled off. export function unwrap(field: Field): { schema: Schema; optional: boolean; nullable: boolean } { const optional = field.type === "optional"; const inner = field.type === "optional" ? field.inner : field; const nullable = inner.type === "nullable"; return { schema: inner.type === "nullable" ? inner.inner : inner, optional, nullable }; }