Skip to content
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.cidr() - support CIDR notation #3820

Merged
merged 6 commits into from
Dec 10, 2024

Conversation

wataryooou
Copy link
Contributor

@wataryooou wataryooou commented Oct 27, 2024

This PR supported CIDR notation. (This PR doesn't support IP address range.)
FYI: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

const cidr = z.string().cidr();
cidr.parse("192.168.0.0/24"); // pass
cidr.parse("2001:db8::/32"); // pass
cidr.parse("192.168.1.1/33"); // fail
cidr.parse("2001:db8::1/129"); // fail

Copy link

netlify bot commented Oct 27, 2024

Deploy Preview for guileless-rolypoly-866f8a ready!

Name Link
🔨 Latest commit 81b1e45
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/67579b5eb8cf610008c0ae30
😎 Deploy Preview https://deploy-preview-3820--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@colinhacks
Copy link
Owner

colinhacks commented Nov 7, 2024

Is there an argument for making this z.string().cidr()?

@wataryooou wataryooou changed the title feat: support CIDR notation feat: support CIDR notation (z.string.cidr) Nov 10, 2024
@wataryooou wataryooou changed the title feat: support CIDR notation (z.string.cidr) feat: z.string.cidr() - support CIDR notation Nov 10, 2024
@wataryooou
Copy link
Contributor Author

@colinhacks

Is there are argument for making this z.string().cidr()?

That's a great idea 👍
I've made the changes accordingly. Could you review it once more?

@colinhacks colinhacks merged commit f82f817 into colinhacks:main Dec 10, 2024
3 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants