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

invalid check? #4

Closed
DimitarChristoff opened this issue Mar 21, 2012 · 6 comments
Closed

invalid check? #4

DimitarChristoff opened this issue Mar 21, 2012 · 6 comments

Comments

@DimitarChristoff
Copy link

https://github.com/Kicksend/mailcheck/blob/master/src/jquery.mailcheck.js#L21-22

var parts = email.split('@');
if (parts < 2) {

what exactly are you testing for here? parts is going to be an array, should test parts.length - this will only fail on a falsy array... or if the email string is '1' or something.

@thoughtpalette
Copy link

Getting this same issue :{

"cannot call method 'split' of undefined"

@DimitarChristoff
Copy link
Author

@thoughtpalette that's different - it means email has not been passed and there's no fallback for that. chances are this.val() has not returned a value. unrelated.

@thoughtpalette
Copy link

Whoops, My bad. Was just putting it in my front-end rec without actually passing the email id.

Thanks though!

@jonashaag
Copy link
Contributor

Seems like [array] < [int] <=> [array.length] < [int]

var a = [null, null, null]
a < 2 // false

var b = [null]
b < 2 // true

@DimitarChristoff
Copy link
Author

erm.

[0, 0] > 1 // false

also, I get:

["foo"] < 2 // false
["foo","bar"] < 2 // false

but

[1] < 2 // true

it's not the same as length. hence it's unsafe. i think it does toString to coerce and when single element, it can compare 2 values as per normal - as strings! totally unreliable.

@derrickko
Copy link
Member

Thanks! Fixed by: 0f18d2f

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

No branches or pull requests

4 participants