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.10.2 to 1.11.0

9

dist/clean.js

@@ -32,2 +32,3 @@ "use strict";

var operatorsToIgnoreValue = ['$unset', '$currentDate'];
/**

@@ -55,9 +56,10 @@ * @param {SimpleSchema} ss - A SimpleSchema instance

*/
function clean(ss, doc) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
// By default, doc will be filtered and autoconverted
options = _objectSpread({
options = _objectSpread(_objectSpread({
isModifier: (0, _utility.looksLikeModifier)(doc),
isUpsert: false
}, ss._cleanOptions, {}, options); // Clone so we do not mutate
}, ss._cleanOptions), options); // Clone so we do not mutate

@@ -73,3 +75,4 @@ var cleanDoc = options.mutate ? doc : (0, _clone.default)(doc);

// Also we do not care if fields not in the schema are unset.
if (this.operator === '$unset') return;
// Other operators also have values that we wouldn't want to clean.
if (operatorsToIgnoreValue.includes(this.operator)) return;
var gKey = this.genericKey;

@@ -76,0 +79,0 @@ if (!gKey) return;

@@ -37,5 +37,3 @@ "use strict";

var AutoValueRunner =
/*#__PURE__*/
function () {
var AutoValueRunner = /*#__PURE__*/function () {
function AutoValueRunner(options) {

@@ -42,0 +40,0 @@ _classCallCheck(this, AutoValueRunner);

@@ -22,10 +22,14 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -151,6 +155,6 @@

var finalValidatorContext = _objectSpread({}, validatorContext, {
var finalValidatorContext = _objectSpread(_objectSpread({}, validatorContext), {}, {
// Take outer definition props like "optional" and "label"
// and add them to inner props like "type" and "min"
definition: _objectSpread({}, definitionWithoutType, {}, typeDef)
definition: _objectSpread(_objectSpread({}, definitionWithoutType), typeDef)
}); // Add custom field validators to the list after the built-in

@@ -157,0 +161,0 @@ // validators but before the schema and global validators.

@@ -38,16 +38,18 @@ "use strict";

function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -57,10 +59,14 @@

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

@@ -84,5 +90,3 @@

var SimpleSchema =
/*#__PURE__*/
function () {
var SimpleSchema = /*#__PURE__*/function () {
function SimpleSchema() {

@@ -99,7 +103,7 @@ var schema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

// Stash the options object
this._constructorOptions = _objectSpread({}, SimpleSchema._constructorOptionDefaults, {}, options);
this._constructorOptions = _objectSpread(_objectSpread({}, SimpleSchema._constructorOptionDefaults), options);
delete this._constructorOptions.clean; // stored separately below
// Schema-level defaults for cleaning
this._cleanOptions = _objectSpread({}, SimpleSchema._constructorOptionDefaults.clean, {}, options.clean || {}); // Custom validators for this instance
this._cleanOptions = _objectSpread(_objectSpread({}, SimpleSchema._constructorOptionDefaults.clean), options.clean || {}); // Custom validators for this instance

@@ -113,9 +117,20 @@ this._validators = [];

this._depsLabels = {};
this.extend(schema); // Define default validation error messages
this.extend(schema); // Clone raw definition and save if keepRawDefinition is active
this._rawDefinition = this._constructorOptions.keepRawDefinition ? schema : null; // Define default validation error messages
this.messageBox = new _messageBox.default((0, _clone.default)(_defaultMessages.default));
this.version = SimpleSchema.version;
}
/**
/* @returns {Object} The entire raw schema definition passed in the constructor
*/
_createClass(SimpleSchema, [{
key: "rawDefinition",
get: function get() {
return this._rawDefinition;
}
}, {
key: "forEachAncestorSimpleSchema",

@@ -145,3 +160,3 @@ value: function forEachAncestorSimpleSchema(key, func) {

key: "reactiveLabelDependency",
value:
/**

@@ -151,3 +166,3 @@ * For Meteor apps, add a reactive dependency on the label

*/
value: function reactiveLabelDependency(key) {
function reactiveLabelDependency(key) {
var tracker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._constructorOptions.tracker;

@@ -583,3 +598,3 @@ if (!key || !tracker) return;

_this8._schema[fieldName] = _objectSpread({}, _this8._schema[fieldName], {}, definitionWithoutType);
_this8._schema[fieldName] = _objectSpread(_objectSpread({}, _this8._schema[fieldName]), definitionWithoutType);
if (definition.type) _this8._schema[fieldName].type.extend(definition.type);

@@ -614,8 +629,7 @@ } else {

var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _iterator = _createForOfIteratorHelper(definition.type.definitions),
_step;
try {
for (var _iterator = definition.type.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var oneOfDef = _step.value;

@@ -634,14 +648,5 @@

} catch (err) {
_didIteratorError = true;
_iteratorError = err;
_iterator.e(err);
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
_iterator.f();
}

@@ -775,3 +780,3 @@

error.details = errors.map(function (errorDetail) {
return _objectSpread({}, errorDetail, {
return _objectSpread(_objectSpread({}, errorDetail), {}, {
message: _this9.messageForError(errorDetail)

@@ -807,3 +812,3 @@ });

var errors = validationContext.validationErrors().map(function (errorDetail) {
return _objectSpread({}, errorDetail, {
return _objectSpread(_objectSpread({}, errorDetail), {}, {
message: _this10.messageForError(errorDetail)

@@ -841,3 +846,3 @@ });

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return this.validator(_objectSpread({}, options, {
return this.validator(_objectSpread(_objectSpread({}, options), {}, {
returnErrorsPromise: true

@@ -967,4 +972,4 @@ }));

key: "extendOptions",
// If you need to allow properties other than those listed above, call this from your app or package
value: function extendOptions(options) {
value: // If you need to allow properties other than those listed above, call this from your app or package
function extendOptions(options) {
// For backwards compatibility we still take an object here, but we only care about the names

@@ -1017,10 +1022,10 @@ if (!Array.isArray(options)) options = Object.keys(options);

key: "constructorOptionDefaults",
value:
/**
* @summary Get/set default values for SimpleSchema constructor options
*/
value: function constructorOptionDefaults(options) {
function constructorOptionDefaults(options) {
if (!options) return SimpleSchema._constructorOptionDefaults;
SimpleSchema._constructorOptionDefaults = _objectSpread({}, SimpleSchema._constructorOptionDefaults, {}, options, {
clean: _objectSpread({}, SimpleSchema._constructorOptionDefaults.clean, {}, options.clean || {})
SimpleSchema._constructorOptionDefaults = _objectSpread(_objectSpread(_objectSpread({}, SimpleSchema._constructorOptionDefaults), options), {}, {
clean: _objectSpread(_objectSpread({}, SimpleSchema._constructorOptionDefaults.clean), options.clean || {})
});

@@ -1027,0 +1032,0 @@ }

@@ -12,16 +12,20 @@ "use strict";

function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

@@ -39,5 +43,3 @@

var SimpleSchemaGroup =
/*#__PURE__*/
function () {
var SimpleSchemaGroup = /*#__PURE__*/function () {
function SimpleSchemaGroup() {

@@ -69,2 +71,7 @@ _classCallCheck(this, SimpleSchemaGroup);

_createClass(SimpleSchemaGroup, [{
key: "singleType",
get: function get() {
return this.definitions[0].type;
}
}, {
key: "clone",

@@ -81,10 +88,5 @@ value: function clone() {

if (!otherDef) return def;
return _objectSpread({}, def, {}, otherDef);
return _objectSpread(_objectSpread({}, def), otherDef);
});
}
}, {
key: "singleType",
get: function get() {
return this.definitions[0].type;
}
}]);

@@ -91,0 +93,0 @@

@@ -52,8 +52,23 @@ "use strict";

// Generic constructor checks
if (!(keyValue instanceof expectedType)) return {
type: _SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE,
dataType: expectedType.name
}; // Date checks
if (!(keyValue instanceof expectedType)) {
// https://docs.mongodb.com/manual/reference/operator/update/currentDate/
var dateTypeIsOkay = expectedType === Date && op === '$currentDate' && (keyValue === true || JSON.stringify(keyValue) === '{"$type":"date"}');
if (expectedType === Date) return (0, _doDateChecks.default)(def, keyValue);
if (expectedType !== Date || !dateTypeIsOkay) {
return {
type: _SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE,
dataType: expectedType.name
};
}
} // Date checks
if (expectedType === Date) {
// https://docs.mongodb.com/manual/reference/operator/update/currentDate/
if (op === '$currentDate') {
return (0, _doDateChecks.default)(def, new Date());
}
return (0, _doDateChecks.default)(def, keyValue);
}
}

@@ -60,0 +75,0 @@ }

@@ -14,2 +14,8 @@ "use strict";

function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -21,5 +27,3 @@

var ValidationContext =
/*#__PURE__*/
function () {
var ValidationContext = /*#__PURE__*/function () {
/**

@@ -178,5 +182,4 @@ * @param {SimpleSchema} ss SimpleSchema instance to use for validation

/* eslint-disable no-restricted-syntax */
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _iterator = _createForOfIteratorHelper(this._validationErrors),
_step;

@@ -192,3 +195,3 @@ try {

for (var _iterator = this._validationErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
_loop();

@@ -199,14 +202,5 @@ }

} catch (err) {
_didIteratorError = true;
_iteratorError = err;
_iterator.e(err);
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
_iterator.f();
}

@@ -213,0 +207,0 @@ }

{
"name": "simpl-schema",
"version": "1.10.2",
"version": "1.11.0",
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.",

@@ -39,19 +39,19 @@ "author": "Eric Dobbertin <aldeed@gmail.com>",

"devDependencies": {
"@babel/cli": "7.8.4",
"@babel/core": "7.8.4",
"@babel/plugin-proposal-class-properties": "7.8.3",
"@babel/plugin-proposal-object-rest-spread": "7.8.3",
"@babel/polyfill": "7.8.3",
"@babel/preset-env": "7.8.4",
"@babel/register": "7.8.3",
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.15",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.13.15",
"@babel/register": "^7.13.14",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.3",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^1.0.4",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.11.0",
"expect": "^1.20.1",
"mocha": "^7.1.1",
"semantic-release": "^17.0.7"
"semantic-release": "^17.4.2"
},

@@ -58,0 +58,0 @@ "babel": {

@@ -47,2 +47,3 @@ # SimpleSchema (simpl-schema NPM package)

- [Extracting Schemas](#extracting-schemas)
- [Raw Definition](#raw-definition)
- [Schema Keys](#schema-keys)

@@ -613,2 +614,19 @@ - [Schema Rules](#schema-rules)

### Raw Definition
Sometimes if you want to get the `rawDefinition` of some schema just pass in the options `{ keepRawDefinition: true}`(if not arg is passed the value will be null). Example:
```javascript
const userSchema = new SimpleSchema({
name: String,
number: 'SimpleSchema.Integer',
email: String
}, { keepRawDefintion: true });
userSchema.rawDefinition;
//{
// name: String,
// number: 'SimpleSchema.Integer',
// email: String
//}
```
## Schema Keys

@@ -615,0 +633,0 @@

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