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

Function stringToURL

packages/zod/src/v4/classic/tests/codec-examples.test.ts:393–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

391// ============================================================================
392
393const stringToURL = () =>
394 z.codec(z.url(), z.instanceof(URL), {
395 decode: (urlString) => new URL(urlString),
396 encode: (url) => url.href,
397 });
398
399test("stringToURL codec", () => {
400 const codec = stringToURL();

Callers 1

Calls 1

urlMethod · 0.65

Tested by

no test coverage detected