simpl-schema
Advanced tools
Comparing version 1.12.2 to 1.12.3
@@ -522,3 +522,30 @@ "use strict"; | ||
if (!keyPrefix) return this._firstLevelSchemaKeys; | ||
return this._objectKeys["".concat(keyPrefix, ".")] || []; | ||
var objectKeys = []; | ||
var setObjectKeys = function setObjectKeys(curSchema, schemaParentKey) { | ||
Object.keys(curSchema).forEach(function (fieldName) { | ||
var definition = curSchema[fieldName]; | ||
fieldName = schemaParentKey ? "".concat(schemaParentKey, ".").concat(fieldName) : fieldName; | ||
if (fieldName.indexOf('.') > -1 && fieldName.slice(-2) !== '.$') { | ||
var parentKey = fieldName.slice(0, fieldName.lastIndexOf('.')); | ||
var parentKeyWithDot = "".concat(parentKey, "."); | ||
objectKeys[parentKeyWithDot] = objectKeys[parentKeyWithDot] || []; | ||
objectKeys[parentKeyWithDot].push(fieldName.slice(fieldName.lastIndexOf('.') + 1)); | ||
} // If the current field is a nested SimpleSchema, | ||
// iterate over the child fields and cache their properties as well | ||
definition.type.definitions.forEach(function (_ref2) { | ||
var type = _ref2.type; | ||
if (SimpleSchema.isSimpleSchema(type)) { | ||
setObjectKeys(type._schema, fieldName); | ||
} | ||
}); | ||
}); | ||
}; | ||
setObjectKeys(this._schema); | ||
return objectKeys["".concat(keyPrefix, ".")] || []; | ||
} | ||
@@ -608,4 +635,3 @@ /** | ||
this._blackboxKeys = new Set(); | ||
this._firstLevelSchemaKeys = []; | ||
this._objectKeys = {}; // Update all of the information cached on the instance | ||
this._firstLevelSchemaKeys = []; // Update all of the information cached on the instance | ||
@@ -656,32 +682,4 @@ this._schemaKeys.forEach(function (fieldName) { | ||
} | ||
}); // Store child keys keyed by parent. This needs to be done recursively to handle | ||
// subschemas. | ||
}); | ||
var setObjectKeys = function setObjectKeys(curSchema, schemaParentKey) { | ||
Object.keys(curSchema).forEach(function (fieldName) { | ||
var definition = curSchema[fieldName]; | ||
fieldName = schemaParentKey ? "".concat(schemaParentKey, ".").concat(fieldName) : fieldName; | ||
if (fieldName.indexOf('.') > -1 && fieldName.slice(-2) !== '.$') { | ||
var parentKey = fieldName.slice(0, fieldName.lastIndexOf('.')); | ||
var parentKeyWithDot = "".concat(parentKey, "."); | ||
_this8._objectKeys[parentKeyWithDot] = _this8._objectKeys[parentKeyWithDot] || []; | ||
_this8._objectKeys[parentKeyWithDot].push(fieldName.slice(fieldName.lastIndexOf('.') + 1)); | ||
} // If the current field is a nested SimpleSchema, | ||
// iterate over the child fields and cache their properties as well | ||
definition.type.definitions.forEach(function (_ref2) { | ||
var type = _ref2.type; | ||
if (SimpleSchema.isSimpleSchema(type)) { | ||
setObjectKeys(type._schema, fieldName); | ||
} | ||
}); | ||
}); | ||
}; | ||
setObjectKeys(this._schema); | ||
return this; | ||
@@ -688,0 +686,0 @@ } |
{ | ||
"name": "simpl-schema", | ||
"version": "1.12.2", | ||
"version": "1.12.3", | ||
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.", | ||
@@ -5,0 +5,0 @@ "author": "Eric Dobbertin <aldeed@gmail.com>", |
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
209001
2986