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

numberValidation : incorrect options default value #37

Closed
plepaisant opened this issue Nov 12, 2014 · 2 comments
Closed

numberValidation : incorrect options default value #37

plepaisant opened this issue Nov 12, 2014 · 2 comments

Comments

@plepaisant
Copy link
Contributor


function numberValidation(numberToValidate, options) {
options = options || options;


should be


function numberValidation(numberToValidate, options) {
options = options || {};


@plepaisant
Copy link
Contributor Author

same correction for

function emailValidation(emailToValidate, options) {
options = options || options;
return regex.email.test(emailToValidate);
}


should be


function emailValidation(emailToValidate, options) {
options = options || {};
return regex.email.test(emailToValidate);
}


@sebez
Copy link
Contributor

sebez commented Nov 14, 2014

A more elegant syntax, (used in Backbone sources), would be :

options || (options = {});

This way, the allocation is executed only if options is null.

@pierr pierr closed this as completed in 24ee3d7 Jan 7, 2015
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

2 participants