@impelsys/validatorjs 3.22.4 → 3.23.0

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@impelsys/validatorjs",
3
3
  "description": "Validation library inspired by Laravel's Validator",
4
- "version": "3.22.4",
4
+ "version": "3.23.0",
5
5
  "author": "David <david@thejsguy.com>",
6
6
  "contributors": [
7
7
  {
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ],
20
20
  "license": "MIT",
21
- "main": "./src/validator.js",
21
+ "main": "./src/validator.mjs",
22
22
  "repository": {
23
23
  "type": "git",
24
24
  "url": "https://github.com/mikeerickson/validatorjs"
@@ -78,4 +78,4 @@ AsyncResolvers.prototype = {
78
78
 
79
79
  };
80
80
 
81
- module.exports = AsyncResolvers;
81
+ export default AsyncResolvers;
@@ -193,7 +193,7 @@ function formatter(attribute) {
193
193
  return attribute.replace(/[_\[]/g, ' ').replace(/]/g, '');
194
194
  }
195
195
 
196
- module.exports = {
196
+ export default {
197
197
  replacements: replacements,
198
198
  formatter: formatter
199
199
  };
@@ -74,4 +74,4 @@ Errors.prototype = {
74
74
  }
75
75
  };
76
76
 
77
- module.exports = Errors;
77
+ export default Errors;
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  accepted: 'The :attribute must be accepted.',
3
3
  after: 'The :attribute must be after :after.',
4
4
  after_or_equal: 'The :attribute must be equal or after :after_or_equal.',
@@ -1,8 +1,6 @@
1
- var Messages = require('./messages');
1
+ import Messages from './messages.mjs';
2
2
 
3
- require('./lang/en');
4
-
5
- var require_method = require;
3
+ import rawMessages from './lang/en.mjs';
6
4
 
7
5
  var container = {
8
6
 
@@ -45,7 +43,6 @@ var container = {
45
43
  _load: function(lang) {
46
44
  if (!this.messages[lang]) {
47
45
  try {
48
- var rawMessages = require_method('./lang/' + lang);
49
46
  this._set(lang, rawMessages);
50
47
  } catch (e) {}
51
48
  }
@@ -75,4 +72,4 @@ var container = {
75
72
 
76
73
  };
77
74
 
78
- module.exports = container;
75
+ export default container;
@@ -1,4 +1,4 @@
1
- var Attributes = require('./attributes');
1
+ import Attributes from './attributes.mjs';
2
2
 
3
3
  var Messages = function(lang, messages) {
4
4
  this.lang = lang;
@@ -149,4 +149,4 @@ Messages.prototype = {
149
149
 
150
150
  };
151
151
 
152
- module.exports = Messages;
152
+ export default Messages
@@ -496,7 +496,7 @@ var rules = {
496
496
  // regex to check that each octet is valid
497
497
  var er = /^[0-9]+$/;
498
498
  // ipv4 octets are delimited by dot
499
- octets = val.split('.');
499
+ var octets = val.split('.');
500
500
  // check 1: ipv4 address should contains 4 octets
501
501
  if (octets.length != 4)
502
502
  return false;
@@ -524,10 +524,10 @@ var rules = {
524
524
  // regex to check that each hextet is valid
525
525
  var er = /^[0-9a-f]+$/;
526
526
  // ipv6 hextets are delimited by colon
527
- hextets = val.split(':');
527
+ var hextets = val.split(':');
528
528
 
529
529
  // check 1: ipv6 should contain only one consecutive colons
530
- colons = val.match(/::/);
530
+ var colons = val.match(/::/);
531
531
  if (colons != null && val.match(/::/g).length > 1)
532
532
  return false;
533
533
 
@@ -861,4 +861,4 @@ var manager = {
861
861
  }
862
862
  };
863
863
 
864
- module.exports = manager;
864
+ export default manager
@@ -1,8 +1,8 @@
1
- var Rules = require('./rules');
2
- var Lang = require('./lang');
3
- var Errors = require('./errors');
4
- var Attributes = require('./attributes');
5
- var AsyncResolvers = require('./async');
1
+ import Rules from './rules.mjs';
2
+ import Lang from './lang.mjs';
3
+ import Errors from './errors.mjs';
4
+ import Attributes from './attributes.mjs';
5
+ import AsyncResolvers from './async.mjs';
6
6
 
7
7
  var Validator = function (input, rules, customMessages) {
8
8
  var lang = Validator.getDefaultLang();
@@ -659,4 +659,5 @@ Validator.registerMissedRuleValidator = function(fn, message) {
659
659
  Rules.registerMissedRuleValidator(fn, message);
660
660
  };
661
661
 
662
- module.exports = Validator;
662
+
663
+ export default Validator;