Comparing version 4.1.1 to 4.1.2
@@ -1,5 +0,12 @@ | ||
### 4.1.1 - 2020-01-29 | ||
### 4.1.2 - 2020-01-26 | ||
#### 🐞 Fixes | ||
- **[shape]** Reset schema state after validating children. | ||
- **[array,object,string]** Updated empty checks to take nullable into account. | ||
### 4.1.1 - 2020-01-24 | ||
#### 🐞 Fixes | ||
- **[func]** Removed the generic constraint as it is too restrictive. | ||
@@ -6,0 +13,0 @@ |
@@ -585,2 +585,6 @@ function _defineProperty(obj, key, value) { | ||
this.addCheck(function (path, value) { | ||
if (_this.isNullable && value === null) { | ||
return; | ||
} | ||
if (Array.isArray(value)) { | ||
@@ -650,2 +654,6 @@ _this.invariant(value.length === length, "Array length must be " + length + ".", path); | ||
this.addCheck(function (path, value) { | ||
if (_this2.isNullable && value === null) { | ||
return; | ||
} | ||
_this2.invariant(value.length > 0, 'Array cannot be empty.', path); | ||
@@ -1021,2 +1029,6 @@ }); | ||
this.addCheck(function (path, value) { | ||
if (_this2.isNullable && value === null) { | ||
return; | ||
} | ||
_this2.invariant(Object.keys(value).length > 0, 'Object cannot be empty.', path); | ||
@@ -1091,3 +1103,5 @@ }); | ||
_proto.doRun = function doRun(value, path) { | ||
var _this3 = this; | ||
var _this$schema, | ||
_this$schema2, | ||
_this3 = this; | ||
@@ -1102,2 +1116,4 @@ if ("production" !== process.env.NODE_ENV && value) { | ||
var oldPath = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.parentPath; | ||
var oldStruct = (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : _this$schema2.parentStruct; | ||
this.schema.parentPath = path; | ||
@@ -1120,2 +1136,4 @@ this.schema.parentStruct = struct; | ||
this.schema.parentPath = oldPath; | ||
this.schema.parentStruct = oldStruct; | ||
return struct; | ||
@@ -1214,2 +1232,6 @@ }; | ||
this.addCheck(function (path, value) { | ||
if (_this4.isNullable && value === null) { | ||
return; | ||
} | ||
_this4.invariant(isString(value), 'String cannot be empty.', path); | ||
@@ -1216,0 +1238,0 @@ }); |
@@ -589,2 +589,6 @@ 'use strict'; | ||
this.addCheck(function (path, value) { | ||
if (_this.isNullable && value === null) { | ||
return; | ||
} | ||
if (Array.isArray(value)) { | ||
@@ -654,2 +658,6 @@ _this.invariant(value.length === length, "Array length must be " + length + ".", path); | ||
this.addCheck(function (path, value) { | ||
if (_this2.isNullable && value === null) { | ||
return; | ||
} | ||
_this2.invariant(value.length > 0, 'Array cannot be empty.', path); | ||
@@ -1025,2 +1033,6 @@ }); | ||
this.addCheck(function (path, value) { | ||
if (_this2.isNullable && value === null) { | ||
return; | ||
} | ||
_this2.invariant(Object.keys(value).length > 0, 'Object cannot be empty.', path); | ||
@@ -1095,3 +1107,5 @@ }); | ||
_proto.doRun = function doRun(value, path) { | ||
var _this3 = this; | ||
var _this$schema, | ||
_this$schema2, | ||
_this3 = this; | ||
@@ -1106,2 +1120,4 @@ if ("production" !== process.env.NODE_ENV && value) { | ||
var oldPath = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.parentPath; | ||
var oldStruct = (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : _this$schema2.parentStruct; | ||
this.schema.parentPath = path; | ||
@@ -1124,2 +1140,4 @@ this.schema.parentStruct = struct; | ||
this.schema.parentPath = oldPath; | ||
this.schema.parentStruct = oldStruct; | ||
return struct; | ||
@@ -1218,2 +1236,6 @@ }; | ||
this.addCheck(function (path, value) { | ||
if (_this4.isNullable && value === null) { | ||
return; | ||
} | ||
_this4.invariant(isString(value), 'String cannot be empty.', path); | ||
@@ -1220,0 +1242,0 @@ }); |
{ | ||
"name": "optimal", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"description": "A system for building and validating defined object structures.", | ||
@@ -47,6 +47,6 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@milesj/build-tools": "^0.62.0", | ||
"@types/node": "^13.1.8", | ||
"@milesj/build-tools": "^1.0.0", | ||
"@types/node": "^13.5.0", | ||
"conventional-changelog-beemo": "^1.6.0", | ||
"rollup": "^1.29.0", | ||
"rollup": "^1.29.1", | ||
"rollup-plugin-babel": "^4.3.3", | ||
@@ -53,0 +53,0 @@ "rollup-plugin-node-resolve": "^5.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105083
2605