@orion-js/schema 3.2.28 → 3.2.29

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.
@@ -13,7 +13,7 @@ exports.default = (0, fieldType_1.default)({
13
13
  if ((value === '' || (0, lodash_1.isNil)(value)) && !currentSchema.optional) {
14
14
  return Errors_1.default.REQUIRED;
15
15
  }
16
- if (!(0, isString_1.default)(value))
16
+ if (value && !(0, isString_1.default)(value))
17
17
  return Errors_1.default.NOT_A_STRING;
18
18
  // eslint-disable-next-line
19
19
  const regex = /^(([^<>()[\]\\.,;:\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,}))$/;
@@ -13,6 +13,7 @@ test('return an error when the value is incorrect', async () => {
13
13
  expect(email_1.default.validate(null)).toBe(Errors_1.default.REQUIRED);
14
14
  expect(email_1.default.validate('')).toBe(Errors_1.default.REQUIRED);
15
15
  expect(email_1.default.validate('', { currentSchema: { optional: true } })).toBeFalsy();
16
+ expect(email_1.default.validate(null, { currentSchema: { optional: true } })).toBeFalsy();
16
17
  });
17
18
  test('return no error when the value is correct', async () => {
18
19
  expect(email_1.default.validate('aemail@email.com')).toBeFalsy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/schema",
3
- "version": "3.2.28",
3
+ "version": "3.2.29",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "670440985bbd077e154e5d225337bbf242701f5a"
39
+ "gitHead": "73acda2229c205547d70d19376984443d5625b20"
40
40
  }