Socket
Socket
Sign inDemoInstall

simpl-schema

Package Overview
Dependencies
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpl-schema - npm Package Compare versions

Comparing version 1.12.2 to 1.12.3

62

dist/SimpleSchema.js

@@ -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>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc