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
Rule Wishlist #9
Comments
url added in 95237a0 |
contains added in 3913b9a |
startsWith added in fff8678 |
endsWith added in aa51798 |
matches added in 208a5cf |
Password strength? Say being able to specify for example must contain letter number uppercase lower case symbol and so on. |
I can surely add uppercase, lowercase and special char Rules which one
could combine!
Am 10.03.2018 00:59 schrieb "Patrick" <notifications@github.com>:
… Password strength? Say being able to specify for example must contain
letter number uppercase lower case symbol and so on.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACnBhlvy-xBOFpih0cA3ADKqQNXcEsp6ks5tcxdYgaJpZM4OcrWn>
.
|
Have a look at src/rules and tests, should be easy to implement If you
wanna give it a shot
Am 10.03.2018 01:28 schrieb "Pascale Beier" <mail@pascalebeier.de>:
… I can surely add uppercase, lowercase and special char Rules which one
could combine!
Am 10.03.2018 00:59 schrieb "Patrick" ***@***.***>:
> Password strength? Say being able to specify for example must contain
> letter number uppercase lower case symbol and so on.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#9 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ACnBhlvy-xBOFpih0cA3ADKqQNXcEsp6ks5tcxdYgaJpZM4OcrWn>
> .
>
|
It would be nice to have a |
@Niladem cool idea! I could do that for any rule with n additional arguments. Definitely doing that. |
I need a 'divisible by' rule. I think this code should do the trick: |
And I also need an other rule. I need to match a field so the date is in the format YYYY-MM-DD. Stef |
Hey Stef, Worthy suggestions! Feel free to send a PR. I'm short on freetime atm. |
I'm working on a new bootstrap 4 project and we need to do some input validation. Your code seems the only form validation code that works with bootstrap 4. Stef |
@StefCoene Check out v2.1.0 |
Hey @PascaleBeier how about this ? (please keep in mind that my programming skills aren't how i'd like them to be) startsWithOr: (input, string, string2) => {
/**
* @since 2.1.1
* @param string string: String the input value should start with
* @param string2 string: Second string the input value should start with
* @example 1,2
* @error Your input should contain either 1 or 2.
* @description Require the input value to start with a given string
* or a different string.
*/
// Check first string
let istrue = false;
if ( startsWith(input.value, string) ) {
istrue = true
}
if ( startsWith(input.value, string2) ) {
istrue = true
}
return istrue;
}, |
I think it would be safe to verify if there are 2 strings in the function, and if not, basically just run startsWith on it. If there are 2 strings, than they'd both need to be verified.. |
Hey @niladam, The reason I didnt implement it yet is that I want to find a solution to dynamically add these ...Or-Rules. Will look at that again these days. Your Code is nice! You could also use the or Operator :) |
Cool, thanks for the quick response! For the divisible, I also need to check if something is divisible by 0.2.
|
I ended up using arbitrary-precision decimal arithmetic via https://github.com/MikeMcl/big.js. Might come in handy in the future. Shipped it with 2.1.2. I cleaned our comments, don't feel offended! |
URL Validation
Two fields that should match, e.q. for password confirmations. The v1 API makes that super fuzzy.
Ensure a given string ends with a given string
Same as above but starting with
The text was updated successfully, but these errors were encountered: