Deprecate string.nonempty?
See original GitHub issueIt can be confusing using it with .min
when they can both serve the same purpose. For example, it’s impossible to know what happens if I do the following without consulting the source code:
z.string().min(2).nonempty();
Does that remove my minimum length of 2 on .min
? The answer is yes, but it’s unclear. I think it would be better to make users just use .min(1)
as that is far easier to read and look at.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to remove empty string in a list? - python - Stack Overflow
You can use filter , with None as the key function, which filters out all elements which are False ish (including empty strings)...
Read more >Request: nonempty for string #63 - colinhacks/zod - GitHub
I'm using MUI for my forms and it requires my default input values to be an empty string. Of course that means an...
Read more >Python | Remove empty strings from list of strings
remove () generally removes the first occurrence of an empty string and we keep iterating this process until no empty string is found...
Read more >Python: Remove the nth index character from a nonempty string
Python Exercises, Practice and Solution: Write a Python program to remove the nth index character from a nonempty string.
Read more >String - Robot Framework
A library for string manipulation and verification. String is Robot Framework's standard library for manipulating strings (e.g. Replace ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good call, I agree with this. I’ll probably never remove support but I’ll steer people towards
.min(1)
. Deprecated in #440.As a workaround, you could write
.min(1, 'Username must be at least 1 character');