Browse Source

#382: Add JSLint to Grunt build

nghuuphuoc 11 years ago
parent
commit
28537f00f9
55 changed files with 955 additions and 919 deletions
  1. 3 0
      CHANGELOG.md
  2. 42 0
      Gruntfile.js
  3. 453 454
      dist/js/bootstrapValidator.js
  4. 3 3
      dist/js/bootstrapValidator.min.js
  5. 1 1
      dist/js/languages/en_US.js
  6. 1 1
      dist/js/languages/vi_VN.js
  7. 7 6
      package.json
  8. 86 81
      src/js/bootstrapValidator.js
  9. 1 1
      src/js/languages/en_US.js
  10. 1 1
      src/js/languages/vi_VN.js
  11. 1 1
      src/js/validator/base64.js
  12. 4 4
      src/js/validator/between.js
  13. 2 2
      src/js/validator/callback.js
  14. 0 1
      src/js/validator/choice.js
  15. 5 5
      src/js/validator/creditCard.js
  16. 5 5
      src/js/validator/cusip.js
  17. 7 7
      src/js/validator/cvv.js
  18. 6 6
      src/js/validator/date.js
  19. 3 3
      src/js/validator/different.js
  20. 3 3
      src/js/validator/digits.js
  21. 4 4
      src/js/validator/ean.js
  22. 4 4
      src/js/validator/emailAddress.js
  23. 5 5
      src/js/validator/file.js
  24. 4 4
      src/js/validator/greaterThan.js
  25. 3 3
      src/js/validator/grid.js
  26. 1 1
      src/js/validator/hex.js
  27. 2 2
      src/js/validator/hexColor.js
  28. 2 2
      src/js/validator/iban.js
  29. 74 74
      src/js/validator/id.js
  30. 3 3
      src/js/validator/identical.js
  31. 1 2
      src/js/validator/imei.js
  32. 2 2
      src/js/validator/integer.js
  33. 16 15
      src/js/validator/isbn.js
  34. 5 5
      src/js/validator/isin.js
  35. 4 4
      src/js/validator/ismn.js
  36. 4 4
      src/js/validator/issn.js
  37. 3 3
      src/js/validator/lessThan.js
  38. 1 1
      src/js/validator/mac.js
  39. 3 3
      src/js/validator/notEmpty.js
  40. 2 2
      src/js/validator/numeric.js
  41. 6 5
      src/js/validator/phone.js
  42. 2 2
      src/js/validator/regexp.js
  43. 3 3
      src/js/validator/remote.js
  44. 2 2
      src/js/validator/rtn.js
  45. 2 2
      src/js/validator/sedol.js
  46. 1 1
      src/js/validator/siren.js
  47. 3 3
      src/js/validator/siret.js
  48. 4 4
      src/js/validator/step.js
  49. 3 15
      src/js/validator/stringCase.js
  50. 1 2
      src/js/validator/stringLength.js
  51. 3 3
      src/js/validator/uri.js
  52. 2 2
      src/js/validator/uuid.js
  53. 139 141
      src/js/validator/vat.js
  54. 3 3
      src/js/validator/vin.js
  55. 4 3
      src/js/validator/zipCode.js

+ 3 - 0
CHANGELOG.md

@@ -28,6 +28,7 @@ __New Features__
 __Changes__
 * [#42](https://github.com/nghuuphuoc/bootstrapvalidator/issues/42): Remove the submit button from ```submitHandler()```. You can use new ```getSubmitButton()``` method to get the clicked submit button
 * [#109](https://github.com/nghuuphuoc/bootstrapvalidator/issues/109): Remove the ```setLiveMode()``` method
+* ```$.fn.bootstrapValidator.helpers``` renames ```mod_11_10``` to ```mod11And10```, ```mod_37_36``` to ```mod37And36```
 
 __Improvements__
 * [#244](https://github.com/nghuuphuoc/bootstrapvalidator/pull/244): Only enable the submit buttons if all fields are valid, thanks to [@smeagol74](https://github.com/smeagol74)
@@ -39,6 +40,7 @@ __Improvements__
 * [#364](https://github.com/nghuuphuoc/bootstrapvalidator/issues/364): Clicking the feedback icon also effect to the checkbox, radio fields
 * [#366](https://github.com/nghuuphuoc/bootstrapvalidator/issues/366): Don't change the enable setting when the new one is the same
 * [#371](https://github.com/nghuuphuoc/bootstrapvalidator/pull/371): Add H character to the Canadian postcode, thanks to [@jzhang6](https://github.com/jzhang6)
+* [#383](https://github.com/nghuuphuoc/bootstrapvalidator/issues/382): Add JSLint to Grunt build
 * [#388](https://github.com/nghuuphuoc/bootstrapvalidator/issues/388): Allow to override the default options. Useful for using multiple forms in the same page
 * [#393](https://github.com/nghuuphuoc/bootstrapvalidator/pull/393): The [remote validator](http://bootstrapvalidator.com/validators/remote/) adds support for dynamic ```url``` and method type (GET/POST), thanks to [@ericnakagawa](https://github.com/ericnakagawa)
 
@@ -58,6 +60,7 @@ __Bug Fixes__
 * [#389](https://github.com/nghuuphuoc/bootstrapvalidator/issues/389): When using multiple forms with HTML attributes on the same page, the plugin options will be the same as the last one
 * [#401](https://github.com/nghuuphuoc/bootstrapvalidator/issues/401): [stringLength validator](http://bootstrapvalidator.com/validators/stringLength/) allows spaces after max length
 * [#411](https://github.com/nghuuphuoc/bootstrapvalidator/pull/411): Fix the [ean validator](http://bootstrapvalidator.com/validators/ean/) when the check digit is zero, thanks to [@manish-in-java](https://github.com/manish-in-java)
+* [#417](https://github.com/nghuuphuoc/bootstrapvalidator/issues/417): IPv6 validator doesn't work
 
 __Document__
 * [#259](https://github.com/nghuuphuoc/bootstrapvalidator/issues/259): Typo "Support almost Bootstrap forms", thanks to [@lloydde](https://github.com/lloydde)

+ 42 - 0
Gruntfile.js

@@ -60,6 +60,47 @@ module.exports = function(grunt) {
             }
         },
 
+        jshint: {
+            all: [
+                'src/js/**/*.js'
+            ],
+            options: {
+                browser: true,
+                camelcase: true,
+                curly: true,
+                eqeqeq: true,
+                eqnull: true,
+                es3: true,
+                expr: true,
+                laxbreak: true,   // Allow line breaking before && or ||
+                loopfunc: true,
+                newcap: true,
+                noarg: true,
+                onevar: true,
+                sub: true,
+                undef: true,
+                white: true
+
+                /*
+                'node': false,
+                'boss': false,
+                'debug': false,
+                'devel': false,
+                'evil': false,
+                'forin': false,
+                'immed': false,
+                'noempty': false,
+                'nonew': false,
+                'plusplus': false,
+                'regexp': false,
+                'strict': false,
+                'globals': {
+                    'define': false
+                }
+                */
+            }
+        },
+
         watch: {
             scripts: {
                 files: ['src/css/**', 'src/js/**'],
@@ -77,6 +118,7 @@ module.exports = function(grunt) {
     grunt.loadNpmTasks('grunt-contrib-concat');
     grunt.loadNpmTasks('grunt-contrib-copy');
     grunt.loadNpmTasks('grunt-contrib-cssmin');
+    grunt.loadNpmTasks('grunt-contrib-jshint');
     grunt.loadNpmTasks('grunt-contrib-uglify');
     grunt.loadNpmTasks('grunt-contrib-watch');
 };

File diff suppressed because it is too large
+ 453 - 454
dist/js/bootstrapValidator.js


File diff suppressed because it is too large
+ 3 - 3
dist/js/bootstrapValidator.min.js


+ 1 - 1
dist/js/languages/en_US.js

@@ -244,7 +244,7 @@
             'default': 'Please enter a valid SIRET number'
         },
         step: {
-            'default': 'Please enter a valid step of %s',
+            'default': 'Please enter a valid step of %s'
         },
         stringCase: {
             'default': 'Please enter only lowercase characters',

+ 1 - 1
dist/js/languages/vi_VN.js

@@ -14,7 +14,7 @@
             'default': 'Vui lòng nhập giá trị hợp lệ',
             less: 'Vui lòng chọn ít nhất %s lựa chọn',
             more: 'Vui lòng chọn nhiều nhất %s lựa chọn',
-            between: 'Vui lòng chọn %s - %s lựa chọn',
+            between: 'Vui lòng chọn %s - %s lựa chọn'
         },
         creditCard: {
             'default': 'Vui lòng nhập số thẻ tín dụng hợp lệ'

+ 7 - 6
package.json

@@ -20,11 +20,12 @@
         "url": "https://github.com/nghuuphuoc/bootstrapvalidator.git"
     },
     "devDependencies": {
-        "grunt": "~0.4.2",
-        "grunt-contrib-concat": "~0.3.0",
-        "grunt-contrib-copy": "~0.5.0",
-        "grunt-contrib-cssmin": "~0.9.0",
-        "grunt-contrib-uglify": "~0.4.0",
-        "grunt-contrib-watch": "~0.5.3"
+        "grunt": "latest",
+        "grunt-contrib-concat": "latest",
+        "grunt-contrib-copy": "latest",
+        "grunt-contrib-cssmin": "latest",
+        "grunt-contrib-jshint": "latest",
+        "grunt-contrib-uglify": "latest",
+        "grunt-contrib-watch": "latest"
     }
 }

+ 86 - 81
src/js/bootstrapValidator.js

@@ -1,3 +1,5 @@
+/*jshint camelcase: true, expr: true, laxbreak: true, loopfunc: true */
+
 /**
  * BootstrapValidator (http://bootstrapvalidator.com)
  *
@@ -29,7 +31,7 @@
         // https://gist.github.com/padolsey/527683/#comment-7595
         var ieVersion = (function() {
             var v = 3, div = document.createElement('div'), a = div.all || [];
-            while (div.innerHTML = '<!--[if gt IE '+(++v)+']><br><![endif]-->', a[0]);
+            while (div.innerHTML = '<!--[if gt IE '+(++v)+']><br><![endif]-->', a[0]) {}
             return v > 4 ? v : !v;
         }());
 
@@ -130,22 +132,22 @@
             for (v in $.fn.bootstrapValidator.validators) {
                 validator    = $.fn.bootstrapValidator.validators[v];
                 enabled      = $field.attr('data-bv-' + v.toLowerCase()) + '';
-                html5AttrMap = ('function' == typeof validator.enableByHtml5) ? validator.enableByHtml5($field) : null;
+                html5AttrMap = ('function' === typeof validator.enableByHtml5) ? validator.enableByHtml5($field) : null;
 
-                if ((html5AttrMap && enabled != 'false')
-                    || (html5AttrMap !== true && ('' == enabled || 'true' == enabled)))
+                if ((html5AttrMap && enabled !== 'false')
+                    || (html5AttrMap !== true && ('' === enabled || 'true' === enabled)))
                 {
                     // Try to parse the options via attributes
                     validator.html5Attributes = validator.html5Attributes || { message: 'message' };
-                    validators[v] = $.extend({}, html5AttrMap == true ? {} : html5AttrMap, validators[v]);
+                    validators[v] = $.extend({}, html5AttrMap === true ? {} : html5AttrMap, validators[v]);
 
                     for (html5AttrName in validator.html5Attributes) {
                         optionName  = validator.html5Attributes[html5AttrName];
                         optionValue = $field.attr('data-bv-' + v.toLowerCase() + '-' + html5AttrName);
                         if (optionValue) {
-                            if ('true' == optionValue) {
+                            if ('true' === optionValue) {
                                 optionValue = true;
-                            } else if ('false' == optionValue) {
+                            } else if ('false' === optionValue) {
                                 optionValue = false;
                             }
                             validators[v][optionName] = optionValue;
@@ -195,28 +197,30 @@
                     break;
             }
 
-            if (this.options.fields[field] == null || this.options.fields[field].validators == null) {
+            if (this.options.fields[field] === null || this.options.fields[field].validators === null) {
                 return;
             }
 
             // We don't need to validate non-existing fields
-            if (fields.length == 0) {
+            if (fields.length === 0) {
                 delete this.options.fields[field];
                 return;
             }
-            for (var validatorName in this.options.fields[field].validators) {
+            var validatorName;
+            for (validatorName in this.options.fields[field].validators) {
                 if (!$.fn.bootstrapValidator.validators[validatorName]) {
                     delete this.options.fields[field].validators[validatorName];
                 }
             }
-            if (this.options.fields[field]['enabled'] == null) {
-                this.options.fields[field]['enabled'] = true;
+            if (this.options.fields[field].enabled === null) {
+                this.options.fields[field].enabled = true;
             }
 
             var that      = this,
                 total     = fields.length,
                 type      = fields.attr('type'),
-                updateAll = (total == 1) || ('radio' == type) || ('checkbox' == type);
+                updateAll = (total === 1) || ('radio' === type) || ('checkbox' === type),
+                event     = ('radio' === type || 'checkbox' === type || 'file' === type || 'SELECT' === fields.eq(0).get(0).tagName) ? 'change' : this._changeEvent;
 
             for (var i = 0; i < total; i++) {
                 var $field    = fields.eq(i),
@@ -224,9 +228,9 @@
                     $parent   = $field.parents(group),
                     // Allow user to indicate where the error messages are shown
                     container = this.options.fields[field].container || this.options.container,
-                    $message  = (container && container != 'tooltip' && container != 'popover') ? $(container) : this._getMessageContainer($field, group);
+                    $message  = (container && container !== 'tooltip' && container !== 'popover') ? $(container) : this._getMessageContainer($field, group);
 
-                if (container && container != 'tooltip' && container != 'popover') {
+                if (container && container !== 'tooltip' && container !== 'popover') {
                     $message.addClass('has-error');
                 }
 
@@ -235,7 +239,6 @@
                 $parent.find('i[data-bv-icon-for="' + field + '"]').remove();
 
                 // Whenever the user change the field value, mark it as not validated yet
-                var event = ('radio' == type || 'checkbox' == type || 'file' == type || 'SELECT' == $field.get(0).tagName) ? 'change' : this._changeEvent;
                 $field.off(event + '.update.bv').on(event + '.update.bv', function() {
                     // Reset the flag
                     that._submitIfValid = false;
@@ -244,10 +247,10 @@
 
                 // Create help block elements for showing the error messages
                 $field.data('bv.messages', $message);
-                for (var validatorName in this.options.fields[field].validators) {
+                for (validatorName in this.options.fields[field].validators) {
                     $field.data('bv.result.' + validatorName, this.STATUS_NOT_VALIDATED);
 
-                    if (!updateAll || i == total - 1) {
+                    if (!updateAll || i === total - 1) {
                         $('<small/>')
                             .css('display', 'none')
                             .addClass('help-block')
@@ -264,7 +267,7 @@
                 if (this.options.fields[field].feedbackIcons !== false && this.options.fields[field].feedbackIcons !== 'false'
                     && this.options.feedbackIcons
                     && this.options.feedbackIcons.validating && this.options.feedbackIcons.invalid && this.options.feedbackIcons.valid
-                    && (!updateAll || i == total - 1))
+                    && (!updateAll || i === total - 1))
                 {
                     $parent.removeClass('has-success').removeClass('has-error').addClass('has-feedback');
                     var $icon = $('<i/>')
@@ -273,15 +276,15 @@
                                     .attr('data-bv-icon-for', field)
                                     // Place it after the label containing the checkbox/radio
                                     // so when clicking the icon, it doesn't effect to the checkbox/radio element
-                                    .insertAfter(('checkbox' == type || 'radio' == type) ? $field.parent() : $field);
+                                    .insertAfter(('checkbox' === type || 'radio' === type) ? $field.parent() : $field);
 
                     // The feedback icon does not render correctly if there is no label
                     // https://github.com/twbs/bootstrap/issues/12873
-                    if ($parent.find('label').length == 0) {
+                    if ($parent.find('label').length === 0) {
                         $icon.css('top', 0);
                     }
                     // Fix feedback icons in input-group
-                    if ($parent.find('.input-group-addon').length != 0) {
+                    if ($parent.find('.input-group-addon').length !== 0) {
                         $icon.css({
                             'top': 0,
                             'z-index': 100
@@ -302,6 +305,7 @@
                     fields.off(events);
                     break;
                 case 'enabled':
+                /* falls through */
                 default:
                     fields.off(events).on(events, function() {
                         if (that._exceedThreshold($(this))) {
@@ -336,7 +340,7 @@
                 case (!!options.message):
                     return options.message;
                 case (!!$.fn.bootstrapValidator.i18n[validatorName]):
-                    return ('function' == typeof $.fn.bootstrapValidator.i18n[validatorName].getMessage)
+                    return ('function' === typeof $.fn.bootstrapValidator.i18n[validatorName].getMessage)
                             ? $.fn.bootstrapValidator.i18n[validatorName].getMessage(options)
                             : $.fn.bootstrapValidator.i18n[validatorName]['default'];
                 case (!!this.options.fields[field].message):
@@ -402,7 +406,7 @@
         _isExcluded: function($field) {
             if (this.options.excluded) {
                 // Convert to array first
-                if ('string' == typeof this.options.excluded) {
+                if ('string' === typeof this.options.excluded) {
                     this.options.excluded = $.map(this.options.excluded.split(','), function(item) {
                         // Trim the spaces
                         return $.trim(item);
@@ -411,8 +415,8 @@
 
                 var length = this.options.excluded.length;
                 for (var i = 0; i < length; i++) {
-                    if (('string' == typeof this.options.excluded[i] && $field.is(this.options.excluded[i]))
-                        || ('function' == typeof this.options.excluded[i] && this.options.excluded[i].call(this, $field, this) == true))
+                    if (('string' === typeof this.options.excluded[i] && $field.is(this.options.excluded[i]))
+                        || ('function' === typeof this.options.excluded[i] && this.options.excluded[i].call(this, $field, this) === true))
                     {
                         return true;
                     }
@@ -434,7 +438,7 @@
             if (!threshold) {
                 return true;
             }
-            var cannotType = $.inArray($field.attr('type'), ['button', 'checkbox', 'file', 'hidden', 'image', 'radio', 'reset', 'submit']) != -1;
+            var cannotType = $.inArray($field.attr('type'), ['button', 'checkbox', 'file', 'hidden', 'image', 'radio', 'reset', 'submit']) !== -1;
             return (cannotType || $field.val().length >= threshold);
         },
         
@@ -451,7 +455,7 @@
                 return;
             }
 
-            if ('submitted' == this.options.live) {
+            if ('submitted' === this.options.live) {
                 // Enable live mode
                 this.options.live = 'enabled';
                 var that = this;
@@ -460,7 +464,7 @@
                         var fields  = that.getFieldElements(f);
                         if (fields.length) {
                             var type    = $(fields[0]).attr('type'),
-                                event   = ('radio' == type || 'checkbox' == type || 'file' == type || 'SELECT' == $(fields[0]).get(0).tagName) ? 'change' : that._changeEvent,
+                                event   = ('radio' === type || 'checkbox' === type || 'file' === type || 'SELECT' === $(fields[0]).get(0).tagName) ? 'change' : that._changeEvent,
                                 trigger = that.options.fields[field].trigger || that.options.trigger || event,
                                 events  = $.map(trigger.split(' '), function(item) {
                                     return item + '.live.bv';
@@ -501,7 +505,7 @@
             }
 
             // Call the custom submission if enabled
-            if (this.options.submitHandler && 'function' == typeof this.options.submitHandler) {
+            if (this.options.submitHandler && 'function' === typeof this.options.submitHandler) {
                 // If you want to submit the form inside your submit handler, please call defaultSubmit() method
                 this.options.submitHandler.call(this, this, this.$form);
             } else {
@@ -553,7 +557,7 @@
                 }
             }
 
-            if (counter[this.STATUS_VALID] == numValidators) {
+            if (counter[this.STATUS_VALID] === numValidators) {
                 // Remove from the list of invalid fields
                 this.$invalidFields = this.$invalidFields.not($field);
 
@@ -563,7 +567,7 @@
                 });
             }
             // If all validators are completed and there is at least one validator which doesn't pass
-            else if (counter[this.STATUS_NOT_VALIDATED] == 0 && counter[this.STATUS_VALIDATING] == 0 && counter[this.STATUS_INVALID] > 0) {
+            else if (counter[this.STATUS_NOT_VALIDATED] === 0 && counter[this.STATUS_VALIDATING] === 0 && counter[this.STATUS_INVALID] > 0) {
                 // Add to the list of invalid fields
                 this.$invalidFields = this.$invalidFields.add($field);
 
@@ -601,7 +605,7 @@
         disableSubmitButtons: function(disabled) {
             if (!disabled) {
                 this.$form.find(this.options.submitButtons).removeAttr('disabled');
-            } else if (this.options.live != 'disabled') {
+            } else if (this.options.live !== 'disabled') {
                 // Don't disable if the live validating mode is disabled
                 this.$form.find(this.options.submitButtons).attr('disabled', 'disabled');
             }
@@ -636,7 +640,7 @@
          * @returns {BootstrapValidator}
          */
         validateField: function(field) {
-            var fields = $([]), type;
+            var fields = $([]);
             switch (typeof field) {
                 case 'object':
                     fields = field;
@@ -649,14 +653,14 @@
                     break;
             }
 
-            if (this.options.fields[field] && this.options.fields[field]['enabled'] == false) {
+            if (this.options.fields[field] && this.options.fields[field].enabled === false) {
                 return this;
             }
 
             var that       = this,
                 type       = fields.attr('type'),
-                total      = ('radio' == type || 'checkbox' == type) ? 1 : fields.length,
-                updateAll  = ('radio' == type || 'checkbox' == type),
+                total      = ('radio' === type || 'checkbox' === type) ? 1 : fields.length,
+                updateAll  = ('radio' === type || 'checkbox' === type),
                 validators = this.options.fields[field].validators,
                 validatorName,
                 validateResult;
@@ -674,7 +678,7 @@
 
                     // Don't validate field if it is already done
                     var result = $field.data('bv.result.' + validatorName);
-                    if (result == this.STATUS_VALID || result == this.STATUS_INVALID) {
+                    if (result === this.STATUS_VALID || result === this.STATUS_INVALID) {
                         this._onFieldValidated($field, validatorName);
                         continue;
                     }
@@ -683,7 +687,7 @@
                     validateResult = $.fn.bootstrapValidator.validators[validatorName].validate(this, $field, validators[validatorName]);
 
                     // validateResult can be a $.Deferred object ...
-                    if ('object' == typeof validateResult) {
+                    if ('object' === typeof validateResult) {
                         this.updateStatus(updateAll ? field : $field, this.STATUS_VALIDATING, validatorName);
                         $field.data('bv.dfs.' + validatorName, validateResult);
 
@@ -697,14 +701,14 @@
 
                             that.updateStatus(updateAll ? $f.attr('data-bv-field') : $f, isValid ? that.STATUS_VALID : that.STATUS_INVALID, v);
 
-                            if (isValid && that._submitIfValid == true) {
+                            if (isValid && that._submitIfValid === true) {
                                 // If a remote validator returns true and the form is ready to submit, then do it
                                 that._submit();
                             }
                         });
                     }
                     // ... or a boolean value
-                    else if ('boolean' == typeof validateResult) {
+                    else if ('boolean' === typeof validateResult) {
                         this.updateStatus(updateAll ? field : $field, validateResult ? this.STATUS_VALID : this.STATUS_INVALID, validatorName);
                     }
                 }
@@ -722,7 +726,7 @@
          * @returns {BootstrapValidator}
          */
         updateStatus: function(field, status, validatorName) {
-            var fields = $([]), type;
+            var fields = $([]);
             switch (typeof field) {
                 case 'object':
                     fields = field;
@@ -738,7 +742,7 @@
             var that  = this,
                 type  = fields.attr('type'),
                 group = this.options.fields[field].group || this.options.group,
-                total = ('radio' == type || 'checkbox' == type) ? 1 : fields.length;
+                total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length;
 
             for (var i = 0; i < total; i++) {
                 var $field       = fields.eq(i),
@@ -796,10 +800,10 @@
 
                     case this.STATUS_VALID:
                         // If the field is valid (passes all validators)
-                        isValidField = ($allErrors.filter('[data-bv-result="' + this.STATUS_NOT_VALIDATED +'"]').length == 0)
-                                     ? ($allErrors.filter('[data-bv-result="' + this.STATUS_VALID +'"]').length == $allErrors.length)   // All validators are completed
+                        isValidField = ($allErrors.filter('[data-bv-result="' + this.STATUS_NOT_VALIDATED +'"]').length === 0)
+                                     ? ($allErrors.filter('[data-bv-result="' + this.STATUS_VALID +'"]').length === $allErrors.length)  // All validators are completed
                                      : null;                                                                                            // There are some validators that have not done
-                        if (isValidField != null) {
+                        if (isValidField !== null) {
                             this.disableSubmitButtons(this.$submitButton ? !this.isValid() : !isValidField);
                             if ($icon) {
                                 $icon
@@ -816,6 +820,7 @@
                         break;
 
                     case this.STATUS_NOT_VALIDATED:
+                    /* falls through */
                     default:
                         isValidField = null;
                         this.disableSubmitButtons(false);
@@ -831,7 +836,7 @@
 
                 switch (true) {
                     // Only show the first error message if it is placed inside a tooltip ...
-                    case ($icon && 'tooltip' == container):
+                    case ($icon && 'tooltip' === container):
                         (isValidField === false)
                                 ? $icon.css('cursor', 'pointer').tooltip('destroy').tooltip({
                                     html: true,
@@ -841,7 +846,7 @@
                                 : $icon.css('cursor', '').tooltip('destroy');
                         break;
                     // ... or popover
-                    case ($icon && 'popover' == container):
+                    case ($icon && 'popover' === container):
                         (isValidField === false)
                                 ? $icon.css('cursor', 'pointer').popover('destroy').popover({
                                     content: $allErrors.filter('[data-bv-result="' + that.STATUS_INVALID + '"]').eq(0).html(),
@@ -852,7 +857,7 @@
                                 : $icon.css('cursor', '').popover('destroy');
                         break;
                     default:
-                        (status == this.STATUS_INVALID) ? $errors.show() : $errors.hide();
+                        (status === this.STATUS_INVALID) ? $errors.show() : $errors.hide();
                         break;
                 }
 
@@ -902,12 +907,12 @@
                 default:
                     break;
             }
-            if (fields.length == 0 || this.options.fields[field] == null || this.options.fields[field]['enabled'] == false) {
+            if (fields.length === 0 || this.options.fields[field] === null || this.options.fields[field].enabled === false) {
                 return true;
             }
 
             var type  = fields.attr('type'),
-                total = ('radio' == type || 'checkbox' == type) ? 1 : fields.length,
+                total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length,
                 $field, validatorName, status;
             for (var i = 0; i < total; i++) {
                 $field = fields.eq(i);
@@ -917,7 +922,7 @@
 
                 for (validatorName in this.options.fields[field].validators) {
                     status = $field.data('bv.result.' + validatorName);
-                    if (status != this.STATUS_VALID) {
+                    if (status !== this.STATUS_VALID) {
                         return false;
                     }
                 }
@@ -948,9 +953,9 @@
                       .find('.help-block[data-bv-validator][data-bv-for="' + field + '"]')
                       .filter(function() {
                           var v = $(this).attr('data-bv-validator');
-                          return ($f.data('bv.result.' + v) && $f.data('bv.result.' + v) != that.STATUS_VALID);
+                          return ($f.data('bv.result.' + v) && $f.data('bv.result.' + v) !== that.STATUS_VALID);
                       })
-                      .length != 0)
+                      .length !== 0)
                 {
                     // The field is not valid
                     return false;
@@ -1013,14 +1018,14 @@
                 $fields  = $([]);
 
             switch (true) {
-                case (field && 'object' == typeof field):
+                case (field && 'object' === typeof field):
                     $fields = field;
                     break;
-                case (field && 'string' == typeof field):
+                case (field && 'string' === typeof field):
                     var f = this.getFieldElements(field);
                     if (f.length > 0) {
                         var type = f.attr('type');
-                        $fields = ('radio' == type || 'checkbox' == type) ? f.eq(0) : f;
+                        $fields = ('radio' === type || 'checkbox' === type) ? f.eq(0) : f;
                     }
                     break;
                 default:
@@ -1034,7 +1039,7 @@
                         .data('bv.messages')
                         .find('.help-block[data-bv-for="' + $(this).attr('data-bv-field') + '"][data-bv-result="' + that.STATUS_INVALID + '"]')
                         .map(function() {
-                            return $(this).html()
+                            return $(this).html();
                         })
                         .get()
                 );
@@ -1068,14 +1073,14 @@
             fields.attr('data-bv-field', field);
 
             var type  = fields.attr('type'),
-                total = ('radio' == type || 'checkbox' == type) ? 1 : fields.length;
+                total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length;
 
             for (var i = 0; i < total; i++) {
                 var $field = fields.eq(i);
 
                 // Try to parse the options from HTML attributes
                 var opts = this._parseOptions($field);
-                opts = (opts == null) ? options : $.extend(true, options, opts);
+                opts = (opts === null) ? options : $.extend(true, options, opts);
 
                 this.options.fields[field] = $.extend(true, this.options.fields[field], opts);
 
@@ -1083,7 +1088,7 @@
                 this._cacheFields[field] = this._cacheFields[field] ? this._cacheFields[field].add($field) : $field;
 
                 // Init the element
-                this._initField(('checkbox' == type || 'radio' == type) ? field : $field);
+                this._initField(('checkbox' === type || 'radio' === type) ? field : $field);
             }
 
             this.disableSubmitButtons(false);
@@ -1118,12 +1123,12 @@
                     break;
             }
 
-            if (fields.length == 0) {
+            if (fields.length === 0) {
                 return this;
             }
 
             var type  = fields.attr('type'),
-                total = ('radio' == type || 'checkbox' == type) ? 1 : fields.length;
+                total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length;
 
             for (var i = 0; i < total; i++) {
                 var $field = fields.eq(i);
@@ -1135,10 +1140,10 @@
                 this._cacheFields[field] = this._cacheFields[field].not($field);
             }
 
-            if (!this._cacheFields[field] || this._cacheFields[field].length == 0) {
+            if (!this._cacheFields[field] || this._cacheFields[field].length === 0) {
                 delete this.options.fields[field];
             }
-            if ('checkbox' == type || 'radio' == type) {
+            if ('checkbox' === type || 'radio' === type) {
                 this._initField(field);
             }
 
@@ -1175,7 +1180,7 @@
 
                 if (resetFormData) {
                     type = fields.attr('type');
-                    ('radio' == type || 'checkbox' == type) ? fields.removeAttr('checked').removeAttr('selected') : fields.val('');
+                    ('radio' === type || 'checkbox' === type) ? fields.removeAttr('checked').removeAttr('selected') : fields.val('');
                 }
             }
 
@@ -1210,8 +1215,8 @@
          * @returns {BootstrapValidator}
          */
         enableFieldValidators: function(field, enabled) {
-            if (this.options.fields[field]['enabled'] != enabled) {
-                this.options.fields[field]['enabled'] = enabled;
+            if (this.options.fields[field].enabled !== enabled) {
+                this.options.fields[field].enabled = enabled;
                 this.updateStatus(field, this.STATUS_NOT_VALIDATED);
             }
 
@@ -1284,14 +1289,14 @@
         return this.each(function() {
             var $this   = $(this),
                 data    = $this.data('bootstrapValidator'),
-                options = 'object' == typeof option && option;
+                options = 'object' === typeof option && option;
             if (!data) {
                 data = new BootstrapValidator(this, options);
                 $this.data('bootstrapValidator', data);
             }
 
             // Allow to call plugin method
-            if ('string' == typeof option) {
+            if ('string' === typeof option) {
                 data[option].apply(data, Array.prototype.slice.call(params, 1));
             }
         });
@@ -1439,12 +1444,12 @@
                 return false;
             }
 
-            if (year < 1000 || year > 9999 || month == 0 || month > 12) {
+            if (year < 1000 || year > 9999 || month === 0 || month > 12) {
                 return false;
             }
             var numDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
             // Update the number of days in Feb of leap year
-            if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
+            if (year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0)) {
                 numDays[1] = 29;
             }
 
@@ -1459,8 +1464,8 @@
                     currentMonth = currentDate.getMonth(),
                     currentDay   = currentDate.getDate();
                 return (year < currentYear
-                        || (year == currentYear && month - 1 < currentMonth)
-                        || (year == currentYear && month - 1 == currentMonth && day < currentDay));
+                        || (year === currentYear && month - 1 < currentMonth)
+                        || (year === currentYear && month - 1 === currentMonth && day < currentDay));
             }
 
             return true;
@@ -1494,26 +1499,26 @@
          * @param {String} value
          * @returns {Boolean}
          */
-        mod_11_10: function(value) {
+        mod11And10: function(value) {
             var check  = 5,
                 length = value.length;
             for (var i = 0; i < length; i++) {
                 check = (((check || 10) * 2) % 11 + parseInt(value.charAt(i), 10)) % 10;
             }
-            return (check == 1);
+            return (check === 1);
         },
 
         /**
          * Implements Mod 37, 36 (ISO 7064) algorithm
          * Usages:
-         * mod_37_36('A12425GABC1234002M')
-         * mod_37_36('002006673085', '0123456789')
+         * mod37And36('A12425GABC1234002M')
+         * mod37And36('002006673085', '0123456789')
          *
          * @param {String} value
-         * @param {String} alphabet
+         * @param {String} [alphabet]
          * @returns {Boolean}
          */
-        mod_37_36: function(value, alphabet) {
+        mod37And36: function(value, alphabet) {
             alphabet = alphabet || '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
             var modulus = alphabet.length,
                 length  = value.length,
@@ -1521,7 +1526,7 @@
             for (var i = 0; i < length; i++) {
                 check = (((check || modulus) * 2) % (modulus + 1) + alphabet.indexOf(value.charAt(i))) % modulus;
             }
-            return (check == 1);
+            return (check === 1);
         }
     };
 }(window.jQuery));

+ 1 - 1
src/js/languages/en_US.js

@@ -244,7 +244,7 @@
             'default': 'Please enter a valid SIRET number'
         },
         step: {
-            'default': 'Please enter a valid step of %s',
+            'default': 'Please enter a valid step of %s'
         },
         stringCase: {
             'default': 'Please enter only lowercase characters',

+ 1 - 1
src/js/languages/vi_VN.js

@@ -14,7 +14,7 @@
             'default': 'Vui lòng nhập giá trị hợp lệ',
             less: 'Vui lòng chọn ít nhất %s lựa chọn',
             more: 'Vui lòng chọn nhiều nhất %s lựa chọn',
-            between: 'Vui lòng chọn %s - %s lựa chọn',
+            between: 'Vui lòng chọn %s - %s lựa chọn'
         },
         creditCard: {
             'default': 'Vui lòng nhập số thẻ tín dụng hợp lệ'

+ 1 - 1
src/js/validator/base64.js

@@ -15,7 +15,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 

+ 4 - 4
src/js/validator/between.js

@@ -4,7 +4,7 @@
         notInclusive: 'Please enter a value between %s and %s strictly',
 
         getMessage: function(options) {
-            return (options.inclusive === true || options.inclusive == undefined)
+            return (options.inclusive === true || options.inclusive === undefined)
                     ? $.fn.bootstrapValidator.helpers.format(this['default'], [options.min, options.max])
                     : $.fn.bootstrapValidator.helpers.format(this.notInclusive, [options.min, options.max]);
         }
@@ -19,7 +19,7 @@
         },
 
         enableByHtml5: function($field) {
-            if ('range' == $field.attr('type')) {
+            if ('range' === $field.attr('type')) {
                 return {
                     min: $field.attr('min'),
                     max: $field.attr('max')
@@ -43,12 +43,12 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             value = parseFloat(value);
-			return (options.inclusive === true || options.inclusive == undefined)
+			return (options.inclusive === true || options.inclusive === undefined)
 				    ? (value >= options.min && value <= options.max)
 				    : (value > options.min && value < options.max);
         }

+ 2 - 2
src/js/validator/callback.js

@@ -21,10 +21,10 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (options.callback && 'function' == typeof options.callback) {
+            if (options.callback && 'function' === typeof options.callback) {
                 var dfd      = new $.Deferred(),
                     response = options.callback.call(this, value, validator, $field);
-                dfd.resolve($field, 'callback', 'boolean' == typeof response ? response : response.valid, 'object' == typeof response && response.message ? response.message : null);
+                dfd.resolve($field, 'callback', 'boolean' === typeof response ? response : response.valid, 'object' === typeof response && response.message ? response.message : null);
                 return dfd;
             }
             return true;

+ 0 - 1
src/js/validator/choice.js

@@ -9,7 +9,6 @@
             switch (true) {
                 case (!!options.min && !!options.max):
                     return $.fn.bootstrapValidator.helpers.format(this.between, [options.min, options.max]);
-                    break;
                 case (!!options.min):
                     return $.fn.bootstrapValidator.helpers.format(this.less, [options.min]);
                 case (!!options.max):

+ 5 - 5
src/js/validator/creditCard.js

@@ -10,13 +10,13 @@
          *
          * @param {BootstrapValidator} validator The validator plugin instance
          * @param {jQuery} $field Field element
-         * @param {Object} options Can consist of the following key:
+         * @param {Object} [options] Can consist of the following key:
          * - message: The invalid message
          * @returns {Boolean}
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -88,9 +88,9 @@
 
             var type, i;
             for (type in cards) {
-                for (i in cards[type]['prefix']) {
-                    if (value.substr(0, cards[type]['prefix'][i].length) == cards[type]['prefix'][i]    // Check the prefix
-                        && $.inArray(value.length, cards[type]['length']) != -1)                        // and length
+                for (i in cards[type].prefix) {
+                    if (value.substr(0, cards[type].prefix[i].length) === cards[type].prefix[i]     // Check the prefix
+                        && $.inArray(value.length, cards[type].length) !== -1)                      // and length
                     {
                         return true;
                     }

+ 5 - 5
src/js/validator/cusip.js

@@ -13,13 +13,13 @@
          * @see http://en.wikipedia.org/wiki/CUSIP
          * @param {BootstrapValidator} validator The validator plugin instance
          * @param {jQuery} $field Field element
-         * @param {Object} options Can consist of the following keys:
+         * @param {Object} [options] Can consist of the following keys:
          * - message: The invalid message
          * @returns {Boolean}
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -38,8 +38,8 @@
                 length    = converted.length,
                 sum       = 0;
             for (var i = 0; i < length - 1; i++) {
-                var num = parseInt(converted[i]);
-                if (i % 2 != 0) {
+                var num = parseInt(converted[i], 10);
+                if (i % 2 !== 0) {
                     num *= 2;
                 }
                 if (num > 9) {
@@ -49,7 +49,7 @@
             }
 
             sum = (10 - (sum % 10)) % 10;
-            return sum == converted[length - 1];
+            return sum === converted[length - 1];
         }
     };
 }(window.jQuery));

+ 7 - 7
src/js/validator/cvv.js

@@ -21,7 +21,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -35,7 +35,7 @@
 
             // Get the credit card number
             var creditCard = validator.getFieldElements(options.creditCardField).val();
-            if (creditCard == '') {
+            if (creditCard === '') {
                 return true;
             }
             
@@ -98,9 +98,9 @@
             };
             var type, i, creditCardType = null;
             for (type in cards) {
-                for (i in cards[type]['prefix']) {
-                    if (creditCard.substr(0, cards[type]['prefix'][i].length) == cards[type]['prefix'][i]   // Check the prefix
-                        && $.inArray(creditCard.length, cards[type]['length']) != -1)                       // and length
+                for (i in cards[type].prefix) {
+                    if (creditCard.substr(0, cards[type].prefix[i].length) === cards[type].prefix[i]    // Check the prefix
+                        && $.inArray(creditCard.length, cards[type].length) !== -1)                     // and length
                     {
                         creditCardType = type;
                         break;
@@ -108,9 +108,9 @@
                 }
             }
 
-            return (creditCardType == null)
+            return (creditCardType === null)
                         ? false
-                        : (('AMERICAN_EXPRESS' == creditCardType) ? (value.length == 4) : (value.length == 3));
+                        : (('AMERICAN_EXPRESS' === creditCardType) ? (value.length === 4) : (value.length === 3));
         }
     };
 }(window.jQuery));

+ 6 - 6
src/js/validator/date.js

@@ -30,7 +30,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -44,16 +44,16 @@
                 date       = sections[0],
                 time       = (sections.length > 1) ? sections[1] : null;
 
-            if (formats.length != sections.length) {
+            if (formats.length !== sections.length) {
                 return false;
             }
 
             // Determine the separator
             var separator = options.separator;
             if (!separator) {
-                separator = (date.indexOf('/') != -1) ? '/' : ((date.indexOf('-') != -1) ? '-' : null);
+                separator = (date.indexOf('/') !== -1) ? '/' : ((date.indexOf('-') !== -1) ? '-' : null);
             }
-            if (separator == null || date.indexOf(separator) == -1) {
+            if (separator === null || date.indexOf(separator) === -1) {
                 return false;
             }
 
@@ -67,10 +67,10 @@
             // Determine the time
             var minutes = null, hours = null, seconds = null;
             if (timeFormat) {
-                timeFormat = timeFormat.split(':'),
+                timeFormat = timeFormat.split(':');
                 time       = time.split(':');
 
-                if (timeFormat.length != time.length) {
+                if (timeFormat.length !== time.length) {
                     return false;
                 }
 

+ 3 - 3
src/js/validator/different.js

@@ -21,16 +21,16 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             var compareWith = validator.getFieldElements(options.field);
-            if (compareWith == null) {
+            if (compareWith === null) {
                 return true;
             }
 
-            if (value != compareWith.val()) {
+            if (value !== compareWith.val()) {
                 validator.updateStatus(options.field, validator.STATUS_VALID, 'different');
                 return true;
             } else {

+ 3 - 3
src/js/validator/digits.js

@@ -9,16 +9,16 @@
          *
          * @param {BootstrapValidator} validator Validate plugin instance
          * @param {jQuery} $field Field element
-         * @param {Object} options
+         * @param {Object} [options]
          * @returns {Boolean}
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             return /^\d+$/.test(value);
         }
-    }
+    };
 }(window.jQuery));

+ 4 - 4
src/js/validator/ean.js

@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -29,12 +29,12 @@
 
             var length = value.length,
                 sum    = 0,
-                weight = (length == 8) ? [3, 1] : [1, 3];
+                weight = (length === 8) ? [3, 1] : [1, 3];
             for (var i = 0; i < length - 1; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i % 2];
+                sum += parseInt(value.charAt(i), 10) * weight[i % 2];
             }
             sum = (10 - sum % 10) % 10;
-            return (sum == value.charAt(length - 1));
+            return (sum + '' === value.charAt(length - 1));
         }
     };
 }(window.jQuery));

+ 4 - 4
src/js/validator/emailAddress.js

@@ -5,7 +5,7 @@
 
     $.fn.bootstrapValidator.validators.emailAddress = {
         enableByHtml5: function($field) {
-            return ('email' == $field.attr('type'));
+            return ('email' === $field.attr('type'));
         },
 
         /**
@@ -13,12 +13,12 @@
          *
          * @param {BootstrapValidator} validator Validate plugin instance
          * @param {jQuery} $field Field element
-         * @param {Object} options
+         * @param {Object} [options]
          * @returns {Boolean}
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -27,5 +27,5 @@
             var emailRegExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
             return emailRegExp.test(value);
         }
-    }
+    };
 }(window.jQuery));

+ 5 - 5
src/js/validator/file.js

@@ -25,7 +25,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -40,25 +40,25 @@
                     total = files.length;
                 for (var i = 0; i < total; i++) {
                     // Check file size
-                    if (options.maxSize && files[i].size > parseInt(options.maxSize)) {
+                    if (options.maxSize && files[i].size > parseInt(options.maxSize, 10)) {
                         return false;
                     }
 
                     // Check file extension
                     ext = files[i].name.substr(files[i].name.lastIndexOf('.') + 1);
-                    if (extensions && $.inArray(ext.toLowerCase(), extensions) == -1) {
+                    if (extensions && $.inArray(ext.toLowerCase(), extensions) === -1) {
                         return false;
                     }
 
                     // Check file type
-                    if (types && $.inArray(files[i].type.toLowerCase(), types) == -1) {
+                    if (types && $.inArray(files[i].type.toLowerCase(), types) === -1) {
                         return false;
                     }
                 }
             } else {
                 // Check file extension
                 ext = value.substr(value.lastIndexOf('.') + 1);
-                if (extensions && $.inArray(ext.toLowerCase(), extensions) == -1) {
+                if (extensions && $.inArray(ext.toLowerCase(), extensions) === -1) {
                     return false;
                 }
             }

+ 4 - 4
src/js/validator/greaterThan.js

@@ -4,7 +4,7 @@
         notInclusive: 'Please enter a value greater than %s',
 
         getMessage: function(options) {
-            return (options.inclusive === true || options.inclusive == undefined)
+            return (options.inclusive === true || options.inclusive === undefined)
                     ? $.fn.bootstrapValidator.helpers.format(this['default'], options.value)
                     : $.fn.bootstrapValidator.helpers.format(this.notInclusive, options.value);
         }
@@ -41,11 +41,11 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
             value = parseFloat(value);
-			return (options.inclusive === true || options.inclusive == undefined) ? (value >= options.value) : (value > options.value);
+			return (options.inclusive === true || options.inclusive === undefined) ? (value >= options.value) : (value > options.value);
         }
-    }
+    };
 }(window.jQuery));

+ 3 - 3
src/js/validator/grid.js

@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -28,10 +28,10 @@
                 return false;
             }
             value = value.replace(/\s/g, '').replace(/-/g, '');
-            if ('GRID:' == value.substr(0, 5)) {
+            if ('GRID:' === value.substr(0, 5)) {
                 value = value.substr(5);
             }
-            return $.fn.bootstrapValidator.helpers.mod_37_36(value);
+            return $.fn.bootstrapValidator.helpers.mod37And36(value);
         }
     };
 }(window.jQuery));

+ 1 - 1
src/js/validator/hex.js

@@ -15,7 +15,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 

+ 2 - 2
src/js/validator/hexColor.js

@@ -5,7 +5,7 @@
 
     $.fn.bootstrapValidator.validators.hexColor = {
         enableByHtml5: function($field) {
-            return ('color' == $field.attr('type'));
+            return ('color' === $field.attr('type'));
         },
 
         /**
@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
             return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(value);

+ 2 - 2
src/js/validator/iban.js

@@ -205,7 +205,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -233,7 +233,7 @@
             for (var i = 1; i < length; ++i) {
                 temp = (temp * 10 + parseInt(value.substr(i, 1), 10)) % 97;
             }
-            return (temp == 1);
+            return (temp === 1);
         }
     };
 }(window.jQuery));

+ 74 - 74
src/js/validator/id.js

@@ -35,7 +35,7 @@
             if (options.country) {
                 var country = options.country.toLowerCase(),
                     method  = ['_', country].join('');
-                if ($.fn.bootstrapValidator.validators.id[method] == undefined) {
+                if ($.fn.bootstrapValidator.validators.id[method] === undefined) {
                     return $.fn.bootstrapValidator.helpers.format(this.countryNotSupported, country);
                 }
 
@@ -68,13 +68,13 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             var country = options.country || value.substr(0, 2),
                 method  = ['_', country.toLowerCase()].join('');
-            if (this[method] && 'function' == typeof this[method]) {
+            if (this[method] && 'function' === typeof this[method]) {
                 return this[method](value);
             }
 
@@ -113,13 +113,13 @@
             // Validate checksum
             var sum = 0;
             for (var i = 0; i < 6; i++) {
-                sum += (7 - i) * (parseInt(value.charAt(i)) + parseInt(value.charAt(i + 6)));
+                sum += (7 - i) * (parseInt(value.charAt(i), 10) + parseInt(value.charAt(i + 6), 10));
             }
             sum = 11 - sum % 11;
-            if (sum == 10 || sum == 11) {
+            if (sum === 10 || sum === 11) {
                 sum = 0;
             }
-            if (sum != k) {
+            if (sum !== k) {
                 return false;
             }
 
@@ -203,10 +203,10 @@
             var sum    = 0,
                 weight = [2, 4, 8, 5, 10, 9, 7, 3, 6];
             for (var i = 0; i < 9; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = (sum % 11) % 10;
-            return (sum == value.substr(9, 1));
+            return (sum + '' === value.substr(9, 1));
         },
 
         /**
@@ -230,26 +230,26 @@
 
             var d1 = 0;
             for (var i = 0; i < 9; i++) {
-                d1 += (10 - i) * parseInt(value.charAt(i));
+                d1 += (10 - i) * parseInt(value.charAt(i), 10);
             }
             d1 = 11 - d1 % 11;
-            if (d1 == 10 || d1 == 11) {
+            if (d1 === 10 || d1 === 11) {
                 d1 = 0;
             }
-            if (d1 != value.charAt(9)) {
+            if (d1 + '' !== value.charAt(9)) {
                 return false;
             }
 
             var d2 = 0;
             for (i = 0; i < 10; i++) {
-                d2 += (11 - i) * parseInt(value.charAt(i));
+                d2 += (11 - i) * parseInt(value.charAt(i), 10);
             }
             d2 = 11 - d2 % 11;
-            if (d2 == 10 || d2 == 11) {
+            if (d2 === 10 || d2 === 11) {
                 d2 = 0;
             }
 
-            return (d2 == value.charAt(10));
+            return (d2 + '' === value.charAt(10));
         },
 
         /**
@@ -269,12 +269,12 @@
             value = value.replace(/\D/g, '').substr(3);
             var length = value.length,
                 sum    = 0,
-                weight = (length == 8) ? [3, 1] : [1, 3];
+                weight = (length === 8) ? [3, 1] : [1, 3];
             for (var i = 0; i < length - 1; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i % 2];
+                sum += parseInt(value.charAt(i), 10) * weight[i % 2];
             }
             sum = 10 - sum % 10;
-            return (sum == value.charAt(length - 1));
+            return (sum + '' === value.charAt(length - 1));
         },
 
         /**
@@ -298,15 +298,15 @@
             var sum    = 0,
                 weight = [3, 2, 7, 6, 5, 4, 3, 2];
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = 11 - sum % 11;
-            if (sum == 11) {
+            if (sum === 11) {
                 sum = 0;
-            } else if (sum == 10) {
+            } else if (sum === 10) {
                 sum = 'K';
             }
-            return sum == value.charAt(8);
+            return sum + '' === value.charAt(8);
         },
 
         /**
@@ -322,10 +322,10 @@
             if (!/^\d{9,10}$/.test(value)) {
                 return false;
             }
-            var year  = 1900 + parseInt(value.substr(0, 2)),
-                month = parseInt(value.substr(2, 2)) % 50 % 20,
-                day   = parseInt(value.substr(4, 2));
-            if (value.length == 9) {
+            var year  = 1900 + parseInt(value.substr(0, 2), 10),
+                month = parseInt(value.substr(2, 2), 10) % 50 % 20,
+                day   = parseInt(value.substr(4, 2), 10);
+            if (value.length === 9) {
                 if (year >= 1980) {
                     year -= 100;
                 }
@@ -341,12 +341,12 @@
             }
 
             // Check that the birth date is not in the future
-            if (value.length == 10) {
+            if (value.length === 10) {
                 var check = parseInt(value.substr(0, 9), 10) % 11;
                 if (year < 1985) {
                     check = check % 10;
                 }
-                return (check == value.substr(9, 1));
+                return (check + '' === value.substr(9, 1));
             }
 
             return true;
@@ -372,11 +372,11 @@
                 year  = parseInt(value.substr(4, 2), 10);
 
             switch (true) {
-                case ('5678'.indexOf(value.charAt(6)) != -1 && year >= 58):
+                case ('5678'.indexOf(value.charAt(6)) !== -1 && year >= 58):
                     year += 1800;
                     break;
-                case ('0123'.indexOf(value.charAt(6)) != -1):
-                case ('49'.indexOf(value.charAt(6)) != -1 && year >= 37):
+                case ('0123'.indexOf(value.charAt(6)) !== -1):
+                case ('49'.indexOf(value.charAt(6)) !== -1 && year >= 37):
                     year += 1900;
                     break;
                 default:
@@ -421,14 +421,14 @@
 
             value = value.replace(/-/g, '');
             var index = 'XYZ'.indexOf(value.charAt(0));
-            if (index != -1) {
+            if (index !== -1) {
                 // It is NIE number
                 value = index + value.substr(1) + '';
             }
 
             var check = parseInt(value.substr(0, 8), 10);
             check = 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23];
-            return (check == value.substr(8, 1));
+            return (check === value.substr(8, 1));
         },
 
         /**
@@ -458,13 +458,13 @@
                 return false;
             }
 
-            var individual = parseInt(value.substr(7, 3));
+            var individual = parseInt(value.substr(7, 3), 10);
             if (individual < 2) {
                 return false;
             }
             var n = value.substr(0, 6) + value.substr(7, 3) + '';
-            n = parseInt(n);
-            return '0123456789ABCDEFHJKLMNPRSTUVWXY'.charAt(n % 31) == value.charAt(10);
+            n = parseInt(n, 10);
+            return '0123456789ABCDEFHJKLMNPRSTUVWXY'.charAt(n % 31) === value.charAt(10);
         },
 
         /**
@@ -480,7 +480,7 @@
             if (!/^[0-9]{11}$/.test(value)) {
                 return false;
             }
-            return $.fn.bootstrapValidator.helpers.mod_11_10(value);
+            return $.fn.bootstrapValidator.helpers.mod11And10(value);
         },
 
         /**
@@ -505,19 +505,19 @@
                 var alphabet = 'WABCDEFGHIJKLMNOPQRSTUV',
                     sum      = 0;
                 for (var i = 0; i < 7; i++) {
-                    sum += parseInt(value.charAt(i)) * (8 - i);
+                    sum += parseInt(value.charAt(i), 10) * (8 - i);
                 }
                 sum += 9 * alphabet.indexOf(value.substr(7));
                 return alphabet[sum % 23];
             };
 
             // 2013 format
-            if (value.length == 9 && ('A' == value.charAt(8) || 'H' == value.charAt(8))) {
-                return value.charAt(7) == getCheckDigit(value.substr(0, 7) + value.substr(8) + '');
+            if (value.length === 9 && ('A' === value.charAt(8) || 'H' === value.charAt(8))) {
+                return value.charAt(7) === getCheckDigit(value.substr(0, 7) + value.substr(8) + '');
             }
             // The old format
             else {
-                return value.charAt(7) == getCheckDigit(value.substr(0, 7));
+                return value.charAt(7) === getCheckDigit(value.substr(0, 7));
             }
         },
 
@@ -538,9 +538,9 @@
             var day     = parseInt(value.substr(0, 2), 10),
                 month   = parseInt(value.substr(2, 2), 10),
                 year    = parseInt(value.substr(4, 2), 10),
-                century = parseInt(value.charAt(9));
+                century = parseInt(value.charAt(9), 10);
 
-            year = (century == 9) ? (1900 + year) : ((20 + century) * 100 + year);
+            year = (century === 9) ? (1900 + year) : ((20 + century) * 100 + year);
             if (!$.fn.bootstrapValidator.helpers.date(year, month, day, true)) {
                 return false;
             }
@@ -548,10 +548,10 @@
             var sum    = 0,
                 weight = [3, 2, 7, 6, 5, 4, 3, 2];
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = 11 - sum % 11;
-            return (sum == value.charAt(8));
+            return (sum + '' === value.charAt(8));
         },
 
         /**
@@ -569,11 +569,11 @@
             if (!/^[0-9]{11}$/.test(value)) {
                 return false;
             }
-            var gender  = parseInt(value.charAt(0)),
+            var gender  = parseInt(value.charAt(0), 10),
                 year    = parseInt(value.substr(1, 2), 10),
                 month   = parseInt(value.substr(3, 2), 10),
                 day     = parseInt(value.substr(5, 2), 10),
-                century = (gender % 2 == 0) ? (17 + gender / 2) : (17 + (gender + 1) / 2);
+                century = (gender % 2 === 0) ? (17 + gender / 2) : (17 + (gender + 1) / 2);
             year = century * 100 + year;
             if (!$.fn.bootstrapValidator.helpers.date(year, month, day, true)) {
                 return false;
@@ -583,24 +583,24 @@
             var sum    = 0,
                 weight = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1];
             for (var i = 0; i < 10; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = sum % 11;
-            if (sum != 10) {
-                return sum == value.charAt(10);
+            if (sum !== 10) {
+                return sum + '' === value.charAt(10);
             }
 
             // Re-calculate the check digit
             sum    = 0;
             weight = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3];
             for (i = 0; i < 10; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = sum % 11;
-            if (sum == 10) {
+            if (sum === 10) {
                 sum = 0;
             }
-            return (sum == value.charAt(10));
+            return (sum + '' === value.charAt(10));
         },
 
         /**
@@ -619,10 +619,10 @@
             }
             value = value.replace(/\D/g, '');
             // Check birth date
-            var day   = parseInt(value.substr(0, 2)),
-                month = parseInt(value.substr(2, 2)),
-                year  = parseInt(value.substr(4, 2));
-            year = year + 1800 + parseInt(value.charAt(6)) * 100;
+            var day   = parseInt(value.substr(0, 2), 10),
+                month = parseInt(value.substr(2, 2), 10),
+                year  = parseInt(value.substr(4, 2), 10);
+            year = year + 1800 + parseInt(value.charAt(6), 10) * 100;
 
             if (!$.fn.bootstrapValidator.helpers.date(year, month, day, true)) {
                 return false;
@@ -632,10 +632,10 @@
             var sum    = 0,
                 weight = [10, 5, 8, 4, 2, 1, 6, 3, 7, 9];
             for (var i = 0; i < 10; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = (sum + 1) % 11 % 10;
-            return (sum == value.charAt(10));
+            return (sum + '' === value.charAt(10));
         },
 
         /**
@@ -656,19 +656,19 @@
                 return false;
             }
             value = value.replace(/\./g, '');
-            if (parseInt(value, 10) == 0) {
+            if (parseInt(value, 10) === 0) {
                 return false;
             }
             var sum    = 0,
                 length = value.length;
             for (var i = 0; i < length - 1; i++) {
-                sum += (9 - i) * parseInt(value.charAt(i));
+                sum += (9 - i) * parseInt(value.charAt(i), 10);
             }
             sum = sum % 11;
-            if (sum == 10) {
+            if (sum === 10) {
                 sum = 0;
             }
-            return (sum == value.charAt(length - 1));
+            return (sum + '' === value.charAt(length - 1));
         },
 
         /**
@@ -685,8 +685,8 @@
             if (!/^[0-9]{13}$/.test(value)) {
                 return false;
             }
-            var gender = parseInt(value.charAt(0));
-            if (gender == 0 || gender == 7 || gender == 8) {
+            var gender = parseInt(value.charAt(0), 10);
+            if (gender === 0 || gender === 7 || gender === 8) {
                 return false;
             }
 
@@ -706,7 +706,7 @@
             if (day > 31 && month > 12) {
                 return false;
             }
-            if (gender != 9) {
+            if (gender !== 9) {
                 year = centuries[gender + ''] + year;
                 if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                     return false;
@@ -718,13 +718,13 @@
                 weight = [2, 7, 9, 1, 4, 6, 3, 5, 8, 2, 7, 9],
                 length = value.length;
             for (var i = 0; i < length - 1; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = sum % 11;
-            if (sum == 10) {
+            if (sum === 10) {
                 sum = 1;
             }
-            return (sum == value.charAt(length - 1));
+            return (sum + '' === value.charAt(length - 1));
         },
 
         /**
@@ -743,9 +743,9 @@
             }
             value = value.replace(/[^0-9]/g, '');
 
-            var year  = parseInt(value.substr(0, 2)) + 1900,
-                month = parseInt(value.substr(2, 2)),
-                day   = parseInt(value.substr(4, 2));
+            var year  = parseInt(value.substr(0, 2), 10) + 1900,
+                month = parseInt(value.substr(2, 2), 10),
+                day   = parseInt(value.substr(4, 2), 10);
             if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                 return false;
             }
@@ -793,10 +793,10 @@
             if (!/^[0-9]{10}[0|1][8|9][0-9]$/.test(value)) {
                 return false;
             }
-            var year        = parseInt(value.substr(0, 2)),
+            var year        = parseInt(value.substr(0, 2), 10),
                 currentYear = new Date().getFullYear() % 100,
-                month       = parseInt(value.substr(2, 2)),
-                day         = parseInt(value.substr(4, 2));
+                month       = parseInt(value.substr(2, 2), 10),
+                day         = parseInt(value.substr(4, 2), 10);
             year = (year >= currentYear) ? (year + 1900) : (year + 2000);
 
             if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {

+ 3 - 3
src/js/validator/identical.js

@@ -20,16 +20,16 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             var compareWith = validator.getFieldElements(options.field);
-            if (compareWith == null) {
+            if (compareWith === null) {
                 return true;
             }
 
-            if (value == compareWith.val()) {
+            if (value === compareWith.val()) {
                 validator.updateStatus(options.field, validator.STATUS_VALID, 'identical');
                 return true;
             } else {

+ 1 - 2
src/js/validator/imei.js

@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -29,7 +29,6 @@
                 case /^\d{2}\s\d{6}\s\d{6}\s\d{1}$/.test(value):
                     value = value.replace(/[^0-9]/g, '');
                     return $.fn.bootstrapValidator.helpers.luhn(value);
-                    break;
 
                 case /^\d{14}$/.test(value):
                 case /^\d{16}$/.test(value):

+ 2 - 2
src/js/validator/integer.js

@@ -5,7 +5,7 @@
 
     $.fn.bootstrapValidator.validators.integer = {
         enableByHtml5: function($field) {
-            return ('number' == $field.attr('type'));
+            return ('number' === $field.attr('type'));
         },
 
         /**
@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
             return /^(?:-?(?:0|[1-9][0-9]*))$/.test(value);

+ 16 - 15
src/js/validator/isbn.js

@@ -17,13 +17,13 @@
          * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number
          * @param {BootstrapValidator} validator The validator plugin instance
          * @param {jQuery} $field Field element
-         * @param {Object} options Can consist of the following keys:
+         * @param {Object} [options] Can consist of the following keys:
          * - message: The invalid message
          * @returns {Boolean}
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -32,13 +32,13 @@
             var type;
             switch (true) {
                 case /^\d{9}[\dX]$/.test(value):
-                case (value.length == 13 && /^(\d+)-(\d+)-(\d+)-([\dX])$/.test(value)):
-                case (value.length == 13 && /^(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(value)):
+                case (value.length === 13 && /^(\d+)-(\d+)-(\d+)-([\dX])$/.test(value)):
+                case (value.length === 13 && /^(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(value)):
                     type = 'ISBN10';
                     break;
                 case /^(978|979)\d{9}[\dX]$/.test(value):
-                case (value.length == 17 && /^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/.test(value)):
-                case (value.length == 17 && /^(978|979)\s(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(value)):
+                case (value.length === 17 && /^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/.test(value)):
+                case (value.length === 17 && /^(978|979)\s(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(value)):
                     type = 'ISBN13';
                     break;
                 default:
@@ -50,32 +50,33 @@
             var chars  = value.split(''),
                 length = chars.length,
                 sum    = 0,
+                i,
                 checksum;
 
             switch (type) {
                 case 'ISBN10':
                     sum = 0;
-                    for (var i = 0; i < length - 1; i++) {
-                        sum += ((10 - i) * parseInt(chars[i]));
+                    for (i = 0; i < length - 1; i++) {
+                        sum += parseInt(chars[i], 10) * (10 - i);
                     }
                     checksum = 11 - (sum % 11);
-                    if (checksum == 11) {
+                    if (checksum === 11) {
                         checksum = 0;
-                    } else if (checksum == 10) {
+                    } else if (checksum === 10) {
                         checksum = 'X';
                     }
-                    return (checksum + '' == chars[length - 1]);
+                    return (checksum + '' === chars[length - 1]);
 
                 case 'ISBN13':
                     sum = 0;
-                    for (var i = 0; i < length - 1; i++) {
-                        sum += ((i % 2 == 0) ? parseInt(chars[i]) : (parseInt(chars[i]) * 3));
+                    for (i = 0; i < length - 1; i++) {
+                        sum += ((i % 2 === 0) ? parseInt(chars[i], 10) : (parseInt(chars[i], 10) * 3));
                     }
                     checksum = 10 - (sum % 10);
-                    if (checksum == 10) {
+                    if (checksum === 10) {
                         checksum = '0';
                     }
-                    return (checksum + '' == chars[length - 1]);
+                    return (checksum + '' === chars[length - 1]);
 
                 default:
                     return false;

+ 5 - 5
src/js/validator/isin.js

@@ -23,7 +23,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -43,17 +43,17 @@
 
             var digits = '',
                 n      = converted.length,
-                group  = (n % 2 != 0) ? 0 : 1;
+                group  = (n % 2 !== 0) ? 0 : 1;
             for (i = 0; i < n; i++) {
-                digits += (parseInt(converted[i]) * ((i % 2) == group ? 2 : 1) + '');
+                digits += (parseInt(converted[i], 10) * ((i % 2) === group ? 2 : 1) + '');
             }
 
             var sum = 0;
             for (i = 0; i < digits.length; i++) {
-                sum += parseInt(digits.charAt(i));
+                sum += parseInt(digits.charAt(i), 10);
             }
             sum = (10 - (sum % 10)) % 10;
-            return sum == value.charAt(length - 1);
+            return sum + '' === value.charAt(length - 1);
         }
     };
 }(window.jQuery));

+ 4 - 4
src/js/validator/ismn.js

@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -40,7 +40,7 @@
                     return false;
             }
 
-            if ('ISMN10' == type) {
+            if ('ISMN10' === type) {
                 value = '9790' + value.substr(1);
             }
 
@@ -50,10 +50,10 @@
                 sum    = 0,
                 weight = [1, 3];
             for (var i = 0; i < length - 1; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i % 2];
+                sum += parseInt(value.charAt(i), 10) * weight[i % 2];
             }
             sum = 10 - sum % 10;
-            return (sum == value.charAt(length - 1));
+            return (sum + '' === value.charAt(length - 1));
         }
     };
 }(window.jQuery));

+ 4 - 4
src/js/validator/issn.js

@@ -19,7 +19,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -34,13 +34,13 @@
                 length = chars.length,
                 sum    = 0;
 
-            if (chars[7] == 'X') {
+            if (chars[7] === 'X') {
                 chars[7] = 10;
             }
             for (var i = 0; i < length; i++) {
-                sum += ((8 - i) * parseInt(chars[i]));
+                sum += parseInt(chars[i], 10) * (8 - i);
             }
-            return (sum % 11 == 0);
+            return (sum % 11 === 0);
         }
     };
 }(window.jQuery));

+ 3 - 3
src/js/validator/lessThan.js

@@ -4,7 +4,7 @@
         notInclusive: 'Please enter a value less than %s',
 
         getMessage: function(options) {
-            return (options.inclusive === true || options.inclusive == undefined)
+            return (options.inclusive === true || options.inclusive === undefined)
                     ? $.fn.bootstrapValidator.helpers.format(this['default'], options.value)
                     : $.fn.bootstrapValidator.helpers.format(this.notInclusive, options.value);
         }
@@ -41,11 +41,11 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
             value = parseFloat(value);
-            return (options.inclusive === true || options.inclusive == undefined) ? (value <= options.value) : (value < options.value);
+            return (options.inclusive === true || options.inclusive === undefined) ? (value <= options.value) : (value < options.value);
         }
     };
 }(window.jQuery));

+ 1 - 1
src/js/validator/mac.js

@@ -15,7 +15,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 

+ 3 - 3
src/js/validator/notEmpty.js

@@ -6,7 +6,7 @@
     $.fn.bootstrapValidator.validators.notEmpty = {
         enableByHtml5: function($field) {
             var required = $field.attr('required') + '';
-            return ('required' == required || 'true' == required);
+            return ('required' === required || 'true' === required);
         },
 
         /**
@@ -19,14 +19,14 @@
          */
         validate: function(validator, $field, options) {
             var type = $field.attr('type');
-            if ('radio' == type || 'checkbox' == type) {
+            if ('radio' === type || 'checkbox' === type) {
                 return validator
                             .getFieldElements($field.attr('data-bv-field'))
                             .filter(':checked')
                             .length > 0;
             }
 
-            return $.trim($field.val()) != '';
+            return $.trim($field.val()) !== '';
         }
     };
 }(window.jQuery));

+ 2 - 2
src/js/validator/numeric.js

@@ -21,11 +21,11 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
             var separator = options.separator || '.';
-            if (separator != '.') {
+            if (separator !== '.') {
                 value = value.replace(separator, '.');
             }
 

+ 6 - 5
src/js/validator/phone.js

@@ -10,7 +10,7 @@
 
         getMessage: function(options) {
             var country = (options.country || 'US').toUpperCase();
-            if ($.inArray(country, $.fn.bootstrapValidator.validators.phone.COUNTRIES) == -1) {
+            if ($.inArray(country, $.fn.bootstrapValidator.validators.phone.COUNTRIES) === -1) {
                 return $.fn.bootstrapValidator.helpers.format(this.countryNotSupported, country);
             }
 
@@ -45,12 +45,12 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             var country = (options.country || 'US').toUpperCase();
-            if ($.inArray(country, this.COUNTRIES) == -1) {
+            if ($.inArray(country, this.COUNTRIES) === -1) {
                 return false;
             }
 
@@ -61,14 +61,15 @@
             		value = $.trim(value);
             		return (/^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/).test(value);
                 case 'US':
+                /* falls through */
                 default:
                     // Make sure US phone numbers have 10 digits
                     // May start with 1, +1, or 1-; should discard
                     // Area code may be delimited with (), & sections may be delimited with . or -
                     // Test: http://regexr.com/38mqi
                     value = value.replace(/\D/g, '');
-                    return (/^(?:(1\-?)|(\+1 ?))?\(?(\d{3})[\)\-\.]?(\d{3})[\-\.]?(\d{4})$/).test(value) && (value.length == 10);
+                    return (/^(?:(1\-?)|(\+1 ?))?\(?(\d{3})[\)\-\.]?(\d{3})[\-\.]?(\d{4})$/).test(value) && (value.length === 10);
             }
         }
-    }
+    };
 }(window.jQuery));

+ 2 - 2
src/js/validator/regexp.js

@@ -31,11 +31,11 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
-            var regexp = ('string' == typeof options.regexp) ? new RegExp(options.regexp) : options.regexp;
+            var regexp = ('string' === typeof options.regexp) ? new RegExp(options.regexp) : options.regexp;
             return regexp.test(value);
         }
     };

+ 3 - 3
src/js/validator/remote.js

@@ -28,7 +28,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -38,12 +38,12 @@
                 type = options.type || 'POST';
 
             // Support dynamic data
-            if ('function' == typeof data) {
+            if ('function' === typeof data) {
                 data = data.call(this, validator);
             }
 
             // Support dynamic url
-            if ('function' == typeof url) {
+            if ('function' === typeof url) {
                 url = url.call(this, validator);
             }
 

+ 2 - 2
src/js/validator/rtn.js

@@ -18,7 +18,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -32,7 +32,7 @@
                     +  parseInt(value.charAt(i + 1), 10) * 7
                     +  parseInt(value.charAt(i + 2), 10);
             }
-            return (sum != 0 && sum % 10 == 0);
+            return (sum !== 0 && sum % 10 === 0);
         }
     };
 }(window.jQuery));

+ 2 - 2
src/js/validator/sedol.js

@@ -18,7 +18,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -34,7 +34,7 @@
 	            sum += weight[i] * parseInt(value.charAt(i), 36);
 	        }
 	        sum = (10 - sum % 10) % 10;
-            return sum == value.charAt(length - 1);
+            return sum + '' === value.charAt(length - 1);
         }
     };
 }(window.jQuery));

+ 1 - 1
src/js/validator/siren.js

@@ -15,7 +15,7 @@
 		 */
 		validate: function(validator, $field, options) {
 			var value = $field.val();
-			if (value == '') {
+			if (value === '') {
 				return true;
 			}
 

+ 3 - 3
src/js/validator/siret.js

@@ -15,7 +15,7 @@
          */
 		validate: function(validator, $field, options) {
 			var value = $field.val();
-			if (value == '') {
+			if (value === '') {
 				return true;
 			}
 
@@ -24,7 +24,7 @@
                 tmp;
 			for (var i = 0; i < length; i++) {
                 tmp = parseInt(value.charAt(i), 10);
-				if ((i % 2) == 0) {
+				if ((i % 2) === 0) {
 					tmp = tmp * 2;
 					if (tmp > 9) {
 						tmp -= 9;
@@ -32,7 +32,7 @@
 				}
 				sum += tmp;
 			}
-			return (sum % 10 == 0);
+			return (sum % 10 === 0);
 		}
 	};
 }(window.jQuery));

+ 4 - 4
src/js/validator/step.js

@@ -27,7 +27,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -49,17 +49,17 @@
                     }
                 },
                 floatMod = function(x, y) {
-                    if (y == 0.0) {
+                    if (y === 0.0) {
                         return 1.0;
                     }
                     var dotX      = (x + '').split('.'),
                         dotY      = (y + '').split('.'),
-                        precision = ((dotX.length == 1) ? 0 : dotX[1].length) + ((dotY.length == 1) ? 0 : dotY[1].length);
+                        precision = ((dotX.length === 1) ? 0 : dotX[1].length) + ((dotY.length === 1) ? 0 : dotY[1].length);
                     return round(x - y * Math.floor(x / y), precision);
                 };
 
             var mod = floatMod(value - options.baseValue, options.step);
-            return (mod == 0.0 || mod == options.step);
+            return (mod === 0.0 || mod === options.step);
         }
     };
 }(window.jQuery));

+ 3 - 15
src/js/validator/stringCase.js

@@ -5,13 +5,7 @@
 
         getMessage: function(options) {
             var stringCase = (options['case'] || 'lower').toLowerCase();
-            switch (stringCase) {
-                case 'upper':
-                    return this.upper;
-                case 'lower':
-                default:
-                    return this['default'];
-            }
+            return ('upper' === stringCase) ? this.upper : this['default'];
         }
     });
 
@@ -33,18 +27,12 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             var stringCase = (options['case'] || 'lower').toLowerCase();
-            switch (stringCase) {
-                case 'upper':
-                    return value === value.toUpperCase();
-                case 'lower':
-                default:
-                    return value === value.toLowerCase();
-            }
+            return ('upper' === stringCase) ? value === value.toUpperCase() : value === value.toLowerCase();
         }
     };
 }(window.jQuery));

+ 1 - 2
src/js/validator/stringLength.js

@@ -9,7 +9,6 @@
             switch (true) {
                 case (!!options.min && !!options.max):
                     return $.fn.bootstrapValidator.helpers.format(this.between, [options.min, options.max]);
-                    break;
                 case (!!options.min):
                     return $.fn.bootstrapValidator.helpers.format(this.more, options.min);
                 case (!!options.max):
@@ -52,7 +51,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 

+ 3 - 3
src/js/validator/uri.js

@@ -10,7 +10,7 @@
         },
 
         enableByHtml5: function($field) {
-            return ('url' == $field.attr('type'));
+            return ('url' === $field.attr('type'));
         },
 
         /**
@@ -25,7 +25,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -57,7 +57,7 @@
             //
             // - Added exclusion of private, reserved and/or local networks ranges
             //
-            var allowLocal = options.allowLocal == true || options.allowLocal == 'true',
+            var allowLocal = options.allowLocal === true || options.allowLocal === 'true',
                 urlExp     = new RegExp(
                     "^" +
                     // protocol identifier

+ 2 - 2
src/js/validator/uuid.js

@@ -29,7 +29,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -41,7 +41,7 @@
                     all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
                 },
                 version = options.version ? (options.version + '') : 'all';
-            return (null == patterns[version]) ? true : patterns[version].test(value);
+            return (null === patterns[version]) ? true : patterns[version].test(value);
         }
     };
 }(window.jQuery));

+ 139 - 141
src/js/validator/vat.js

@@ -43,7 +43,7 @@
             if (options.country) {
                 var country = options.country,
                     method  = ['_', country.toLowerCase()].join('');
-                if ($.fn.bootstrapValidator.validators.vat[method] == undefined) {
+                if ($.fn.bootstrapValidator.validators.vat[method] === undefined) {
                     return $.fn.bootstrapValidator.helpers.format(this.countryNotSupported, options.country);
                 }
 
@@ -75,13 +75,13 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
             var country = options.country || value.substr(0, 2),
                 method  = ['_', country.toLowerCase()].join('');
-            if (this[method] && 'function' == typeof this[method]) {
+            if (this[method] && 'function' === typeof this[method]) {
                 return this[method](value);
             }
 
@@ -110,7 +110,7 @@
                 temp   = 0;
 
             for (var i = 0; i < 7; i++) {
-                temp = parseInt(value.charAt(i)) * weight[i];
+                temp = parseInt(value.charAt(i), 10) * weight[i];
                 if (temp > 9) {
                     temp = Math.floor(temp / 10) + temp % 10;
                 }
@@ -118,11 +118,11 @@
             }
 
             sum = 10 - (sum + 4) % 10;
-            if (sum == 10) {
+            if (sum === 10) {
                 sum = 0;
             }
 
-            return (sum == value.substr(7, 1));
+            return (sum + '' === value.substr(7, 1));
         },
 
         /**
@@ -140,16 +140,16 @@
             }
 
             value = value.substr(2);
-            if (value.length == 9) {
+            if (value.length === 9) {
                 value = '0' + value;
             }
 
-            if (value.substr(1, 1) == 0) {
+            if (value.substr(1, 1) === '0') {
                 return false;
             }
 
             var sum = parseInt(value.substr(0, 8), 10) + parseInt(value.substr(8, 2), 10);
-            return (sum % 97 == 0);
+            return (sum % 97 === 0);
         },
 
         /**
@@ -170,26 +170,25 @@
             }
 
             value = value.substr(2);
-
-            var total = 0, sum = 0, weight = [], i = 0;
+            var sum = 0, i = 0;
 
             // Legal entities
-            if (value.length == 9) {
+            if (value.length === 9) {
                 for (i = 0; i < 8; i++) {
-                    sum += parseInt(value.charAt(i)) * (i + 1);
+                    sum += parseInt(value.charAt(i), 10) * (i + 1);
                 }
                 sum = sum % 11;
-                if (sum == 10) {
+                if (sum === 10) {
                     sum = 0;
                     for (i = 0; i < 8; i++) {
-                        sum += parseInt(value.charAt(i)) * (i + 3);
+                        sum += parseInt(value.charAt(i), 10) * (i + 3);
                     }
                 }
                 sum = sum % 10;
-                return (sum == value.substr(8));
+                return (sum + '' === value.substr(8));
             }
             // Physical persons, foreigners and others
-            else if (value.length == 10) {
+            else if (value.length === 10) {
                 // Validate Bulgarian national identification numbers
                 var egn = function(value) {
                         // Check the birth date
@@ -211,36 +210,36 @@
                         var sum    = 0,
                             weight = [2, 4, 8, 5, 10, 9, 7, 3, 6];
                         for (var i = 0; i < 9; i++) {
-                            sum += parseInt(value.charAt(i)) * weight[i];
+                            sum += parseInt(value.charAt(i), 10) * weight[i];
                         }
                         sum = (sum % 11) % 10;
-                        return (sum == value.substr(9, 1));
+                        return (sum + '' === value.substr(9, 1));
                     },
                     // Validate Bulgarian personal number of a foreigner
                     pnf = function(value) {
                         var sum    = 0,
                             weight = [21, 19, 17, 13, 11, 9, 7, 3, 1];
                         for (var i = 0; i < 9; i++) {
-                            sum += parseInt(value.charAt(i)) * weight[i];
+                            sum += parseInt(value.charAt(i), 10) * weight[i];
                         }
                         sum = sum % 10;
-                        return (sum == value.substr(9, 1));
+                        return (sum + '' === value.substr(9, 1));
                     },
                     // Finally, consider it as a VAT number
                     vat = function(value) {
                         var sum    = 0,
                             weight = [4, 3, 2, 7, 6, 5, 4, 3, 2];
                         for (var i = 0; i < 9; i++) {
-                            sum += parseInt(value.charAt(i)) * weight[i];
+                            sum += parseInt(value.charAt(i), 10) * weight[i];
                         }
                         sum = 11 - sum % 11;
-                        if (sum == 10) {
+                        if (sum === 10) {
                             return false;
                         }
-                        if (sum == 11) {
+                        if (sum === 11) {
                             sum = 0;
                         }
-                        return (sum == value.substr(9, 1));
+                        return (sum + '' === value.substr(9, 1));
                     };
                 return (egn(value) || pnf(value) || vat(value));
             }
@@ -267,14 +266,14 @@
             }
 
             sum = 11 - sum % 11;
-            if (sum == 10) {
+            if (sum === 10) {
                 return false;
             }
-            if (sum == 11) {
+            if (sum === 11) {
                 sum = 0;
             }
 
-            return (sum == value.substr(8, 1));
+            return (sum + '' === value.substr(8, 1));
         },
 
         /**
@@ -294,7 +293,7 @@
             value = value.substr(2);
 
             // Do not allow to start with "12"
-            if (value.substr(0, 2) == '12') {
+            if (value.substr(0, 2) === '12') {
                 return false;
             }
 
@@ -306,14 +305,14 @@
                 };
             for (var i = 0; i < 8; i++) {
                 var temp = parseInt(value.charAt(i), 10);
-                if (i % 2 == 0) {
+                if (i % 2 === 0) {
                     temp = translation[temp + ''];
                 }
                 sum += temp;
             }
 
             sum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[sum % 26];
-            return (sum == value.substr(8, 1));
+            return (sum + '' === value.substr(8, 1));
         },
 
         /**
@@ -339,9 +338,9 @@
 
             var sum = 0,
                 i   = 0;
-            if (value.length == 8) {
+            if (value.length === 8) {
                 // Do not allow to start with '9'
-                if (value.charAt(0) + '' == '9') {
+                if (value.charAt(0) + '' === '9') {
                     return false;
                 }
 
@@ -350,35 +349,35 @@
                     sum += parseInt(value.charAt(i), 10) * (8 - i);
                 }
                 sum = 11 - sum % 11;
-                if (sum == 10) {
+                if (sum === 10) {
                     sum = 0;
                 }
-                if (sum == 11) {
+                if (sum === 11) {
                     sum = 1;
                 }
 
-                return (sum == value.substr(7, 1));
-            } else if (value.length == 9 && (value.charAt(0) + '' == '6')) {
+                return (sum + '' === value.substr(7, 1));
+            } else if (value.length === 9 && (value.charAt(0) + '' === '6')) {
                 sum = 0;
                 // Skip the first (which is 6)
                 for (i = 0; i < 7; i++) {
                     sum += parseInt(value.charAt(i + 1), 10) * (8 - i);
                 }
                 sum = 11 - sum % 11;
-                if (sum == 10) {
+                if (sum === 10) {
                     sum = 0;
                 }
-                if (sum == 11) {
+                if (sum === 11) {
                     sum = 1;
                 }
                 sum = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 10][sum - 1];
-                return (sum == value.substr(8, 1));
-            } else if (value.length == 9 || value.length == 10) {
+                return (sum + '' === value.substr(8, 1));
+            } else if (value.length === 9 || value.length === 10) {
                 // Validate Czech birth number (Rodné číslo), which is also national identifier
-                var year  = 1900 + parseInt(value.substr(0, 2)),
-                    month = parseInt(value.substr(2, 2)) % 50 % 20,
-                    day   = parseInt(value.substr(4, 2));
-                if (value.length == 9) {
+                var year  = 1900 + parseInt(value.substr(0, 2), 10),
+                    month = parseInt(value.substr(2, 2), 10) % 50 % 20,
+                    day   = parseInt(value.substr(4, 2), 10);
+                if (value.length === 9) {
                     if (year >= 1980) {
                         year -= 100;
                     }
@@ -394,12 +393,12 @@
                 }
 
                 // Check that the birth date is not in the future
-                if (value.length == 10) {
+                if (value.length === 10) {
                     var check = parseInt(value.substr(0, 9), 10) % 11;
                     if (year < 1985) {
                         check = check % 10;
                     }
-                    return (check == value.substr(9, 1));
+                    return (check + '' === value.substr(9, 1));
                 }
 
                 return true;
@@ -423,7 +422,7 @@
             }
 
             value = value.substr(2);
-            return $.fn.bootstrapValidator.helpers.mod_11_10(value);
+            return $.fn.bootstrapValidator.helpers.mod11And10(value);
         },
 
         /**
@@ -447,7 +446,7 @@
                 sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
-            return (sum % 11 == 0);
+            return (sum % 11 === 0);
         },
 
         /**
@@ -469,10 +468,10 @@
                 weight = [3, 7, 1, 3, 7, 1, 3, 7, 1];
 
             for (var i = 0; i < 9; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
-            return (sum % 10 == 0);
+            return (sum % 10 === 0);
         },
 
         /**
@@ -498,37 +497,37 @@
             var dni = function(value) {
                     var check = parseInt(value.substr(0, 8), 10);
                     check = 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23];
-                    return (check == value.substr(8, 1));
+                    return (check + '' === value.substr(8, 1));
                 },
                 nie = function(value) {
                     var check = ['XYZ'.indexOf(value.charAt(0)), value.substr(1)].join('');
                     check = parseInt(check, 10);
                     check = 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23];
-                    return (check == value.substr(8, 1));
+                    return (check + '' === value.substr(8, 1));
                 },
                 cif = function(value) {
                     var first = value.charAt(0), check;
-                    if ('KLM'.indexOf(first) != -1) {
+                    if ('KLM'.indexOf(first) !== -1) {
                         // K: Spanish younger than 14 year old
                         // L: Spanish living outside Spain without DNI
                         // M: Granted the tax to foreigners who have no NIE
                         check = parseInt(value.substr(1, 8), 10);
                         check = 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23];
-                        return (check == value.substr(8, 1));
-                    } else if ('ABCDEFGHJNPQRSUVW'.indexOf(first) != -1) {
+                        return (check + '' === value.substr(8, 1));
+                    } else if ('ABCDEFGHJNPQRSUVW'.indexOf(first) !== -1) {
                         var sum    = 0,
                             weight = [2, 1, 2, 1, 2, 1, 2],
                             temp   = 0;
 
                         for (var i = 0; i < 7; i++) {
-                            temp = parseInt(value.charAt(i + 1)) * weight[i];
+                            temp = parseInt(value.charAt(i + 1), 10) * weight[i];
                             if (temp > 9) {
                                 temp = Math.floor(temp / 10) + temp % 10;
                             }
                             sum += temp;
                         }
                         sum = 10 - sum % 10;
-                        return (sum == value.substr(8, 1) || 'JABCDEFGHI'[sum] == value.substr(8, 1));
+                        return (sum + '' === value.substr(8, 1) || 'JABCDEFGHI'[sum] === value.substr(8, 1));
                     }
 
                     return false;
@@ -563,10 +562,10 @@
                 weight = [7, 9, 10, 5, 8, 4, 2, 1];
 
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
-            return (sum % 11 == 0);
+            return (sum % 11 === 0);
         },
 
         /**
@@ -593,7 +592,7 @@
 
             if (/^[0-9]{2}$/.test(value.substr(0, 2))) {
                 // First two characters are digits
-                return value.substr(0, 2) == (parseInt(value.substr(2) + '12', 10) % 97);
+                return value.substr(0, 2) === (parseInt(value.substr(2) + '12', 10) % 97 + '');
             } else {
                 // The first characters cann't be O and I
                 var alphabet = '0123456789ABCDEFGHJKLMNPQRSTUVWXYZ',
@@ -604,7 +603,7 @@
                 } else {
                     check = alphabet.indexOf(value.charAt(0)) * 34 + alphabet.indexOf(value.charAt(1)) - 100;
                 }
-                return ((parseInt(value.substr(2), 10) + 1 + Math.floor(check / 11)) % 11) == (check % 11);
+                return ((parseInt(value.substr(2), 10) + 1 + Math.floor(check / 11)) % 11) === (check % 11);
             }
         },
 
@@ -618,10 +617,10 @@
          * @returns {Boolean}
          */
         _gb: function(value) {
-            if (!/^GB[0-9]{9}$/.test(value)             // Standard
-                && !/^GB[0-9]{12}$/.test(value)         // Branches
-                && !/^GBGD[0-9]{3}$/.test(value)        // Government department
-                && !/^GBHA[0-9]{3}$/.test(value)        // Health authority
+            if (!/^GB[0-9]{9}$/.test(value)             /* Standard */
+                && !/^GB[0-9]{12}$/.test(value)         /* Branches */
+                && !/^GBGD[0-9]{3}$/.test(value)        /* Government department */
+                && !/^GBHA[0-9]{3}$/.test(value)        /* Health authority */
                 && !/^GB(GD|HA)8888[0-9]{5}$/.test(value))
             {
                 return false;
@@ -629,29 +628,29 @@
 
             value = value.substr(2);
             var length = value.length;
-            if (length == 5) {
+            if (length === 5) {
                 var firstTwo  = value.substr(0, 2),
-                    lastThree = parseInt(value.substr(2));
-                return ('GD' == firstTwo && lastThree < 500) || ('HA' == firstTwo && lastThree >= 500);
-            } else if (length == 11 && ('GD8888' == value.substr(0, 6) || 'HA8888' == value.substr(0, 6))) {
-                if (('GD' == value.substr(0, 2) && parseInt(value.substr(6, 3)) >= 500)
-                    || ('HA' == value.substr(0, 2) && parseInt(value.substr(6, 3)) < 500))
+                    lastThree = parseInt(value.substr(2), 10);
+                return ('GD' === firstTwo && lastThree < 500) || ('HA' === firstTwo && lastThree >= 500);
+            } else if (length === 11 && ('GD8888' === value.substr(0, 6) || 'HA8888' === value.substr(0, 6))) {
+                if (('GD' === value.substr(0, 2) && parseInt(value.substr(6, 3), 10) >= 500)
+                    || ('HA' === value.substr(0, 2) && parseInt(value.substr(6, 3), 10) < 500))
                 {
                     return false;
                 }
-                return (parseInt(value.substr(6, 3)) % 97 == parseInt(value.substr(9, 2)));
-            } else if (length == 9 || length == 12) {
+                return (parseInt(value.substr(6, 3), 10) % 97 === parseInt(value.substr(9, 2), 10));
+            } else if (length === 9 || length === 12) {
                 var sum    = 0,
                     weight = [8, 7, 6, 5, 4, 3, 2, 10, 1];
                 for (var i = 0; i < 9; i++) {
-                    sum += parseInt(value.charAt(i)) * weight[i];
+                    sum += parseInt(value.charAt(i), 10) * weight[i];
                 }
                 sum = sum % 97;
 
-                if (parseInt(value.substr(0, 3)) >= 100) {
-                    return (sum == 0 || sum == 42 || sum == 55);
+                if (parseInt(value.substr(0, 3), 10) >= 100) {
+                    return (sum === 0 || sum === 42 || sum === 55);
                 } else {
-                    return (sum == 0);
+                    return (sum === 0);
                 }
             }
 
@@ -673,18 +672,18 @@
             }
 
             value = value.substr(2);
-            if (value.length == 8) {
+            if (value.length === 8) {
                 value = '0' + value;
             }
 
             var sum    = 0,
                 weight = [256, 128, 64, 32, 16, 8, 4, 2];
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = (sum % 11) % 10;
 
-            return (sum == value.substr(8, 1));
+            return (sum + '' === value.substr(8, 1));
         },
 
         // EL is traditionally prefix of Greek VAT numbers
@@ -716,10 +715,10 @@
                 weight = [9, 7, 3, 1, 9, 7, 3, 1];
 
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
-            return (sum % 10 == 0);
+            return (sum % 10 === 0);
         },
 
         /**
@@ -737,7 +736,7 @@
             }
 
             value = value.substr(2);
-            return $.fn.bootstrapValidator.helpers.mod_11_10(value);
+            return $.fn.bootstrapValidator.helpers.mod11And10(value);
         },
 
         /**
@@ -762,7 +761,7 @@
                 var alphabet = 'WABCDEFGHIJKLMNOPQRSTUV',
                     sum      = 0;
                 for (var i = 0; i < 7; i++) {
-                    sum += parseInt(value.charAt(i)) * (8 - i);
+                    sum += parseInt(value.charAt(i), 10) * (8 - i);
                 }
                 sum += 9 * alphabet.indexOf(value.substr(7));
                 return alphabet[sum % 23];
@@ -771,10 +770,10 @@
             // The first 7 characters are digits
             if (/^[0-9]+$/.test(value.substr(0, 7))) {
                 // New system
-                return value.charAt(7) == getCheckDigit(value.substr(0, 7) + value.substr(8) + '');
-            } else if ('ABCDEFGHIJKLMNOPQRSTUVWXYZ+*'.indexOf(value.charAt(1)) != -1) {
+                return value.charAt(7) === getCheckDigit(value.substr(0, 7) + value.substr(8) + '');
+            } else if ('ABCDEFGHIJKLMNOPQRSTUVWXYZ+*'.indexOf(value.charAt(1)) !== -1) {
                 // Old system
-                return value.charAt(7) == getCheckDigit(value.substr(2, 5) + value.substr(0, 1) + '');
+                return value.charAt(7) === getCheckDigit(value.substr(2, 5) + value.substr(0, 1) + '');
             }
 
             return true;
@@ -799,12 +798,12 @@
             }
 
             value = value.substr(2);
-            if (parseInt(value.substr(0, 7)) == 0) {
+            if (parseInt(value.substr(0, 7), 10) === 0) {
                 return false;
             }
 
-            var lastThree = parseInt(value.substr(7, 3));
-            if ((lastThree < 1) || (lastThree > 201) && lastThree != 999 && lastThree != 888) {
+            var lastThree = parseInt(value.substr(7, 3), 10);
+            if ((lastThree < 1) || (lastThree > 201) && lastThree !== 999 && lastThree !== 888) {
                 return false;
             }
 
@@ -831,19 +830,20 @@
 
             value = value.substr(2);
             var length = value.length,
-                sum    = 0;
-            for (var i = 0; i < length - 1; i++) {
-                sum += parseInt(value.charAt(i)) * (1 + i % 9);
+                sum    = 0,
+                i;
+            for (i = 0; i < length - 1; i++) {
+                sum += parseInt(value.charAt(i), 10) * (1 + i % 9);
             }
             var check = sum % 11;
-            if (check == 10) {
+            if (check === 10) {
                 sum = 0;
-                for (var i = 0; i < length - 1; i++) {
-                    sum += parseInt(value.charAt(i)) * (1 + (i + 2) % 9);
+                for (i = 0; i < length - 1; i++) {
+                    sum += parseInt(value.charAt(i), 10) * (1 + (i + 2) % 9);
                 }
             }
             check = check % 11 % 10;
-            return (check == value.charAt(length - 1));
+            return (check + '' === value.charAt(length - 1));
         },
 
         /**
@@ -861,7 +861,7 @@
             }
 
             value = value.substr(2);
-            return (value.substr(0, 6) % 89 == value.substr(6, 2));
+            return ((parseInt(value.substr(0, 6), 10) % 89) + '' === value.substr(6, 2));
         },
 
         /**
@@ -879,26 +879,26 @@
             }
 
             value = value.substr(2);
-            var first  = parseInt(value.charAt(0)),
+            var first  = parseInt(value.charAt(0), 10),
                 sum    = 0,
                 weight = [],
-                i      = 0,
+                i,
                 length = value.length;
             if (first > 3) {
                 // Legal entity
                 sum    = 0;
                 weight = [9, 1, 4, 8, 3, 10, 2, 5, 7, 6, 1];
                 for (i = 0; i < length; i++) {
-                    sum += parseInt(value.charAt(i)) * weight[i];
+                    sum += parseInt(value.charAt(i), 10) * weight[i];
                 }
                 sum = sum % 11;
-                return (sum == 3);
+                return (sum === 3);
             } else {
                 // Check birth date
-                var day   = parseInt(value.substr(0, 2)),
-                    month = parseInt(value.substr(2, 2)),
-                    year  = parseInt(value.substr(4, 2));
-                year = year + 1800 + parseInt(value.charAt(6)) * 100;
+                var day   = parseInt(value.substr(0, 2), 10),
+                    month = parseInt(value.substr(2, 2), 10),
+                    year  = parseInt(value.substr(4, 2), 10);
+                year = year + 1800 + parseInt(value.charAt(6), 10) * 100;
 
                 if (!$.fn.bootstrapValidator.helpers.date(year, month, day)) {
                     return false;
@@ -908,13 +908,11 @@
                 sum    = 0;
                 weight = [10, 5, 8, 4, 2, 1, 6, 3, 7, 9];
                 for (i = 0; i < length - 1; i++) {
-                    sum += parseInt(value.charAt(i)) * weight[i];
+                    sum += parseInt(value.charAt(i), 10) * weight[i];
                 }
                 sum = (sum + 1) % 11 % 10;
-                return (sum == value.charAt(length - 1));
+                return (sum + '' === value.charAt(length - 1));
             }
-
-            return true;
         },
 
         /**
@@ -936,10 +934,10 @@
                 weight = [3, 4, 6, 7, 8, 9, 10, 1];
 
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
-            return (sum % 37 == 0);
+            return (sum % 37 === 0);
         },
 
         /**
@@ -959,14 +957,14 @@
             var sum    = 0,
                 weight = [9, 8, 7, 6, 5, 4, 3, 2];
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
             sum = sum % 11;
             if (sum > 9) {
                 sum = 0;
             }
-            return (sum == value.substr(8, 1));
+            return (sum + '' === value.substr(8, 1));
         },
 
         /**
@@ -984,14 +982,14 @@
             var sum    = 0,
                 weight = [3, 2, 7, 6, 5, 4, 3, 2];
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
             sum = 11 - sum % 11;
-            if (sum == 11) {
+            if (sum === 11) {
                 sum = 0;
             }
-            return (sum == value.substr(8, 1));
+            return (sum + '' === value.substr(8, 1));
         },
 
         /**
@@ -1013,10 +1011,10 @@
                 weight = [6, 5, 7, 2, 3, 4, 5, 6, 7, -1];
 
             for (var i = 0; i < 10; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
-            return (sum % 11 == 0);
+            return (sum % 11 === 0);
         },
 
         /**
@@ -1038,13 +1036,13 @@
                 weight = [9, 8, 7, 6, 5, 4, 3, 2];
 
             for (var i = 0; i < 8; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = 11 - sum % 11;
             if (sum > 9) {
                 sum = 0;
             }
-            return (sum == value.substr(8, 1));
+            return (sum + '' === value.substr(8, 1));
         },
 
         /**
@@ -1066,11 +1064,11 @@
                 weight = [7, 5, 3, 2, 1, 7, 5, 3, 2].slice(10 - length),
                 sum    = 0;
             for (var i = 0; i < length - 1; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
 
             sum = (10 * sum) % 11 % 10;
-            return (sum == value.substr(length - 1, 1));
+            return (sum + '' === value.substr(length - 1, 1));
         },
 
         /**
@@ -1085,27 +1083,28 @@
             }
 
             value = value.substr(2);
-            if (value.length == 10) {
+            var i = 0;
+            if (value.length === 10) {
                 var sum    = 0,
                     weight = [2, 4, 10, 3, 5, 9, 4, 6, 8, 0];
-                for (var i = 0; i < 10; i++) {
-                    sum += parseInt(value.charAt(i)) * weight[i];
+                for (i = 0; i < 10; i++) {
+                    sum += parseInt(value.charAt(i), 10) * weight[i];
                 }
                 sum = sum % 11;
                 if (sum > 9) {
                     sum = sum % 10;
                 }
 
-                return (sum == value.substr(9, 1));
-            } else if (value.length == 12) {
+                return (sum + '' === value.substr(9, 1));
+            } else if (value.length === 12) {
                 var sum1    = 0,
                     weight1 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0],
                     sum2    = 0,
                     weight2 = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0];
 
-                for (var i = 0; i < 11; i++) {
-                    sum1 += parseInt(value.charAt(i)) * weight1[i];
-                    sum2 += parseInt(value.charAt(i)) * weight2[i];
+                for (i = 0; i < 11; i++) {
+                    sum1 += parseInt(value.charAt(i), 10) * weight1[i];
+                    sum2 += parseInt(value.charAt(i), 10) * weight2[i];
                 }
                 sum1 = sum1 % 11;
                 if (sum1 > 9) {
@@ -1116,7 +1115,7 @@
                     sum2 = sum2 % 10;
                 }
 
-                return (sum1 == value.substr(10, 1) && sum2 == value.substr(11, 1));
+                return (sum1 + '' === value.substr(10, 1) && sum2 + '' === value.substr(11, 1));
             }
 
             return false;
@@ -1137,14 +1136,14 @@
             var sum  = 10,
                 temp = 0;
             for (var i = 0; i < 8; i++) {
-                temp = (parseInt(value.charAt(i)) + sum) % 10;
-                if (temp == 0) {
+                temp = (parseInt(value.charAt(i), 10) + sum) % 10;
+                if (temp === 0) {
                     temp = 10;
                 }
                 sum = (2 * temp) % 11;
             }
 
-            return ((sum + parseInt(value.substr(8, 1))) % 10 == 1);
+            return ((sum + parseInt(value.substr(8, 1), 10)) % 10 === 1);
         },
 
         /**
@@ -1184,13 +1183,13 @@
                 weight = [8, 7, 6, 5, 4, 3, 2];
 
             for (var i = 0; i < 7; i++) {
-                sum += parseInt(value.charAt(i)) * weight[i];
+                sum += parseInt(value.charAt(i), 10) * weight[i];
             }
             sum = 11 - sum % 11;
-            if (sum == 10) {
+            if (sum === 10) {
                 sum = 0;
             }
-            return (sum == value.substr(7, 1));
+            return (sum + '' === value.substr(7, 1));
         },
 
         /**
@@ -1207,8 +1206,7 @@
                 return false;
             }
 
-            value = value.substr(2);
-            return (value % 11 == 0);
+            return (parseInt(value.substr(2), 10) % 11 === 0);
         }
     };
 }(window.jQuery));

+ 3 - 3
src/js/validator/vin.js

@@ -15,7 +15,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
+            if (value === '') {
                 return true;
             }
 
@@ -39,11 +39,11 @@
             }
 
             var reminder = sum % 11;
-            if (reminder == 10) {
+            if (reminder === 10) {
                 reminder = 'X';
             }
 
-            return reminder == value.charAt(8);
+            return (reminder + '') === value.charAt(8);
         }
     };
 }(window.jQuery));

+ 4 - 3
src/js/validator/zipCode.js

@@ -16,7 +16,7 @@
 
         getMessage: function(options) {
             var country = (options.country || 'US').toUpperCase();
-            if ($.inArray(country, $.fn.bootstrapValidator.validators.zipCode.COUNTRIES) == -1) {
+            if ($.inArray(country, $.fn.bootstrapValidator.validators.zipCode.COUNTRIES) === -1) {
                 return $.fn.bootstrapValidator.helpers.format(this.countryNotSupported, country);
             }
 
@@ -58,12 +58,12 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '' || !options.country) {
+            if (value === '' || !options.country) {
                 return true;
             }
 
             var country = (options.country || 'US').toUpperCase();
-            if ($.inArray(country, this.COUNTRIES) == -1) {
+            if ($.inArray(country, this.COUNTRIES) === -1) {
                 return false;
             }
 
@@ -81,6 +81,7 @@
                 case 'SE': return /^(S-)?\d{3}\s?\d{2}$/i.test(value);
                 case 'SG': return /^([0][1-9]|[1-6][0-9]|[7]([0-3]|[5-9])|[8][0-2])(\d{4})$/i.test(value);
                 case 'US':
+                /* falls through */
                 default: return /^\d{4,5}([\-]\d{4})?$/.test(value);
             }
         },