I saw a thread from 2018 where it was suggested that this feature would not be implemented. Has anyone revisited this recently? It's a huge gap, in my opinion. If it is available now, could someone please direct me on how to use it?
@christopherbclark can you give an example of the input you are trying to validate for clarification.
I might help easily check if it is available or not. If it is not available and worth adding (With people vote for it), definitely it can be added and made available in the next version.
Sure! So, for example, if I had a database field for "project name", and I only wanted it to include letters, and spaces. Looking for a validator that would accept "My Awesome Project", but reject "My Awesome Project 99". Right now, I think both would be rejected using isAlpha because they include spaces. From the earlier stuff I read, this is because a space is neither alpha or numeric, and therefore fails.
I get your point @christopherbclark. At the moment, isAlpha() does not accept that.
Unless people vote for the addition of isAlpha() with an option to have spaces or create something like isAlphaWithSpace()
I'd suggest just adding a config object as we've been doing with the rest, scales better, so -> isAlpha(str, locale, { config object }
How about if we had an ignoreList instead that lists characters in a string?
isAlpha("my project", "en-US", { ignoreList: " " }); // true
isalpha("my awesome-project", "en-US", { ignoreList: " -" }); // true
Looks great suggestion @profnandaa.
I agree. Can we put @profnandaa 鈥榮 idea to a formal vote? I think a feature like that would be super cool.
we definitely need more consider edge cases and write more test case I hope this should be the beginning
note I forgot to update fork, will clean up
Most helpful comment
I'd suggest just adding a config object as we've been doing with the rest, scales better, so ->
isAlpha(str, locale, { config object }How about if we had an
ignoreListinstead that lists characters in a string?