fomantic-ui 2.9.1-beta.22 → 2.9.1-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/.eslint/index.js +23 -0
  2. package/.eslint/no-extra-parens-rule.js +17 -0
  3. package/.eslint/package.json +11 -0
  4. package/.eslintrc.js +13 -70
  5. package/.stylelintrc.js +5 -7
  6. package/dist/components/accordion.css +1 -1
  7. package/dist/components/accordion.js +26 -26
  8. package/dist/components/accordion.min.css +1 -1
  9. package/dist/components/accordion.min.js +2 -2
  10. package/dist/components/ad.css +1 -1
  11. package/dist/components/ad.min.css +1 -1
  12. package/dist/components/api.js +95 -94
  13. package/dist/components/api.min.js +2 -2
  14. package/dist/components/breadcrumb.css +1 -1
  15. package/dist/components/breadcrumb.min.css +1 -1
  16. package/dist/components/button.css +1 -1
  17. package/dist/components/button.min.css +1 -1
  18. package/dist/components/calendar.css +3 -3
  19. package/dist/components/calendar.js +181 -151
  20. package/dist/components/calendar.min.css +2 -2
  21. package/dist/components/calendar.min.js +2 -2
  22. package/dist/components/card.css +1 -1
  23. package/dist/components/card.min.css +1 -1
  24. package/dist/components/checkbox.css +1 -1
  25. package/dist/components/checkbox.js +14 -14
  26. package/dist/components/checkbox.min.css +1 -1
  27. package/dist/components/checkbox.min.js +2 -2
  28. package/dist/components/comment.css +1 -1
  29. package/dist/components/comment.min.css +1 -1
  30. package/dist/components/container.css +1 -1
  31. package/dist/components/container.min.css +1 -1
  32. package/dist/components/dimmer.css +1 -1
  33. package/dist/components/dimmer.js +23 -25
  34. package/dist/components/dimmer.min.css +1 -1
  35. package/dist/components/dimmer.min.js +2 -2
  36. package/dist/components/divider.css +1 -1
  37. package/dist/components/divider.min.css +1 -1
  38. package/dist/components/dropdown.css +1 -1
  39. package/dist/components/dropdown.js +252 -254
  40. package/dist/components/dropdown.min.css +1 -1
  41. package/dist/components/dropdown.min.js +2 -2
  42. package/dist/components/embed.css +1 -1
  43. package/dist/components/embed.js +27 -33
  44. package/dist/components/embed.min.css +1 -1
  45. package/dist/components/embed.min.js +2 -2
  46. package/dist/components/feed.css +1 -1
  47. package/dist/components/feed.min.css +1 -1
  48. package/dist/components/flag.css +1 -1
  49. package/dist/components/flag.min.css +1 -1
  50. package/dist/components/flyout.css +2 -2
  51. package/dist/components/flyout.js +50 -44
  52. package/dist/components/flyout.min.css +1 -1
  53. package/dist/components/flyout.min.js +2 -2
  54. package/dist/components/form.css +2 -2
  55. package/dist/components/form.js +187 -163
  56. package/dist/components/form.min.css +2 -2
  57. package/dist/components/form.min.js +2 -2
  58. package/dist/components/grid.css +1 -1
  59. package/dist/components/grid.min.css +1 -1
  60. package/dist/components/header.css +1 -1
  61. package/dist/components/header.min.css +1 -1
  62. package/dist/components/icon.css +1 -1
  63. package/dist/components/icon.min.css +1 -1
  64. package/dist/components/image.css +1 -1
  65. package/dist/components/image.min.css +1 -1
  66. package/dist/components/input.css +1 -1
  67. package/dist/components/input.min.css +1 -1
  68. package/dist/components/item.css +1 -1
  69. package/dist/components/item.min.css +1 -1
  70. package/dist/components/label.css +1 -1
  71. package/dist/components/label.min.css +1 -1
  72. package/dist/components/list.css +1 -1
  73. package/dist/components/list.min.css +1 -1
  74. package/dist/components/loader.css +1 -1
  75. package/dist/components/loader.min.css +1 -1
  76. package/dist/components/message.css +1 -1
  77. package/dist/components/message.min.css +1 -1
  78. package/dist/components/modal.css +1 -1
  79. package/dist/components/modal.js +49 -45
  80. package/dist/components/modal.min.css +1 -1
  81. package/dist/components/modal.min.js +2 -2
  82. package/dist/components/nag.css +1 -1
  83. package/dist/components/nag.js +22 -20
  84. package/dist/components/nag.min.css +1 -1
  85. package/dist/components/nag.min.js +2 -2
  86. package/dist/components/placeholder.css +1 -1
  87. package/dist/components/placeholder.min.css +1 -1
  88. package/dist/components/popup.css +1 -1
  89. package/dist/components/popup.js +71 -71
  90. package/dist/components/popup.min.css +1 -1
  91. package/dist/components/popup.min.js +2 -2
  92. package/dist/components/progress.css +1 -1
  93. package/dist/components/progress.js +46 -46
  94. package/dist/components/progress.min.css +1 -1
  95. package/dist/components/progress.min.js +2 -2
  96. package/dist/components/rail.css +1 -1
  97. package/dist/components/rail.min.css +1 -1
  98. package/dist/components/rating.css +1 -1
  99. package/dist/components/rating.js +15 -15
  100. package/dist/components/rating.min.css +1 -1
  101. package/dist/components/rating.min.js +2 -2
  102. package/dist/components/reset.css +1 -1
  103. package/dist/components/reset.min.css +1 -1
  104. package/dist/components/reveal.css +1 -1
  105. package/dist/components/reveal.min.css +1 -1
  106. package/dist/components/search.css +1 -1
  107. package/dist/components/search.js +69 -74
  108. package/dist/components/search.min.css +1 -1
  109. package/dist/components/search.min.js +2 -2
  110. package/dist/components/segment.css +1 -1
  111. package/dist/components/segment.min.css +1 -1
  112. package/dist/components/shape.css +1 -1
  113. package/dist/components/shape.js +39 -39
  114. package/dist/components/shape.min.css +1 -1
  115. package/dist/components/shape.min.js +2 -2
  116. package/dist/components/sidebar.css +1 -1
  117. package/dist/components/sidebar.js +39 -37
  118. package/dist/components/sidebar.min.css +1 -1
  119. package/dist/components/sidebar.min.js +2 -2
  120. package/dist/components/site.css +1 -1
  121. package/dist/components/site.js +22 -21
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +2 -2
  124. package/dist/components/slider.js +69 -64
  125. package/dist/components/slider.min.js +2 -2
  126. package/dist/components/state.js +15 -15
  127. package/dist/components/state.min.js +2 -2
  128. package/dist/components/statistic.css +1 -1
  129. package/dist/components/statistic.min.css +1 -1
  130. package/dist/components/step.css +1 -1
  131. package/dist/components/step.min.css +1 -1
  132. package/dist/components/sticky.css +1 -1
  133. package/dist/components/sticky.js +25 -25
  134. package/dist/components/sticky.min.css +1 -1
  135. package/dist/components/sticky.min.js +2 -2
  136. package/dist/components/tab.css +1 -1
  137. package/dist/components/tab.js +55 -57
  138. package/dist/components/tab.min.css +1 -1
  139. package/dist/components/tab.min.js +2 -2
  140. package/dist/components/table.css +1 -1
  141. package/dist/components/table.min.css +1 -1
  142. package/dist/components/text.css +1 -1
  143. package/dist/components/text.min.css +1 -1
  144. package/dist/components/toast.css +1 -1
  145. package/dist/components/toast.js +57 -30
  146. package/dist/components/toast.min.css +1 -1
  147. package/dist/components/toast.min.js +2 -2
  148. package/dist/components/transition.css +7 -7
  149. package/dist/components/transition.js +45 -39
  150. package/dist/components/transition.min.css +1 -1
  151. package/dist/components/transition.min.js +2 -2
  152. package/dist/components/visibility.js +25 -25
  153. package/dist/components/visibility.min.js +2 -2
  154. package/dist/semantic.css +60 -60
  155. package/dist/semantic.js +1518 -1427
  156. package/dist/semantic.min.css +2 -2
  157. package/dist/semantic.min.js +2 -2
  158. package/examples/responsive.html +1 -1
  159. package/gulpfile.js +1 -1
  160. package/package.json +2 -1
  161. package/scripts/nightly-version.js +6 -4
  162. package/src/definitions/behaviors/api.js +94 -93
  163. package/src/definitions/behaviors/form.js +186 -162
  164. package/src/definitions/behaviors/state.js +14 -14
  165. package/src/definitions/behaviors/visibility.js +24 -24
  166. package/src/definitions/collections/menu.less +2 -2
  167. package/src/definitions/elements/button.less +2 -2
  168. package/src/definitions/elements/loader.less +4 -4
  169. package/src/definitions/elements/step.less +1 -1
  170. package/src/definitions/globals/site.js +21 -20
  171. package/src/definitions/modules/accordion.js +25 -25
  172. package/src/definitions/modules/calendar.js +180 -150
  173. package/src/definitions/modules/calendar.less +2 -2
  174. package/src/definitions/modules/checkbox.js +13 -13
  175. package/src/definitions/modules/dimmer.js +22 -24
  176. package/src/definitions/modules/dimmer.less +10 -10
  177. package/src/definitions/modules/dropdown.js +251 -253
  178. package/src/definitions/modules/embed.js +26 -32
  179. package/src/definitions/modules/flyout.js +49 -43
  180. package/src/definitions/modules/flyout.less +1 -1
  181. package/src/definitions/modules/modal.js +48 -44
  182. package/src/definitions/modules/nag.js +21 -19
  183. package/src/definitions/modules/popup.js +70 -70
  184. package/src/definitions/modules/progress.js +45 -45
  185. package/src/definitions/modules/rating.js +14 -14
  186. package/src/definitions/modules/search.js +68 -73
  187. package/src/definitions/modules/shape.js +38 -38
  188. package/src/definitions/modules/sidebar.js +38 -36
  189. package/src/definitions/modules/slider.js +68 -63
  190. package/src/definitions/modules/sticky.js +24 -24
  191. package/src/definitions/modules/tab.js +54 -56
  192. package/src/definitions/modules/toast.js +56 -29
  193. package/src/definitions/modules/transition.js +44 -38
  194. package/src/themes/amazon/elements/button.overrides +7 -7
  195. package/src/themes/default/collections/form.variables +1 -1
  196. package/src/themes/default/elements/reveal.variables +1 -1
  197. package/src/themes/default/globals/site.variables +1 -1
  198. package/src/themes/default/modules/dimmer.variables +6 -6
  199. package/src/themes/default/modules/modal.variables +1 -1
  200. package/src/themes/default/modules/slider.variables +4 -4
  201. package/src/themes/default/modules/toast.variables +2 -2
  202. package/src/themes/default/modules/transition.overrides +12 -12
  203. package/src/themes/flat/collections/form.overrides +2 -2
  204. package/src/themes/flat/globals/site.variables +1 -1
  205. package/src/themes/github/collections/form.overrides +2 -2
  206. package/src/themes/github/collections/menu.variables +1 -1
  207. package/src/themes/github/collections/message.overrides +3 -3
  208. package/src/themes/github/elements/input.overrides +2 -2
  209. package/src/themes/timeline/views/feed.overrides +3 -3
  210. package/src/themes/twitter/elements/button.overrides +2 -2
  211. package/tasks/README.md +1 -3
  212. package/tasks/admin/components/create.js +9 -16
  213. package/tasks/admin/components/init.js +7 -7
  214. package/tasks/admin/components/update.js +10 -10
  215. package/tasks/admin/distributions/create.js +16 -18
  216. package/tasks/admin/distributions/init.js +7 -7
  217. package/tasks/admin/distributions/update.js +10 -10
  218. package/tasks/admin/publish.js +1 -3
  219. package/tasks/admin/register.js +6 -6
  220. package/tasks/admin/release.js +1 -3
  221. package/tasks/build/assets.js +2 -2
  222. package/tasks/build/css.js +8 -3
  223. package/tasks/build/javascript.js +3 -1
  224. package/tasks/build.js +1 -1
  225. package/tasks/check-install.js +1 -1
  226. package/tasks/clean.js +1 -1
  227. package/tasks/collections/README.md +3 -5
  228. package/tasks/collections/admin.js +1 -1
  229. package/tasks/collections/docs.js +1 -1
  230. package/tasks/collections/install.js +1 -1
  231. package/tasks/collections/rtl.js +1 -1
  232. package/tasks/collections/various.js +1 -1
  233. package/tasks/config/admin/github.js +6 -8
  234. package/tasks/config/admin/templates/css-package.js +1 -1
  235. package/tasks/config/admin/templates/less-package.js +1 -1
  236. package/tasks/config/npm/gulpfile.js +7 -7
  237. package/tasks/config/project/config.js +14 -19
  238. package/tasks/config/project/install.js +35 -34
  239. package/tasks/config/project/release.js +15 -16
  240. package/tasks/config/tasks.js +18 -20
  241. package/tasks/config/user.js +5 -3
  242. package/tasks/docs/build.js +5 -3
  243. package/tasks/docs/metadata.js +7 -8
  244. package/tasks/docs/serve.js +6 -3
  245. package/tasks/install.js +39 -39
  246. package/tasks/rtl/build.js +1 -3
  247. package/tasks/rtl/watch.js +1 -3
  248. package/tasks/version.js +1 -3
  249. package/tasks/watch.js +1 -1
  250. package/test/.eslintrc.js +0 -4
  251. package/test/meteor/assets.js +1 -1
  252. package/test/modules/module.spec.js +15 -15
  253. package/test/modules/popup.spec.js +1 -1
  254. package/test/modules/search.spec.js +1 -1
  255. package/test/modules/tab.spec.js +1 -1
  256. package/test/modules/transition.spec.js +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.22+6a42d01 - Form Validation
2
+ * # Fomantic-UI 2.9.1-beta.24+029436f - Form Validation
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -15,7 +15,7 @@
15
15
  return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
16
  }
17
17
 
18
- window = (typeof window != 'undefined' && window.Math == Math)
18
+ window = window !== undefined && window.Math === Math
19
19
  ? window
20
20
  : globalThis;
21
21
 
@@ -24,12 +24,12 @@
24
24
  $allModules = $(this),
25
25
  moduleSelector = $allModules.selector || '',
26
26
 
27
- time = new Date().getTime(),
27
+ time = Date.now(),
28
28
  performance = [],
29
29
 
30
30
  query = arguments[0],
31
31
  legacyParameters = arguments[1],
32
- methodInvoked = (typeof query == 'string'),
32
+ methodInvoked = typeof query === 'string',
33
33
  queryArguments = [].slice.call(arguments, 1),
34
34
  returnedValue
35
35
  ;
@@ -136,7 +136,10 @@
136
136
  },
137
137
 
138
138
  attachEvents: function (selector, action) {
139
- action = action || 'submit';
139
+ if (!action) {
140
+ action = 'submit';
141
+ }
142
+
140
143
  $(selector).on('click' + eventNamespace, function (event) {
141
144
  module[action]();
142
145
  event.preventDefault();
@@ -193,7 +196,7 @@
193
196
  defaultValue = $field.data(metadata.defaultValue) || '',
194
197
  isCheckbox = $element.is(selector.uiCheckbox),
195
198
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
196
- isCalendar = ($calendar.length > 0 && module.can.useElement('calendar')),
199
+ isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
197
200
  isErrored = $fieldGroup.hasClass(className.error)
198
201
  ;
199
202
  if (isErrored) {
@@ -227,7 +230,7 @@
227
230
  defaultValue = $field.data(metadata.defaultValue),
228
231
  isCheckbox = $element.is(selector.uiCheckbox),
229
232
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
230
- isCalendar = ($calendar.length > 0 && module.can.useElement('calendar')),
233
+ isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
231
234
  isErrored = $fieldGroup.hasClass(className.error)
232
235
  ;
233
236
  if (defaultValue === undefined) {
@@ -260,7 +263,7 @@
260
263
  allValid = true
261
264
  ;
262
265
  $.each(validation, function (fieldName, field) {
263
- if (!(module.validate.field(field, fieldName, true))) {
266
+ if (!module.validate.field(field, fieldName, true)) {
264
267
  allValid = false;
265
268
  }
266
269
  });
@@ -273,19 +276,17 @@
273
276
  $field.each(function (index, el) {
274
277
  var
275
278
  $el = $(el),
276
- isCheckbox = ($el.filter(selector.checkbox).length > 0),
279
+ isCheckbox = $el.filter(selector.checkbox).length > 0,
277
280
  isDirty
278
281
  ;
279
282
 
280
- if (isCheckbox) {
281
- isDirty = module.is.checkboxDirty($el);
282
- } else {
283
- isDirty = module.is.fieldDirty($el);
284
- }
283
+ isDirty = isCheckbox
284
+ ? module.is.checkboxDirty($el)
285
+ : module.is.fieldDirty($el);
285
286
 
286
287
  $el.data(settings.metadata.isDirty, isDirty);
287
288
 
288
- formIsDirty |= isDirty;
289
+ formIsDirty = formIsDirty || isDirty;
289
290
  });
290
291
 
291
292
  if (formIsDirty) {
@@ -298,20 +299,21 @@
298
299
 
299
300
  is: {
300
301
  bracketedRule: function (rule) {
301
- return (rule.type && rule.type.match(settings.regExp.bracket));
302
+ return rule.type && rule.type.match(settings.regExp.bracket);
302
303
  },
303
304
  // duck type rule test
304
305
  shorthandRules: function (rules) {
305
- return (typeof rules == 'string' || Array.isArray(rules));
306
+ return typeof rules === 'string' || Array.isArray(rules);
306
307
  },
307
308
  empty: function ($field) {
308
309
  if (!$field || $field.length === 0) {
309
310
  return true;
310
- } else if ($field.is(selector.checkbox)) {
311
+ }
312
+ if ($field.is(selector.checkbox)) {
311
313
  return !$field.is(':checked');
312
- } else {
313
- return module.is.blank($field);
314
314
  }
315
+
316
+ return module.is.blank($field);
315
317
  },
316
318
  blank: function ($field) {
317
319
  return String($field.val()).trim() === '';
@@ -324,16 +326,16 @@
324
326
  module.verbose('Checking if field is valid', field);
325
327
 
326
328
  return module.validate.field(validation[field], field, !!showErrors);
327
- } else {
328
- module.verbose('Checking if form is valid');
329
- $.each(validation, function (fieldName, field) {
330
- if (!module.is.valid(fieldName, showErrors)) {
331
- allValid = false;
332
- }
333
- });
334
-
335
- return allValid;
336
329
  }
330
+
331
+ module.verbose('Checking if form is valid');
332
+ $.each(validation, function (fieldName, field) {
333
+ if (!module.is.valid(fieldName, showErrors)) {
334
+ allValid = false;
335
+ }
336
+ });
337
+
338
+ return allValid;
337
339
  },
338
340
  dirty: function () {
339
341
  return dirty;
@@ -374,10 +376,10 @@
374
376
  return initialValue !== currentValue;
375
377
  },
376
378
  justDirty: function () {
377
- return (history[0] === 'dirty');
379
+ return history[0] === 'dirty';
378
380
  },
379
381
  justClean: function () {
380
- return (history[0] === 'clean');
382
+ return history[0] === 'clean';
381
383
  },
382
384
  },
383
385
 
@@ -395,7 +397,7 @@
395
397
  key = event.which,
396
398
  isInput = $field.is(selector.input),
397
399
  isCheckbox = $field.is(selector.checkbox),
398
- isInDropdown = ($field.closest(selector.uiDropdown).length > 0),
400
+ isInDropdown = $field.closest(selector.uiDropdown).length > 0,
399
401
  keyCode = {
400
402
  enter: 13,
401
403
  escape: 27,
@@ -474,7 +476,7 @@
474
476
  return false;
475
477
  }
476
478
 
477
- return (rule.value !== undefined)
479
+ return rule.value !== undefined
478
480
  ? rule.value
479
481
  : rule.type.match(settings.regExp.bracket)[1] + '';
480
482
  },
@@ -488,16 +490,16 @@
488
490
  changeEvent: function (type, $input) {
489
491
  if (type == 'checkbox' || type == 'radio' || type == 'hidden' || $input.is('select')) {
490
492
  return 'change';
491
- } else {
492
- return module.get.inputEvent();
493
493
  }
494
+
495
+ return module.get.inputEvent();
494
496
  },
495
497
  inputEvent: function () {
496
- return (document.createElement('input').oninput !== undefined)
498
+ return document.createElement('input').oninput !== undefined
497
499
  ? 'input'
498
- : (document.createElement('input').onpropertychange !== undefined)
500
+ : (document.createElement('input').onpropertychange !== undefined
499
501
  ? 'propertychange'
500
- : 'keyup';
502
+ : 'keyup');
501
503
  },
502
504
  fieldsFromShorthand: function (fields) {
503
505
  var
@@ -507,7 +509,7 @@
507
509
  if (!Array.isArray(rules) && typeof rules === 'object') {
508
510
  fullFields[name] = rules;
509
511
  } else {
510
- if (typeof rules == 'string') {
512
+ if (typeof rules === 'string') {
511
513
  rules = [rules];
512
514
  }
513
515
  fullFields[name] = {
@@ -530,8 +532,8 @@
530
532
  prompt = isFunction(rule.prompt)
531
533
  ? rule.prompt(value)
532
534
  : rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule,
533
- requiresValue = (prompt.search('{value}') !== -1),
534
- requiresName = (prompt.search('{name}') !== -1),
535
+ requiresValue = prompt.search('{value}') !== -1,
536
+ requiresName = prompt.search('{name}') !== -1,
535
537
  $label,
536
538
  name,
537
539
  parts,
@@ -540,30 +542,28 @@
540
542
  if (ancillary && ['integer', 'decimal', 'number'].indexOf(ruleName) >= 0 && ancillary.indexOf('..') >= 0) {
541
543
  parts = ancillary.split('..', 2);
542
544
  if (!rule.prompt) {
543
- suffixPrompt = (
544
- parts[0] === ''
545
- ? settings.prompt.maxValue.replace(/\{ruleValue\}/g, '{max}')
546
- : parts[1] === ''
547
- ? settings.prompt.minValue.replace(/\{ruleValue\}/g, '{min}')
548
- : settings.prompt.range
549
- );
550
- prompt += suffixPrompt.replace(/\{name\}/g, ' ' + settings.text.and);
545
+ suffixPrompt = parts[0] === ''
546
+ ? settings.prompt.maxValue.replace(/{ruleValue}/g, '{max}')
547
+ : (parts[1] === ''
548
+ ? settings.prompt.minValue.replace(/{ruleValue}/g, '{min}')
549
+ : settings.prompt.range);
550
+ prompt += suffixPrompt.replace(/{name}/g, ' ' + settings.text.and);
551
551
  }
552
- prompt = prompt.replace(/\{min\}/g, parts[0]);
553
- prompt = prompt.replace(/\{max\}/g, parts[1]);
552
+ prompt = prompt.replace(/{min}/g, parts[0]);
553
+ prompt = prompt.replace(/{max}/g, parts[1]);
554
554
  }
555
555
  if (requiresValue) {
556
- prompt = prompt.replace(/\{value\}/g, $field.val());
556
+ prompt = prompt.replace(/{value}/g, $field.val());
557
557
  }
558
558
  if (requiresName) {
559
559
  $label = $field.closest(selector.group).find('label').eq(0);
560
- name = ($label.length == 1)
560
+ name = $label.length == 1
561
561
  ? $label.text()
562
562
  : $field.prop('placeholder') || settings.text.unspecifiedField;
563
- prompt = prompt.replace(/\{name\}/g, name);
563
+ prompt = prompt.replace(/{name}/g, name);
564
564
  }
565
- prompt = prompt.replace(/\{identifier\}/g, field.identifier);
566
- prompt = prompt.replace(/\{ruleValue\}/g, ancillary);
565
+ prompt = prompt.replace(/{identifier}/g, field.identifier);
566
+ prompt = prompt.replace(/{ruleValue}/g, ancillary);
567
567
  if (!rule.prompt) {
568
568
  module.verbose('Using default validation prompt for type', prompt, ruleName);
569
569
  }
@@ -574,8 +574,8 @@
574
574
  if ($.isPlainObject(parameters)) {
575
575
  var
576
576
  keys = Object.keys(parameters),
577
- isLegacySettings = (keys.length > 0)
578
- ? (parameters[keys[0]].identifier !== undefined && parameters[keys[0]].rules !== undefined)
577
+ isLegacySettings = keys.length > 0
578
+ ? parameters[keys[0]].identifier !== undefined && parameters[keys[0]].rules !== undefined
579
579
  : false
580
580
  ;
581
581
  if (isLegacySettings) {
@@ -619,16 +619,20 @@
619
619
  module.verbose('Finding field with identifier', identifier);
620
620
  identifier = module.escape.string(identifier);
621
621
  var t;
622
- if ((t = $field.filter('#' + identifier)).length > 0) {
622
+ t = $field.filter('#' + identifier);
623
+ if (t.length > 0) {
623
624
  return t;
624
625
  }
625
- if ((t = $field.filter('[name="' + identifier + '"]')).length > 0) {
626
+ t = $field.filter('[name="' + identifier + '"]');
627
+ if (t.length > 0) {
626
628
  return t;
627
629
  }
628
- if ((t = $field.filter('[name="' + identifier + '[]"]')).length > 0) {
630
+ t = $field.filter('[name="' + identifier + '[]"]');
631
+ if (t.length > 0) {
629
632
  return t;
630
633
  }
631
- if ((t = $field.filter('[data-' + metadata.validate + '="' + identifier + '"]')).length > 0) {
634
+ t = $field.filter('[data-' + metadata.validate + '="' + identifier + '"]');
635
+ if (t.length > 0) {
632
636
  return t;
633
637
  }
634
638
  module.error(error.noField.replace('{identifier}', identifier));
@@ -692,9 +696,9 @@
692
696
  value = $field.val(),
693
697
  isCheckbox = $field.is(selector.checkbox),
694
698
  isRadio = $field.is(selector.radio),
695
- isMultiple = (name.indexOf('[]') !== -1),
696
- isCalendar = ($calendar.length > 0 && module.can.useElement('calendar')),
697
- isChecked = (isCheckbox)
699
+ isMultiple = name.indexOf('[]') !== -1,
700
+ isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
701
+ isChecked = isCheckbox
698
702
  ? $field.is(':checked')
699
703
  : false
700
704
  ;
@@ -716,16 +720,12 @@
716
720
  } else {
717
721
  if (isRadio) {
718
722
  if (values[name] === undefined || values[name] === false) {
719
- values[name] = (isChecked)
723
+ values[name] = isChecked
720
724
  ? value || true
721
725
  : false;
722
726
  }
723
727
  } else if (isCheckbox) {
724
- if (isChecked) {
725
- values[name] = value || true;
726
- } else {
727
- values[name] = false;
728
- }
728
+ values[name] = isChecked ? value || true : false;
729
729
  } else if (isCalendar) {
730
730
  var date = $calendar.calendar('get date');
731
731
 
@@ -855,7 +855,7 @@
855
855
  $.each(newValidation.rules, function (_index, rule) {
856
856
  if ($.grep(validation[name].rules, function (item) {
857
857
  return item.type == rule.type;
858
- }).length == 0) {
858
+ }).length === 0) {
859
859
  validation[name].rules.push(rule);
860
860
  }
861
861
  });
@@ -871,9 +871,9 @@
871
871
  $field = module.get.field(identifier),
872
872
  $fieldGroup = $field.closest($group),
873
873
  $prompt = $fieldGroup.children(selector.prompt),
874
- promptExists = ($prompt.length !== 0)
874
+ promptExists = $prompt.length > 0
875
875
  ;
876
- errors = (typeof errors == 'string')
876
+ errors = typeof errors === 'string'
877
877
  ? [errors]
878
878
  : errors;
879
879
  module.verbose('Adding field error state', identifier);
@@ -1012,11 +1012,11 @@
1012
1012
  var
1013
1013
  $el = $(el),
1014
1014
  $parent = $el.parent(),
1015
- isCheckbox = ($el.filter(selector.checkbox).length > 0),
1015
+ isCheckbox = $el.filter(selector.checkbox).length > 0,
1016
1016
  isDropdown = $parent.is(selector.uiDropdown) && module.can.useElement('dropdown'),
1017
1017
  $calendar = $el.closest(selector.uiCalendar),
1018
- isCalendar = ($calendar.length > 0 && module.can.useElement('calendar')),
1019
- value = (isCheckbox)
1018
+ isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
1019
+ value = isCheckbox
1020
1020
  ? $el.is(':checked')
1021
1021
  : $el.val()
1022
1022
  ;
@@ -1055,9 +1055,9 @@
1055
1055
  isMultiple = Array.isArray(value),
1056
1056
  isCheckbox = $element.is(selector.uiCheckbox) && module.can.useElement('checkbox'),
1057
1057
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
1058
- isRadio = ($field.is(selector.radio) && isCheckbox),
1059
- isCalendar = ($calendar.length > 0 && module.can.useElement('calendar')),
1060
- fieldExists = ($field.length > 0),
1058
+ isRadio = $field.is(selector.radio) && isCheckbox,
1059
+ isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
1060
+ fieldExists = $field.length > 0,
1061
1061
  $multipleField
1062
1062
  ;
1063
1063
  if (fieldExists) {
@@ -1133,7 +1133,7 @@
1133
1133
  var
1134
1134
  $el = $(el),
1135
1135
  $elGroup = $el.closest($group),
1136
- isCheckbox = ($el.filter(selector.checkbox).length > 0),
1136
+ isCheckbox = $el.filter(selector.checkbox).length > 0,
1137
1137
  isRequired = $el.prop('required') || $elGroup.hasClass(className.required) || $elGroup.parent().hasClass(className.required),
1138
1138
  isDisabled = $el.is(':disabled') || $elGroup.hasClass(className.disabled) || $elGroup.parent().hasClass(className.disabled),
1139
1139
  validation = module.get.validation($el),
@@ -1156,7 +1156,7 @@
1156
1156
  });
1157
1157
  },
1158
1158
  optional: function (identifier, bool) {
1159
- bool = (bool !== false);
1159
+ bool = bool !== false;
1160
1160
  $.each(validation, function (fieldName, field) {
1161
1161
  if (identifier == fieldName || identifier == field.identifier) {
1162
1162
  field.optional = bool;
@@ -1226,10 +1226,10 @@
1226
1226
 
1227
1227
  // takes a validation object and returns whether field passes validation
1228
1228
  field: function (field, fieldName, showErrors) {
1229
- showErrors = (showErrors !== undefined)
1229
+ showErrors = showErrors !== undefined
1230
1230
  ? showErrors
1231
1231
  : true;
1232
- if (typeof field == 'string') {
1232
+ if (typeof field === 'string') {
1233
1233
  module.verbose('Validating field', field);
1234
1234
  fieldName = field;
1235
1235
  field = validation[field];
@@ -1237,7 +1237,7 @@
1237
1237
  var
1238
1238
  identifier = field.identifier || fieldName,
1239
1239
  $field = module.get.field(identifier),
1240
- $dependsField = (field.depends)
1240
+ $dependsField = field.depends
1241
1241
  ? module.get.field(field.depends)
1242
1242
  : false,
1243
1243
  fieldValid = true,
@@ -1247,7 +1247,7 @@
1247
1247
  module.debug('Using field name as identifier', identifier);
1248
1248
  field.identifier = identifier;
1249
1249
  }
1250
- var isDisabled = !$field.filter(':not(:disabled)').length;
1250
+ var isDisabled = $field.filter(':not(:disabled)').length === 0;
1251
1251
  if (isDisabled) {
1252
1252
  module.debug('Field is disabled. Skipping', identifier);
1253
1253
  } else if (field.optional && module.is.blank($field)) {
@@ -1300,11 +1300,13 @@
1300
1300
  invalidFields = [],
1301
1301
  isCheckbox = $field.is(selector.checkbox),
1302
1302
  isValid = function (field) {
1303
- var value = (isCheckbox ? $(field).filter(':checked').val() : $(field).val());
1303
+ var value = isCheckbox ? $(field).filter(':checked').val() : $(field).val();
1304
1304
  // cast to string avoiding encoding special values
1305
- value = (value === undefined || value === '' || value === null)
1305
+ value = value === undefined || value === '' || value === null
1306
1306
  ? ''
1307
- : (settings.shouldTrim && rule.shouldTrim !== false) || rule.shouldTrim ? String(value + '').trim() : String(value + '');
1307
+ : ((settings.shouldTrim && rule.shouldTrim !== false) || rule.shouldTrim
1308
+ ? String(value + '').trim()
1309
+ : String(value + ''));
1308
1310
 
1309
1311
  return ruleFunction.call(field, value, ancillary, $module);
1310
1312
  }
@@ -1326,7 +1328,7 @@
1326
1328
  });
1327
1329
  }
1328
1330
 
1329
- return internal ? invalidFields : !(invalidFields.length > 0);
1331
+ return internal ? invalidFields : invalidFields.length === 0;
1330
1332
  },
1331
1333
  },
1332
1334
 
@@ -1382,7 +1384,7 @@
1382
1384
  previousTime
1383
1385
  ;
1384
1386
  if (settings.performance) {
1385
- currentTime = new Date().getTime();
1387
+ currentTime = Date.now();
1386
1388
  previousTime = time || currentTime;
1387
1389
  executionTime = currentTime - previousTime;
1388
1390
  time = currentTime;
@@ -1411,7 +1413,7 @@
1411
1413
  title += ' \'' + moduleSelector + '\'';
1412
1414
  }
1413
1415
  if ($allModules.length > 1) {
1414
- title += ' ' + '(' + $allModules.length + ')';
1416
+ title += ' (' + $allModules.length + ')';
1415
1417
  }
1416
1418
  if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1417
1419
  console.groupCollapsed(title);
@@ -1436,11 +1438,11 @@
1436
1438
  ;
1437
1439
  passedArguments = passedArguments || queryArguments;
1438
1440
  context = context || element;
1439
- if (typeof query == 'string' && object !== undefined) {
1440
- query = query.split(/[\. ]/);
1441
+ if (typeof query === 'string' && object !== undefined) {
1442
+ query = query.split(/[ .]/);
1441
1443
  maxDepth = query.length - 1;
1442
1444
  $.each(query, function (depth, value) {
1443
- var camelCaseValue = (depth != maxDepth)
1445
+ var camelCaseValue = depth != maxDepth
1444
1446
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1445
1447
  : query;
1446
1448
  if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
@@ -1479,7 +1481,7 @@
1479
1481
  module.initialize();
1480
1482
  });
1481
1483
 
1482
- return (returnedValue !== undefined)
1484
+ return returnedValue !== undefined
1483
1485
  ? returnedValue
1484
1486
  : this;
1485
1487
  };
@@ -1529,15 +1531,15 @@
1529
1531
  },
1530
1532
 
1531
1533
  regExp: {
1532
- htmlID: /^[a-zA-Z][\w:.-]*$/g,
1533
- bracket: /\[(.*)\]/i,
1534
+ htmlID: /^[A-Za-z][\w.:-]*$/g,
1535
+ bracket: /\[(.*)]/i,
1534
1536
  decimal: /^\d+\.?\d*$/,
1535
- email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
1536
- escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|:,=@]/g,
1537
+ email: /^[\w!#$%&'*+./=?^`{|}~-]+@[\da-z]([\da-z-]*[\da-z])?(\.[\da-z]([\da-z-]*[\da-z])?)*$/i,
1538
+ escape: /[$()*+,./:=?@[\\\]^{|}-]/g,
1537
1539
  flags: /^\/(.*)\/(.*)?/,
1538
- integer: /^\-?\d+$/,
1539
- number: /^\-?\d*(\.\d+)?$/,
1540
- url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i,
1540
+ integer: /^-?\d+$/,
1541
+ number: /^-?\d*(\.\d+)?$/,
1542
+ url: /(https?:\/\/(?:www\.|(?!www))[^\s.]+\.\S{2,}|www\.\S+\.\S{2,})/i,
1541
1543
  },
1542
1544
 
1543
1545
  text: {
@@ -1682,12 +1684,12 @@
1682
1684
 
1683
1685
  // is not empty or blank string
1684
1686
  empty: function (value) {
1685
- return !(value === undefined || '' === value || Array.isArray(value) && value.length === 0);
1687
+ return !(value === undefined || value === '' || (Array.isArray(value) && value.length === 0));
1686
1688
  },
1687
1689
 
1688
1690
  // checkbox checked
1689
1691
  checked: function () {
1690
- return ($(this).filter(':checked').length > 0);
1692
+ return $(this).filter(':checked').length > 0;
1691
1693
  },
1692
1694
 
1693
1695
  // is most likely an email
@@ -1711,10 +1713,10 @@
1711
1713
  ;
1712
1714
  // regular expression specified as /baz/gi (flags)
1713
1715
  if (regExpParts) {
1714
- regExp = (regExpParts.length >= 2)
1716
+ regExp = regExpParts.length >= 2
1715
1717
  ? regExpParts[1]
1716
1718
  : regExp;
1717
- flags = (regExpParts.length >= 3)
1719
+ flags = regExpParts.length >= 3
1718
1720
  ? regExpParts[2]
1719
1721
  : '';
1720
1722
  }
@@ -1732,7 +1734,7 @@
1732
1734
  return $.fn.form.settings.rules.range(value, range, 'integer');
1733
1735
  },
1734
1736
  range: function (value, range, regExp) {
1735
- if (typeof regExp == 'string') {
1737
+ if (typeof regExp === 'string') {
1736
1738
  regExp = $.fn.form.settings.regExp[regExp];
1737
1739
  }
1738
1740
  if (!(regExp instanceof RegExp)) {
@@ -1744,10 +1746,12 @@
1744
1746
  parts
1745
1747
  ;
1746
1748
  if (!range || ['', '..'].indexOf(range) !== -1) {
1749
+
1747
1750
  // do nothing
1748
1751
  } else if (range.indexOf('..') == -1) {
1749
1752
  if (regExp.test(range)) {
1750
- min = max = range - 0;
1753
+ min = range - 0;
1754
+ max = min;
1751
1755
  }
1752
1756
  } else {
1753
1757
  parts = range.split('..', 2);
@@ -1778,36 +1782,36 @@
1778
1782
 
1779
1783
  // is value (case insensitive)
1780
1784
  is: function (value, text) {
1781
- text = (typeof text == 'string')
1785
+ text = typeof text === 'string'
1782
1786
  ? text.toLowerCase()
1783
1787
  : text;
1784
- value = (typeof value == 'string')
1788
+ value = typeof value === 'string'
1785
1789
  ? value.toLowerCase()
1786
1790
  : value;
1787
1791
 
1788
- return (value == text);
1792
+ return value == text;
1789
1793
  },
1790
1794
 
1791
1795
  // is value
1792
1796
  isExactly: function (value, text) {
1793
- return (value == text);
1797
+ return value == text;
1794
1798
  },
1795
1799
 
1796
1800
  // value is not another value (case insensitive)
1797
1801
  not: function (value, notValue) {
1798
- value = (typeof value == 'string')
1802
+ value = typeof value === 'string'
1799
1803
  ? value.toLowerCase()
1800
1804
  : value;
1801
- notValue = (typeof notValue == 'string')
1805
+ notValue = typeof notValue === 'string'
1802
1806
  ? notValue.toLowerCase()
1803
1807
  : notValue;
1804
1808
 
1805
- return (value != notValue);
1809
+ return value != notValue;
1806
1810
  },
1807
1811
 
1808
1812
  // value is not another value (case sensitive)
1809
1813
  notExactly: function (value, notValue) {
1810
- return (value != notValue);
1814
+ return value != notValue;
1811
1815
  },
1812
1816
 
1813
1817
  // value contains text (insensitive)
@@ -1815,7 +1819,7 @@
1815
1819
  // escape regex characters
1816
1820
  text = text.replace($.fn.form.settings.regExp.escape, '\\$&');
1817
1821
 
1818
- return (value.search(new RegExp(text, 'i')) !== -1);
1822
+ return value.search(new RegExp(text, 'i')) !== -1;
1819
1823
  },
1820
1824
 
1821
1825
  // value contains text (case sensitive)
@@ -1823,7 +1827,7 @@
1823
1827
  // escape regex characters
1824
1828
  text = text.replace($.fn.form.settings.regExp.escape, '\\$&');
1825
1829
 
1826
- return (value.search(new RegExp(text)) !== -1);
1830
+ return value.search(new RegExp(text)) !== -1;
1827
1831
  },
1828
1832
 
1829
1833
  // value contains text (insensitive)
@@ -1831,7 +1835,7 @@
1831
1835
  // escape regex characters
1832
1836
  text = text.replace($.fn.form.settings.regExp.escape, '\\$&');
1833
1837
 
1834
- return (value.search(new RegExp(text, 'i')) === -1);
1838
+ return value.search(new RegExp(text, 'i')) === -1;
1835
1839
  },
1836
1840
 
1837
1841
  // value contains text (case sensitive)
@@ -1839,27 +1843,27 @@
1839
1843
  // escape regex characters
1840
1844
  text = text.replace($.fn.form.settings.regExp.escape, '\\$&');
1841
1845
 
1842
- return (value.search(new RegExp(text)) === -1);
1846
+ return value.search(new RegExp(text)) === -1;
1843
1847
  },
1844
1848
 
1845
1849
  // is at least string length
1846
1850
  minLength: function (value, requiredLength) {
1847
- return (value !== undefined)
1848
- ? (value.length >= requiredLength)
1851
+ return value !== undefined
1852
+ ? value.length >= requiredLength
1849
1853
  : false;
1850
1854
  },
1851
1855
 
1852
1856
  // is exactly length
1853
1857
  exactLength: function (value, requiredLength) {
1854
- return (value !== undefined)
1855
- ? (value.length == requiredLength)
1858
+ return value !== undefined
1859
+ ? value.length == requiredLength
1856
1860
  : false;
1857
1861
  },
1858
1862
 
1859
1863
  // is less than length
1860
1864
  maxLength: function (value, maxLength) {
1861
- return (value !== undefined)
1862
- ? (value.length <= maxLength)
1865
+ return value !== undefined
1866
+ ? value.length <= maxLength
1863
1867
  : false;
1864
1868
  },
1865
1869
 
@@ -1869,18 +1873,28 @@
1869
1873
  matchingValue,
1870
1874
  matchingElement
1871
1875
  ;
1872
- if ((matchingElement = $module.find('[data-validate="' + identifier + '"]')).length > 0) {
1873
- matchingValue = matchingElement.val();
1874
- } else if ((matchingElement = $module.find('#' + identifier)).length > 0) {
1876
+ matchingElement = $module.find('[data-validate="' + identifier + '"]');
1877
+ if (matchingElement.length > 0) {
1875
1878
  matchingValue = matchingElement.val();
1876
- } else if ((matchingElement = $module.find('[name="' + identifier + '"]')).length > 0) {
1877
- matchingValue = matchingElement.val();
1878
- } else if ((matchingElement = $module.find('[name="' + identifier + '[]"]')).length > 0) {
1879
- matchingValue = matchingElement;
1879
+ } else {
1880
+ matchingElement = $module.find('#' + identifier);
1881
+ if (matchingElement.length > 0) {
1882
+ matchingValue = matchingElement.val();
1883
+ } else {
1884
+ matchingElement = $module.find('[name="' + identifier + '"]');
1885
+ if (matchingElement.length > 0) {
1886
+ matchingValue = matchingElement.val();
1887
+ } else {
1888
+ matchingElement = $module.find('[name="' + identifier + '[]"]');
1889
+ if (matchingElement.length > 0) {
1890
+ matchingValue = matchingElement;
1891
+ }
1892
+ }
1893
+ }
1880
1894
  }
1881
1895
 
1882
- return (matchingValue !== undefined)
1883
- ? (value.toString() == matchingValue.toString())
1896
+ return matchingValue !== undefined
1897
+ ? value.toString() == matchingValue.toString()
1884
1898
  : false;
1885
1899
  },
1886
1900
 
@@ -1891,18 +1905,28 @@
1891
1905
  matchingValue,
1892
1906
  matchingElement
1893
1907
  ;
1894
- if ((matchingElement = $module.find('[data-validate="' + identifier + '"]')).length > 0) {
1895
- matchingValue = matchingElement.val();
1896
- } else if ((matchingElement = $module.find('#' + identifier)).length > 0) {
1908
+ matchingElement = $module.find('[data-validate="' + identifier + '"]');
1909
+ if (matchingElement.length > 0) {
1897
1910
  matchingValue = matchingElement.val();
1898
- } else if ((matchingElement = $module.find('[name="' + identifier + '"]')).length > 0) {
1899
- matchingValue = matchingElement.val();
1900
- } else if ((matchingElement = $module.find('[name="' + identifier + '[]"]')).length > 0) {
1901
- matchingValue = matchingElement;
1911
+ } else {
1912
+ matchingElement = $module.find('#' + identifier);
1913
+ if (matchingElement.length > 0) {
1914
+ matchingValue = matchingElement.val();
1915
+ } else {
1916
+ matchingElement = $module.find('[name="' + identifier + '"]');
1917
+ if (matchingElement.length > 0) {
1918
+ matchingValue = matchingElement.val();
1919
+ } else {
1920
+ matchingElement = $module.find('[name="' + identifier + '[]"]');
1921
+ if (matchingElement.length > 0) {
1922
+ matchingValue = matchingElement;
1923
+ }
1924
+ }
1925
+ }
1902
1926
  }
1903
1927
 
1904
- return (matchingValue !== undefined)
1905
- ? (value.toString() !== matchingValue.toString())
1928
+ return matchingValue !== undefined
1929
+ ? value.toString() !== matchingValue.toString()
1906
1930
  : false;
1907
1931
  },
1908
1932
 
@@ -1922,7 +1946,7 @@
1922
1946
  length: [16],
1923
1947
  },
1924
1948
  discover: {
1925
- pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,
1949
+ pattern: /^(6011|622(12[6-9]|1[3-9]\d|[2-8]\d{2}|9[01]\d|92[0-5]|64[4-9])|65)/,
1926
1950
  length: [16],
1927
1951
  },
1928
1952
  unionPay: {
@@ -1930,7 +1954,7 @@
1930
1954
  length: [16, 17, 18, 19],
1931
1955
  },
1932
1956
  jcb: {
1933
- pattern: /^35(2[89]|[3-8][0-9])/,
1957
+ pattern: /^35(2[89]|[3-8]\d)/,
1934
1958
  length: [16],
1935
1959
  },
1936
1960
  maestro: {
@@ -1952,7 +1976,7 @@
1952
1976
  },
1953
1977
  valid = {},
1954
1978
  validCard = false,
1955
- requiredTypes = (typeof cardTypes == 'string')
1979
+ requiredTypes = typeof cardTypes === 'string'
1956
1980
  ? cardTypes.split(',')
1957
1981
  : false,
1958
1982
  unionPay,
@@ -1964,7 +1988,7 @@
1964
1988
  }
1965
1989
 
1966
1990
  // allow dashes and spaces in card
1967
- cardNumber = cardNumber.replace(/[\s\-]/g, '');
1991
+ cardNumber = cardNumber.replace(/[\s-]/g, '');
1968
1992
 
1969
1993
  // verify card types
1970
1994
  if (requiredTypes) {
@@ -1973,10 +1997,10 @@
1973
1997
  validation = cards[type];
1974
1998
  if (validation) {
1975
1999
  valid = {
1976
- length: ($.inArray(cardNumber.length, validation.length) !== -1),
1977
- pattern: (cardNumber.search(validation.pattern) !== -1),
2000
+ length: $.inArray(cardNumber.length, validation.length) !== -1,
2001
+ pattern: cardNumber.search(validation.pattern) !== -1,
1978
2002
  };
1979
- if (valid.length && valid.pattern) {
2003
+ if (valid.length > 0 && valid.pattern) {
1980
2004
  validCard = true;
1981
2005
  }
1982
2006
  }
@@ -1989,8 +2013,8 @@
1989
2013
 
1990
2014
  // skip luhn for UnionPay
1991
2015
  unionPay = {
1992
- number: ($.inArray(cardNumber.length, cards.unionPay.length) !== -1),
1993
- pattern: (cardNumber.search(cards.unionPay.pattern) !== -1),
2016
+ number: $.inArray(cardNumber.length, cards.unionPay.length) !== -1,
2017
+ pattern: cardNumber.search(cards.unionPay.pattern) !== -1,
1994
2018
  };
1995
2019
  if (unionPay.number && unionPay.pattern) {
1996
2020
  return true;
@@ -2008,10 +2032,10 @@
2008
2032
  ;
2009
2033
  while (length--) {
2010
2034
  sum += producedValue[multiple][parseInt(cardNumber.charAt(length), 10)];
2011
- multiple ^= 1;
2035
+ multiple ^= 1; // eslint-disable-line no-bitwise
2012
2036
  }
2013
2037
 
2014
- return (sum % 10 === 0 && sum > 0);
2038
+ return sum % 10 === 0 && sum > 0;
2015
2039
  },
2016
2040
 
2017
2041
  minCount: function (value, minCount) {
@@ -2019,21 +2043,21 @@
2019
2043
  return true;
2020
2044
  }
2021
2045
  if (minCount == 1) {
2022
- return (value !== '');
2046
+ return value !== '';
2023
2047
  }
2024
2048
 
2025
- return (value.split(',').length >= minCount);
2049
+ return value.split(',').length >= minCount;
2026
2050
  },
2027
2051
 
2028
2052
  exactCount: function (value, exactCount) {
2029
2053
  if (exactCount == 0) {
2030
- return (value === '');
2054
+ return value === '';
2031
2055
  }
2032
2056
  if (exactCount == 1) {
2033
- return (value !== '' && value.search(',') === -1);
2057
+ return value !== '' && value.search(',') === -1;
2034
2058
  }
2035
2059
 
2036
- return (value.split(',').length == exactCount);
2060
+ return value.split(',').length == exactCount;
2037
2061
  },
2038
2062
 
2039
2063
  maxCount: function (value, maxCount) {
@@ -2041,10 +2065,10 @@
2041
2065
  return false;
2042
2066
  }
2043
2067
  if (maxCount == 1) {
2044
- return (value.search(',') === -1);
2068
+ return value.search(',') === -1;
2045
2069
  }
2046
2070
 
2047
- return (value.split(',').length <= maxCount);
2071
+ return value.split(',').length <= maxCount;
2048
2072
  },
2049
2073
  },
2050
2074