MCPcopy
hub / github.com/colinhacks/zod / hash

Function hash

packages/zod/src/v4/classic/schemas.ts:948–959  ·  view source on GitHub ↗
(
  alg: Alg,
  params?: {
    enc?: Enc;
  } & core.$ZodStringFormatParams
)

Source from the content-addressed store, hash-verified

946}
947
948export function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(
949 alg: Alg,
950 params?: {
951 enc?: Enc;
952 } & core.$ZodStringFormatParams
953): ZodCustomStringFormat<`${Alg}_${Enc}`> {
954 const enc = params?.enc ?? "hex";
955 const format = `${alg}_${enc}` as const;
956 const regex = core.regexes[format as keyof typeof core.regexes] as RegExp;
957 if (!regex) throw new Error(`Unrecognized hash format: ${format}`);
958 return core._stringFormat(ZodCustomStringFormat, format, regex, params) as any;
959}
960
961// ZodNumber
962export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals>

Callers 1

hash.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected