knight-validation 3.3.1 → 3.3.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.
@@ -85,7 +85,7 @@ class Validator {
85
85
  let misfittingProperties = [];
86
86
  for (let entry of this.entries) {
87
87
  let constraintOrValidatorName = entry.constraint ? (_a = entry.constraint) === null || _a === void 0 ? void 0 : _a.name : entry.validator ? entry.validator.constructor.name : '';
88
- l.location = ['' + entry.properties + ' ' + constraintOrValidatorName];
88
+ l.location = ['' + JSON.stringify(entry.properties) + ' > ' + constraintOrValidatorName];
89
89
  let propertyAlreadyHasAMisfit = false;
90
90
  for (let property of entry.properties) {
91
91
  if (misfittingProperties.indexOf(property) > -1) {
@@ -160,9 +160,17 @@ class Validator {
160
160
  let property = entry.properties[0];
161
161
  let dotNotation = new DotNotation_1.DotNotation(property);
162
162
  let value = dotNotation.get(object);
163
+ if (typeof value != 'object' || value === null) {
164
+ l.dev('Value of the property is not of type object or null. Skipping...', value);
165
+ continue;
166
+ }
163
167
  if (value instanceof Array) {
164
168
  l.dev('Value of the property is an array. Iterating its elements...');
165
169
  for (let i = 0; i < value.length; i++) {
170
+ if (typeof value[i] != 'object' || value[i] === null) {
171
+ l.dev('Array element is not of type object or null. Skipping...', value[i]);
172
+ continue;
173
+ }
166
174
  l.calling('entry.validator.validate', value[i], options);
167
175
  let subMisfits = yield entry.validator.validate(value[i], options);
168
176
  l.called('entry.validator.validate');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knight-validation",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "A validation lib",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",