New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: z.string().ulid() - add support for ulids #2049
Conversation
✅ Deploy Preview for guileless-rolypoly-866f8a ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
3b2db11
to
b2215e9
Compare
cc @colinhacks @hugo-vrijswijk - not sure how to assign reviewers or if it's something only your team does |
deno/lib/types.ts
Outdated
@@ -903,6 +918,9 @@ export class ZodString extends ZodType<string, ZodStringDef> { | |||
get isCUID2() { | |||
return !!this._def.checks.find((ch) => ch.kind === "cuid2"); | |||
} | |||
get isULID() { | |||
return !!this._def.checks.find((ch) => ch.kind === "cuid2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a copy-paste mistake
return !!this._def.checks.find((ch) => ch.kind === "cuid2"); | |
return !!this._def.checks.find((ch) => ch.kind === "ulid"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, addressed!
src/types.ts
Outdated
@@ -903,6 +918,9 @@ export class ZodString extends ZodType<string, ZodStringDef> { | |||
get isCUID2() { | |||
return !!this._def.checks.find((ch) => ch.kind === "cuid2"); | |||
} | |||
get isULID() { | |||
return !!this._def.checks.find((ch) => ch.kind === "cuid2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
return !!this._def.checks.find((ch) => ch.kind === "cuid2"); | |
return !!this._def.checks.find((ch) => ch.kind === "ulid"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, addressed!
4c1a61e
to
04e2705
Compare
Overview
Adds support for ulids https://github.com/ulid/spec. Shopify has really popularized these and have a lot of benefits https://news.ycombinator.com/item?id=34294693