zod
zod copied to clipboard
Add `.numeric()` to `ZodString`
Hi 👋
I think it would be great to add numericString
in ZodString.
It is just util for regex
checker, but I belive it would be useful in many cases.
Related Issue : https://github.com/colinhacks/zod/issues/1240
Deploy Preview for guileless-rolypoly-866f8a ready!
Built without sensitive environment variables
Name | Link |
---|---|
Latest commit | 462371703b8cdbc503a4b8085543942b3079e283 |
Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/63e24f047ac84600081f6a2a |
Deploy Preview | https://deploy-preview-1570--guileless-rolypoly-866f8a.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Numeric
seems redundant given its called in z.string()
context. Why not simply z.string().numeric()
?
Numeric seems redundant given its called in z.string() context. Why not simply z.string().numeric()?
I think numeric
seems better. I renamed numericString
to numeric
(cc. @colinhacks)
Great, was just looking for this! Hope it gets merged soon!
Any updates ..? I think this PR can help many people : )
I could really use this for one of my current projects 👀
Hello, any updates on when this will be merged?
Thanks for the excellent PR here, and apologies for taking so long to address it. At the moment, I'm trying to keep Zod's core feature set as small as possible; since this is achievable with .regex()
or .refine()
I'm inclined to keep it separate.
Zod 4 will expose a bunch of utility regexes, and I'll be sure this one is included.