UNPKG

@dfinity/zod-schemas

Version:

A collection of reusable Zod schemas and validators for common data patterns in ICP applications

3 lines (2 loc) 389 B
import*as r from"zod";var c=({additionalProtocols:e=[],allowHttpLocally:n=!0})=>r.string().url().refine(l=>{try{let t=[...new Set(["https:",...e])],{protocol:o,hostname:s}=new URL(l);return n&&["localhost","127.0.0.1"].includes(s)?["http:",...t].includes(o):t.includes(o)}catch{return!1}},{message:"Invalid URL."}),a=c({});export{c as a,a as b}; //# sourceMappingURL=chunk-PXRHZW6E.js.map