@dfinity/zod-schemas
Version:
A collection of reusable Zod schemas and validators for common data patterns in ICP applications
3 lines (2 loc) • 381 B
JavaScript
import*as r from"zod/v4";var s=({additionalProtocols:e=[],allowHttpLocally:l=!0})=>r.url().refine(n=>{try{let o=[...new Set(["https:",...e])],{protocol:t,hostname:c}=new URL(n);return l&&["localhost","127.0.0.1"].includes(c)?["http:",...o].includes(t):o.includes(t)}catch{return!1}},{error:"Invalid URL."}),a=s({});export{s as a,a as b};
//# sourceMappingURL=chunk-QUBJRYQG.js.map