co.validation 2.2.1 → 2.2.2

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.
@@ -521,6 +521,12 @@ describe('createValidation', () => {
521
521
  data: undefined,
522
522
  errors: ['Invalid email format']
523
523
  });
524
+ expect((0, _.createValidation)({
525
+ type: 'email'
526
+ })('email.@mail.com')).toEqual({
527
+ data: undefined,
528
+ errors: ['Invalid email format']
529
+ });
524
530
  });
525
531
  it('supports alphanumeric', () => {
526
532
  expect((0, _.createValidation)({
package/lib/validators.js CHANGED
@@ -102,10 +102,11 @@ const maxValue = ({
102
102
  };
103
103
 
104
104
  exports.maxValue = maxValue;
105
+ const emailRegex = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
105
106
 
106
107
  const email = ({
107
108
  getMessage
108
- }) => value => value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value) ? {
109
+ }) => value => value && !emailRegex.test(value) ? {
109
110
  errors: (0, _messageProcessor.default)(getMessage, '##email')
110
111
  } : {
111
112
  data: value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "co.validation",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "JSON based fluent validation for browser, node.js, redux-form and anything javascript compatible.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {