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.5.9 to 1.6.0

dist/SimpleSchema_rules.tests.js

26

dist/clean.js

@@ -6,8 +6,6 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _clone = _interopRequireDefault(require("clone"));
var _lodash = _interopRequireDefault(require("lodash.isempty"));
var _mongoObject = _interopRequireDefault(require("mongo-object"));

@@ -25,3 +23,3 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -66,4 +64,4 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

var cleanDoc = options.mutate ? doc : (0, _clone["default"])(doc);
var mongoObject = options.mongoObject || new _mongoObject["default"](cleanDoc, ss.blackboxKeys()); // Clean loop
var cleanDoc = options.mutate ? doc : (0, _clone.default)(doc);
var mongoObject = options.mongoObject || new _mongoObject.default(cleanDoc, ss.blackboxKeys()); // Clean loop

@@ -106,3 +104,3 @@ if (options.filter || options.autoConvert || options.removeEmptyStrings || options.trimStrings) {

var isValidType = defs.some(function (definition) {
var errors = _typeValidator["default"].call({
var errors = _typeValidator.default.call({
valueShouldBeChecked: true,

@@ -117,3 +115,3 @@ definition: definition,

if (!isValidType) {
var newVal = (0, _convertToProperType["default"])(val, def.type);
var newVal = (0, _convertToProperType.default)(val, def.type);

@@ -161,3 +159,3 @@ if (newVal !== undefined && newVal !== val) {

var value = mongoObject.getValueForPosition(removedPositionParent);
if ((0, _lodash["default"])(value)) mongoObject.removeValueForPosition(removedPositionParent);
if ((0, _utility.isEmptyObject)(value)) mongoObject.removeValueForPosition(removedPositionParent);
}

@@ -169,3 +167,3 @@ });

options.getAutoValues && (0, _setAutoValues["default"])(ss.autoValueFunctions(), mongoObject, options.isModifier, options.isUpsert, options.extendAutoValueContext); // Ensure we don't have any operators set to an empty object
options.getAutoValues && (0, _setAutoValues.default)(ss.autoValueFunctions(), mongoObject, options.isModifier, options.isUpsert, options.extendAutoValueContext); // Ensure we don't have any operators set to an empty object
// since MongoDB 2.6+ will throw errors.

@@ -175,3 +173,7 @@

Object.keys(cleanDoc || {}).forEach(function (op) {
if ((0, _lodash["default"])(cleanDoc[op])) delete cleanDoc[op];
var operatorValue = cleanDoc[op];
if (_typeof(operatorValue) === 'object' && operatorValue !== null && (0, _utility.isEmptyObject)(operatorValue)) {
delete cleanDoc[op];
}
});

@@ -184,4 +186,4 @@ }

var _default = clean;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -9,3 +9,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -49,3 +49,3 @@ /* eslint-disable func-names, prefer-arrow-callback */

},
"boolean": {
boolean: {
type: Boolean,

@@ -181,3 +181,3 @@ optional: true

customObject: {
type: _Address["default"],
type: _Address.default,
optional: true,

@@ -204,3 +204,3 @@ blackbox: true

});
(0, _expect["default"])(given).toEqual(expected);
(0, _expect.default)(given).toEqual(expected);
};

@@ -233,3 +233,3 @@ }

}, {}, false));
var myObj = new _Address["default"]('New York', 'NY');
var myObj = new _Address.default('New York', 'NY');
it('when you clean a good custom object it is still good', getTest({

@@ -559,3 +559,3 @@ customObject: myObj

objectArray: {
"boolean": true
boolean: true
}

@@ -566,3 +566,3 @@ }

objectArray: {
"boolean": true
boolean: true
}

@@ -825,3 +825,3 @@ }

});
(0, _expect["default"])(cleanObj).toEqual(expected);
(0, _expect.default)(cleanObj).toEqual(expected);
} // DOC

@@ -960,3 +960,3 @@

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
noTrimString: ' This is a string '

@@ -991,3 +991,3 @@ });

});
(0, _expect["default"])(myObj).toEqual({
(0, _expect.default)(myObj).toEqual({
$set: {

@@ -1007,3 +1007,3 @@ requiredObj: {

});
(0, _expect["default"])(myObj1).toEqual({
(0, _expect.default)(myObj1).toEqual({
allowedStringsArray: ['tuna']

@@ -1020,3 +1020,3 @@ });

});
(0, _expect["default"])(myObj2).toEqual({
(0, _expect.default)(myObj2).toEqual({
$set: {

@@ -1052,3 +1052,3 @@ allowedStringsArray: ['tuna']

var expected = JSON.stringify(doc);
(0, _expect["default"])(JSON.stringify(schema.clean(doc))).toEqual(expected);
(0, _expect.default)(JSON.stringify(schema.clean(doc))).toEqual(expected);
});

@@ -1065,3 +1065,3 @@ it('removeNullsFromArrays removes nulls from arrays', function () {

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
names: ['foo']

@@ -1086,3 +1086,3 @@ });

(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
$set: {

@@ -1112,3 +1112,3 @@ a: [{

});
(0, _expect["default"])(doc).toEqual({
(0, _expect.default)(doc).toEqual({
names: []

@@ -1136,3 +1136,3 @@ });

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
nested: [{

@@ -1160,3 +1160,3 @@ doubleNested: {

});
(0, _expect["default"])(cleanObj).toEqual(expected);
(0, _expect.default)(cleanObj).toEqual(expected);
}

@@ -1198,3 +1198,3 @@

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
field: dateStrng

@@ -1214,3 +1214,3 @@ });

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
field: 12345

@@ -1230,3 +1230,3 @@ });

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
field: '12345'

@@ -1341,3 +1341,3 @@ });

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
$set: {

@@ -1361,3 +1361,3 @@ field: dateString

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
$set: {

@@ -1381,3 +1381,3 @@ field: 12345

});
(0, _expect["default"])(cleanObj).toEqual({
(0, _expect.default)(cleanObj).toEqual({
$set: {

@@ -1384,0 +1384,0 @@ field: '12345'

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -23,9 +23,9 @@ /* eslint-disable func-names, prefer-arrow-callback */

autoValue: function autoValue() {
(0, _expect["default"])(this.key).toBe('bar');
(0, _expect["default"])(this.closestSubschemaFieldName).toBe(null);
(0, _expect["default"])(this.isSet).toBe(false);
(0, _expect["default"])(this.value).toBe(undefined);
(0, _expect["default"])(this.operator).toBe(null);
(0, _expect.default)(this.key).toBe('bar');
(0, _expect.default)(this.closestSubschemaFieldName).toBe(null);
(0, _expect.default)(this.isSet).toBe(false);
(0, _expect.default)(this.value).toBe(undefined);
(0, _expect.default)(this.operator).toBe(null);
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: false,

@@ -36,3 +36,3 @@ operator: null,

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: false,

@@ -43,3 +43,3 @@ operator: null,

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -64,7 +64,7 @@ operator: null,

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(false);
(0, _expect["default"])(this.value).toBe(undefined);
(0, _expect["default"])(this.operator).toBe(null);
(0, _expect.default)(this.isSet).toBe(false);
(0, _expect.default)(this.value).toBe(undefined);
(0, _expect.default)(this.operator).toBe(null);
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: true,

@@ -75,3 +75,3 @@ operator: null,

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: true,

@@ -82,3 +82,3 @@ operator: null,

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -105,7 +105,7 @@ operator: null,

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(true);
(0, _expect["default"])(this.value).toBe(true);
(0, _expect["default"])(this.operator).toBe(null);
(0, _expect.default)(this.isSet).toBe(true);
(0, _expect.default)(this.value).toBe(true);
(0, _expect.default)(this.operator).toBe(null);
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: true,

@@ -116,3 +116,3 @@ operator: null,

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: true,

@@ -123,3 +123,3 @@ operator: null,

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -147,3 +147,3 @@ operator: null,

autoValue: function autoValue() {
(0, _expect["default"])(this.parentField()).toEqual({
(0, _expect.default)(this.parentField()).toEqual({
isSet: true,

@@ -166,4 +166,4 @@ operator: null,

autoValue: function autoValue() {
(0, _expect["default"])(this.key).toBe('dig.dug');
(0, _expect["default"])(this.closestSubschemaFieldName).toBe('dig');
(0, _expect.default)(this.key).toBe('dig.dug');
(0, _expect.default)(this.closestSubschemaFieldName).toBe('dig');
}

@@ -192,7 +192,7 @@ }

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(true);
(0, _expect["default"])(this.value).toBe(false);
(0, _expect["default"])(this.operator).toBe(null);
(0, _expect.default)(this.isSet).toBe(true);
(0, _expect.default)(this.value).toBe(false);
(0, _expect.default)(this.operator).toBe(null);
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: false,

@@ -203,3 +203,3 @@ operator: null,

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: false,

@@ -210,3 +210,3 @@ operator: null,

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -223,3 +223,3 @@ operator: null,

};
(0, _expect["default"])(schema.clean(doc)).toEqual({});
(0, _expect.default)(schema.clean(doc)).toEqual({});
});

@@ -236,7 +236,7 @@ it('$set self and no other key', function () {

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(true);
(0, _expect["default"])(this.value).toBe(false);
(0, _expect["default"])(this.operator).toBe('$set');
(0, _expect.default)(this.isSet).toBe(true);
(0, _expect.default)(this.value).toBe(false);
(0, _expect.default)(this.operator).toBe('$set');
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: false,

@@ -247,3 +247,3 @@ operator: null,

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: false,

@@ -254,3 +254,3 @@ operator: null,

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -269,3 +269,3 @@ operator: null,

schema.clean(doc);
(0, _expect["default"])(doc).toEqual({
(0, _expect.default)(doc).toEqual({
$set: {

@@ -286,7 +286,7 @@ bar: false

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(true);
(0, _expect["default"])(this.value).toBe(false);
(0, _expect["default"])(this.operator).toBe('$set');
(0, _expect.default)(this.isSet).toBe(true);
(0, _expect.default)(this.value).toBe(false);
(0, _expect.default)(this.operator).toBe('$set');
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: true,

@@ -297,3 +297,3 @@ operator: '$set',

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: true,

@@ -304,3 +304,3 @@ operator: '$set',

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -320,3 +320,3 @@ operator: null,

};
(0, _expect["default"])(schema.clean(doc)).toEqual({
(0, _expect.default)(schema.clean(doc)).toEqual({
$set: {

@@ -338,7 +338,7 @@ foo: 'clown',

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(false);
(0, _expect["default"])(this.value).toBe(undefined);
(0, _expect["default"])(this.operator).toBe('$set');
(0, _expect.default)(this.isSet).toBe(false);
(0, _expect.default)(this.value).toBe(undefined);
(0, _expect.default)(this.operator).toBe('$set');
var foo = this.field('foo');
(0, _expect["default"])(foo).toEqual({
(0, _expect.default)(foo).toEqual({
isSet: false,

@@ -349,3 +349,3 @@ operator: null,

var fooSibling = this.siblingField('foo');
(0, _expect["default"])(fooSibling).toEqual({
(0, _expect.default)(fooSibling).toEqual({
isSet: false,

@@ -356,3 +356,3 @@ operator: null,

var fooParent = this.parentField();
(0, _expect["default"])(fooParent).toEqual({
(0, _expect.default)(fooParent).toEqual({
isSet: false,

@@ -368,3 +368,3 @@ operator: null,

});
(0, _expect["default"])(schema.clean({}, {
(0, _expect.default)(schema.clean({}, {
isModifier: true

@@ -419,3 +419,3 @@ })).toEqual({

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
content: 'foo',

@@ -433,3 +433,3 @@ updatesHistory: [{

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -472,3 +472,3 @@ content: 'foo'

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$push: {

@@ -490,3 +490,3 @@ avArrayOfObjects: {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -527,3 +527,3 @@ avArrayOfObjects: [{

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$push: {

@@ -570,3 +570,3 @@ psuedoEach: {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
name: 'Test',

@@ -580,3 +580,3 @@ someDefault: 5,

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
name: 'Test',

@@ -592,3 +592,3 @@ someDefault: 20,

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -608,5 +608,5 @@ name: 'Test',

autoValue: function autoValue() {
(0, _expect["default"])(this.isSet).toBe(true);
(0, _expect["default"])(this.operator).toEqual('$set');
(0, _expect["default"])(this.value).toEqual('should be overridden by autovalue');
(0, _expect.default)(this.isSet).toBe(true);
(0, _expect.default)(this.operator).toEqual('$set');
(0, _expect.default)(this.value).toEqual('should be overridden by autovalue');
return 'autovalue';

@@ -631,3 +631,3 @@ }

});
(0, _expect["default"])(result.$set['children.$.value']).toBe('autovalue');
(0, _expect.default)(result.$set['children.$.value']).toBe('autovalue');
});

@@ -641,3 +641,3 @@ it('operator correct for $pull', function () {

called = true;
(0, _expect["default"])(this.operator).toEqual('$pull');
(0, _expect.default)(this.operator).toEqual('$pull');
}

@@ -654,3 +654,3 @@ },

});
(0, _expect["default"])(called).toBe(true);
(0, _expect.default)(called).toBe(true);
});

@@ -667,4 +667,4 @@ it('issue 340', function () {

called++;
(0, _expect["default"])(this.field('field1').value).toBe(1);
(0, _expect["default"])(this.siblingField('field1').value).toBe(1);
(0, _expect.default)(this.field('field1').value).toBe(1);
(0, _expect.default)(this.siblingField('field1').value).toBe(1);
return 'foo';

@@ -682,3 +682,3 @@ }

});
(0, _expect["default"])(called).toBe(2);
(0, _expect.default)(called).toBe(2);
});

@@ -710,3 +710,3 @@ it('should allow getting previous autoValue in later autoValue', function () {

});
(0, _expect["default"])(schema.clean({
(0, _expect.default)(schema.clean({
amount: 1

@@ -730,3 +730,3 @@ })).toEqual({

schema2.extend(schema1);
(0, _expect["default"])(schema2.clean({
(0, _expect.default)(schema2.clean({
a: 1

@@ -753,3 +753,3 @@ })).toEqual({

};
(0, _expect["default"])(schema.clean(obj)).toEqual({
(0, _expect.default)(schema.clean(obj)).toEqual({
tags: []

@@ -760,3 +760,3 @@ });

};
(0, _expect["default"])(schema.clean(obj2)).toEqual({
(0, _expect.default)(schema.clean(obj2)).toEqual({
tags: ['foo', 'bar']

@@ -788,3 +788,3 @@ });

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
nested: [{

@@ -822,3 +822,3 @@ doubleNested: {

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
$push: {

@@ -859,3 +859,3 @@ nested: {

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
$set: {

@@ -889,3 +889,3 @@ nested: [{

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
$set: {

@@ -925,3 +925,3 @@ 'nested.0.doubleNested': {

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
nested: [{

@@ -963,3 +963,3 @@ doubleNested: {

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
$push: {

@@ -995,6 +995,6 @@ nested: {

(0, _expect["default"])(schema1.clean({})).toEqual({
(0, _expect.default)(schema1.clean({})).toEqual({
obj: {}
});
(0, _expect["default"])(schema2.clean({})).toEqual({
(0, _expect.default)(schema2.clean({})).toEqual({
obj: {

@@ -1004,6 +1004,6 @@ b: 1

});
(0, _expect["default"])(schema1.clean({})).toEqual({
(0, _expect.default)(schema1.clean({})).toEqual({
obj: {}
});
(0, _expect["default"])(schema2.clean({})).toEqual({
(0, _expect.default)(schema2.clean({})).toEqual({
obj: {

@@ -1010,0 +1010,0 @@ b: 1

@@ -6,11 +6,9 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _clone = _interopRequireDefault(require("clone"));
var _lodash = _interopRequireDefault(require("lodash.includes"));
var _utility = require("../utility");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -65,3 +63,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

if ((0, _lodash["default"])(this.doneKeys, affectedKey)) return;
if (this.doneKeys.includes(affectedKey)) return;
var fieldParentName = (0, _utility.getParentOfKey)(affectedKey, true);

@@ -131,3 +129,3 @@ var parentFieldInfo = getFieldInfo(mongoObject, fieldParentName.slice(0, -1));

mongoObject.removeValueForPosition(position);
mongoObject.setValueForPosition("".concat(op, "[").concat(affectedKey, "]"), (0, _clone["default"])(newValue));
mongoObject.setValueForPosition("".concat(op, "[").concat(affectedKey, "]"), (0, _clone.default)(newValue));
return;

@@ -139,3 +137,3 @@ }

mongoObject.setValueForPosition(position, (0, _clone["default"])(autoValue));
mongoObject.setValueForPosition(position, (0, _clone.default)(autoValue));
}

@@ -147,4 +145,4 @@ }]);

exports["default"] = AutoValueRunner;
exports.default = AutoValueRunner;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -58,3 +58,4 @@ var _SimpleSchema = require("../SimpleSchema");

// Convert exact string 'true' and 'false' to true and false respectively
if (value.toLowerCase() === 'true') return true;else if (value.toLowerCase() === 'false') return false;
if (value.toLowerCase() === 'true') return true;
if (value.toLowerCase() === 'false') return false;
} else if (typeof value === 'number' && !isNaN(value)) {

@@ -73,4 +74,4 @@ // NaN can be error, so skipping it

var _default = convertToProperType;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -13,25 +13,25 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('convert string `false` to boolean value false', function () {
(0, _expect["default"])((0, _convertToProperType["default"])('false', Boolean)).toBe(false);
(0, _expect.default)((0, _convertToProperType.default)('false', Boolean)).toBe(false);
});
it('convert string `FALSE` to boolean value false', function () {
(0, _expect["default"])((0, _convertToProperType["default"])('FALSE', Boolean)).toBe(false);
(0, _expect.default)((0, _convertToProperType.default)('FALSE', Boolean)).toBe(false);
});
it('convert string `true` to boolean value true', function () {
(0, _expect["default"])((0, _convertToProperType["default"])('true', Boolean)).toBe(true);
(0, _expect.default)((0, _convertToProperType.default)('true', Boolean)).toBe(true);
});
it('convert string `TRUE` to boolean value true', function () {
(0, _expect["default"])((0, _convertToProperType["default"])('TRUE', Boolean)).toBe(true);
(0, _expect.default)((0, _convertToProperType.default)('TRUE', Boolean)).toBe(true);
});
it('convert number 1 to boolean value true', function () {
(0, _expect["default"])((0, _convertToProperType["default"])(1, Boolean)).toBe(true);
(0, _expect.default)((0, _convertToProperType.default)(1, Boolean)).toBe(true);
});
it('convert number 0 to boolean value false', function () {
(0, _expect["default"])((0, _convertToProperType["default"])(0, Boolean)).toBe(false);
(0, _expect.default)((0, _convertToProperType.default)(0, Boolean)).toBe(false);
});
it('don\'t convert NaN to boolean value', function () {
(0, _expect["default"])((0, _convertToProperType["default"])(Number('text'), Boolean)).toEqual(NaN);
(0, _expect.default)((0, _convertToProperType.default)(Number('text'), Boolean)).toEqual(NaN);
});
it('does not try to convert null', function () {
(0, _expect["default"])((0, _convertToProperType["default"])(null, Array)).toBe(null);
(0, _expect.default)((0, _convertToProperType.default)(null, Array)).toBe(null);
});
});

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -22,3 +22,3 @@ /* eslint-disable func-names, prefer-arrow-callback */

var result = schema.clean({});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
name: 'Test'

@@ -38,3 +38,3 @@ });

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
name: 'Other'

@@ -53,3 +53,3 @@ });

var result = schema.clean({});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
names: []

@@ -70,3 +70,3 @@ });

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
names: ['foo', 'bar']

@@ -88,3 +88,3 @@ });

var result = schema.clean({});
(0, _expect["default"])(result).toEqual({});
(0, _expect.default)(result).toEqual({});
});

@@ -106,3 +106,3 @@ it('adds defaultValue for prop in object, if object is set in object being cleaned', function () {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
a: {

@@ -131,3 +131,3 @@ b: 'Test'

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
b: [{

@@ -160,3 +160,3 @@ a: 'Test'

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
b: [{

@@ -186,3 +186,3 @@ a: 'Other'

var result = schema.clean({});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
b: [{

@@ -209,3 +209,3 @@ a: 'Test'

var result = schema.clean({});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
a: {

@@ -233,3 +233,3 @@ b: 'Test'

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
a: {

@@ -264,3 +264,3 @@ b: 'Other'

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -302,3 +302,3 @@ obj: {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -339,3 +339,3 @@ 'obj.a': {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -352,3 +352,3 @@ 'obj.a': {}

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -367,3 +367,3 @@ 'obj.a': {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -409,3 +409,3 @@ 'obj.a': {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -458,3 +458,3 @@ 'obj.a': 100,

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -492,3 +492,3 @@ 'obj.a.one': 100

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$addToSet: {

@@ -520,3 +520,3 @@ names: 'new value'

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$push: {

@@ -557,3 +557,3 @@ things: {

});
(0, _expect["default"])(cleanedObject).toEqual({
(0, _expect.default)(cleanedObject).toEqual({
name: 'NAME',

@@ -582,3 +582,3 @@ details: {}

};
(0, _expect["default"])(schema.clean(doc)).toEqual({
(0, _expect.default)(schema.clean(doc)).toEqual({
name: 'Test',

@@ -618,3 +618,3 @@ images: []

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$set: {

@@ -635,3 +635,3 @@ 'items.$.foo': {

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
$addToSet: {

@@ -684,3 +684,3 @@ items: {

});
(0, _expect["default"])(schema.clean({
(0, _expect.default)(schema.clean({
$set: {

@@ -751,3 +751,3 @@ 'settings.obj.bool': true

});
(0, _expect["default"])(schema.clean({
(0, _expect.default)(schema.clean({
$set: {

@@ -813,3 +813,3 @@ 'settings.obj.bool': true

});
(0, _expect["default"])(cleanedModifier).toEqual({
(0, _expect.default)(cleanedModifier).toEqual({
$addToSet: {

@@ -835,3 +835,3 @@ 'profile.addressBook': {

});
(0, _expect["default"])(schema.clean({
(0, _expect.default)(schema.clean({
$set: {

@@ -856,3 +856,3 @@ name: 'Phil'

});
(0, _expect["default"])(schema.clean({
(0, _expect.default)(schema.clean({
$set: {

@@ -859,0 +859,0 @@ name: 'Phil'

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = getPositionsForAutoValue;
exports.default = getPositionsForAutoValue;

@@ -13,3 +13,3 @@ var _mongoObject = _interopRequireDefault(require("mongo-object"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -115,3 +115,3 @@ /**

positions.push({
key: _mongoObject["default"]._positionToKey(wouldBePosition),
key: _mongoObject.default._positionToKey(wouldBePosition),
value: undefined,

@@ -118,0 +118,0 @@ operator: operator ? '$set' : null,

@@ -7,3 +7,3 @@ "use strict";

exports.sortAutoValueFunctions = sortAutoValueFunctions;
exports["default"] = void 0;
exports.default = void 0;

@@ -14,3 +14,3 @@ var _getPositionsForAutoValue = _interopRequireDefault(require("./getPositionsForAutoValue"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -59,3 +59,3 @@ /**

closestSubschemaFieldName = _ref2.closestSubschemaFieldName;
var avRunner = new _AutoValueRunner["default"]({
var avRunner = new _AutoValueRunner.default({
closestSubschemaFieldName: closestSubschemaFieldName,

@@ -68,3 +68,3 @@ extendedAutoValueContext: extendedAutoValueContext,

});
var positions = (0, _getPositionsForAutoValue["default"])({
var positions = (0, _getPositionsForAutoValue.default)({
fieldName: fieldName,

@@ -81,2 +81,2 @@ isModifier: isModifier,

var _default = setAutoValues;
exports["default"] = _default;
exports.default = _default;

@@ -9,3 +9,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -72,9 +72,9 @@ describe('setAutoValues', function () {

for (var i = 0; i < FIELD_COUNT; ++i) {
(0, _expect["default"])(fieldOrder[i]).toBe("field".concat(i + 1));
(0, _expect.default)(fieldOrder[i]).toBe("field".concat(i + 1));
}
for (var _i = FIELD_COUNT; _i < FIELD_COUNT + NESTED_FIELD_COUNT; ++_i) {
(0, _expect["default"])(fieldOrder[_i]).toBe("nested.field".concat(_i - FIELD_COUNT + 1));
(0, _expect.default)(fieldOrder[_i]).toBe("nested.field".concat(_i - FIELD_COUNT + 1));
}
});
});

@@ -6,42 +6,40 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _regExp = _interopRequireDefault(require("./regExp"));
var _lodash = _interopRequireDefault(require("lodash.find"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var regExpMessages = [{
exp: _regExp["default"].Email,
exp: _regExp.default.Email,
msg: 'must be a valid email address'
}, {
exp: _regExp["default"].EmailWithTLD,
exp: _regExp.default.EmailWithTLD,
msg: 'must be a valid email address'
}, {
exp: _regExp["default"].Domain,
exp: _regExp.default.Domain,
msg: 'must be a valid domain'
}, {
exp: _regExp["default"].WeakDomain,
exp: _regExp.default.WeakDomain,
msg: 'must be a valid domain'
}, {
exp: _regExp["default"].IP,
exp: _regExp.default.IP,
msg: 'must be a valid IPv4 or IPv6 address'
}, {
exp: _regExp["default"].IPv4,
exp: _regExp.default.IPv4,
msg: 'must be a valid IPv4 address'
}, {
exp: _regExp["default"].IPv6,
exp: _regExp.default.IPv6,
msg: 'must be a valid IPv6 address'
}, {
exp: _regExp["default"].Url,
exp: _regExp.default.Url,
msg: 'must be a valid URL'
}, {
exp: _regExp["default"].Id,
exp: _regExp.default.Id,
msg: 'must be a valid alphanumeric ID'
}, {
exp: _regExp["default"].ZipCode,
exp: _regExp.default.ZipCode,
msg: 'must be a valid ZIP code'
}, {
exp: _regExp["default"].Phone,
exp: _regExp.default.Phone,
msg: 'must be a valid phone number'

@@ -75,3 +73,3 @@ }];

if (regExp) {
msgObj = (0, _lodash["default"])(regExpMessages, function (o) {
msgObj = regExpMessages.find(function (o) {
return o.exp && o.exp.toString() === regExp;

@@ -89,4 +87,4 @@ });

var _default = defaultMessages;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,14 +6,6 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _mongoObject = _interopRequireDefault(require("mongo-object"));
var _lodash = _interopRequireDefault(require("lodash.omit"));
var _lodash2 = _interopRequireDefault(require("lodash.isobject"));
var _lodash3 = _interopRequireDefault(require("lodash.union"));
var _lodash4 = _interopRequireDefault(require("lodash.includes"));
var _SimpleSchema = require("./SimpleSchema");

@@ -29,6 +21,16 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
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 _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; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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; }

@@ -40,2 +42,4 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function shouldCheck(key) {

@@ -58,3 +62,3 @@ if (key === '$pushAll') throw new Error('$pushAll is not supported; use $push + $each');

// First do some basic checks of the object, and throw errors if necessary
if (!(0, _lodash2["default"])(obj)) {
if (!obj || _typeof(obj) !== 'object' && typeof obj !== 'function') {
throw new Error('The first argument of validate() must be an object');

@@ -67,2 +71,13 @@ }

function getFieldInfo(key) {
// Create mongoObject if necessary, cache for speed
if (!mongoObject) mongoObject = new _mongoObject.default(obj, schema.blackboxKeys());
var keyInfo = mongoObject.getInfoForKey(key) || {};
return {
isSet: keyInfo.value !== undefined,
value: keyInfo.value,
operator: keyInfo.operator || null
};
}
var validationErrors = []; // Validation function called for each affected key

@@ -96,14 +111,2 @@

var fieldParentName = fieldParentNameWithEndDot.slice(0, -1);
function getFieldInfo(key) {
// Create mongoObject if necessary, cache for speed
if (!mongoObject) mongoObject = new _mongoObject["default"](obj, schema.blackboxKeys());
var keyInfo = mongoObject.getInfoForKey(key) || {};
return {
isSet: keyInfo.value !== undefined,
value: keyInfo.value,
operator: keyInfo.operator || null
};
}
var fieldValidationErrors = [];

@@ -141,3 +144,3 @@

var builtInValidators = [_requiredValidator["default"], _typeValidator["default"], _allowedValuesValidator["default"]];
var builtInValidators = [_requiredValidator.default, _typeValidator.default, _allowedValuesValidator.default];
var validators = builtInValidators.concat(schema._validators).concat(_SimpleSchema.SimpleSchema._validators); // Loop through each of the definitions in the SimpleSchemaGroup.

@@ -150,6 +153,9 @@ // If any return true, we're valid.

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

@@ -220,9 +226,34 @@ // validators but before the schema and global validators.

affectedKeyGeneric = _mongoObject["default"].makeKeyGeneric(affectedKey);
affectedKeyGeneric = _mongoObject.default.makeKeyGeneric(affectedKey);
var shouldValidateKey = !keysToValidate || keysToValidate.some(function (keyToValidate) {
return keyToValidate === affectedKey || keyToValidate === affectedKeyGeneric || affectedKey.startsWith("".concat(keyToValidate, ".")) || affectedKeyGeneric.startsWith("".concat(keyToValidate, "."));
}); // Perform validation for this key
}); // Prepare the context object for the rule functions
def = schema.getDefinition(affectedKey);
var fieldParentNameWithEndDot = (0, _utility.getParentOfKey)(affectedKey, true);
var fieldParentName = fieldParentNameWithEndDot.slice(0, -1);
var functionsContext = _objectSpread({
field: function field(fName) {
return getFieldInfo(fName);
},
genericKey: affectedKeyGeneric,
isInArrayItemObject: isInArrayItemObject,
isInSubObject: isInSubObject,
isModifier: isModifier,
isSet: val !== undefined,
key: affectedKey,
obj: obj,
operator: operator,
parentField: function parentField() {
return getFieldInfo(fieldParentName);
},
siblingField: function siblingField(fName) {
return getFieldInfo(fieldParentNameWithEndDot + fName);
},
value: val
}, extendedCustomContext || {}); // Perform validation for this key
def = schema.getDefinition(affectedKey, null, functionsContext);
if (shouldValidateKey) {

@@ -252,15 +283,21 @@ validate(val, affectedKey, affectedKeyGeneric, def, operator, isInArrayItemObject, isInSubObject);

});
} else if ((0, _utility.isObjectWeShouldTraverse)(val) && (!def || schema._blackboxKeys.indexOf(affectedKey) === -1)) {
} else if ((0, _utility.isObjectWeShouldTraverse)(val) && (!def || !schema._blackboxKeys.has(affectedKey))) {
// Loop through object keys
// Get list of present keys
var presentKeys = Object.keys(val); // Check all present keys plus all keys defined by the schema.
var presentKeys = Object.keys(val); // If this object is within an array, make sure we check for
// required as if it's not a modifier
isInArrayItemObject = affectedKeyGeneric && affectedKeyGeneric.slice(-2) === '.$';
var checkedKeys = []; // Check all present keys plus all keys defined by the schema.
// This allows us to detect extra keys not allowed by the schema plus
// any missing required keys, and to run any custom functions for other keys.
var keysToCheck = (0, _lodash3["default"])(presentKeys, childKeys); // If this object is within an array, make sure we check for
// required as if it's not a modifier
/* eslint-disable no-restricted-syntax */
isInArrayItemObject = affectedKeyGeneric && affectedKeyGeneric.slice(-2) === '.$'; // Check all keys in the merged list
keysToCheck.forEach(function (key) {
for (var _i = 0, _arr = [].concat(_toConsumableArray(presentKeys), _toConsumableArray(childKeys)); _i < _arr.length; _i++) {
var key = _arr[_i];
// `childKeys` and `presentKeys` may contain the same keys, so make
// sure we run only once per unique key
if (checkedKeys.indexOf(key) !== -1) continue;
checkedKeys.push(key);
checkObj({

@@ -273,3 +310,5 @@ val: val[key],

});
});
}
/* eslint-enable no-restricted-syntax */
}

@@ -293,3 +332,3 @@ }

schema.objectKeys().forEach(function (schemaKey) {
if (!(0, _lodash4["default"])(presentKeys, schemaKey)) {
if (!presentKeys.includes(schemaKey)) {
checkObj({

@@ -339,4 +378,15 @@ val: undefined,

var docValidatorContext = _objectSpread({
ignoreTypes: ignoreTypes,
isModifier: isModifier,
isUpsert: isUpsert,
keysToValidate: keysToValidate,
mongoObject: mongoObject,
obj: obj,
schema: schema,
validationContext: validationContext
}, extendedCustomContext || {});
docValidators.forEach(function (func) {
var errors = func(obj);
var errors = func.call(docValidatorContext, obj);
if (!Array.isArray(errors)) throw new Error('Custom doc validator must return an array of error objects');

@@ -348,5 +398,5 @@ if (errors.length) validationErrors = validationErrors.concat(errors);

// Remove error types the user doesn't care about
if ((0, _lodash4["default"])(ignoreTypes, errObj.type)) return false; // Make sure there is only one error per fieldName
if (ignoreTypes.includes(errObj.type)) return false; // Make sure there is only one error per fieldName
if ((0, _lodash4["default"])(addedFieldNames, errObj.name)) return false;
if (addedFieldNames.includes(errObj.name)) return false;
addedFieldNames.push(errObj.name);

@@ -359,4 +409,4 @@ return true;

var _default = doValidation;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,7 +6,7 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _mongoObject = _interopRequireDefault(require("mongo-object"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -27,3 +27,3 @@ 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; }

if (_mongoObject["default"].isBasicObject(definition)) {
if (_mongoObject.default.isBasicObject(definition)) {
schemaClone[key] = _objectSpread({}, definition);

@@ -82,4 +82,4 @@ return;

var _default = expandShorthand;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -13,3 +13,3 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('test 1', function () {
var result = (0, _expandShorthand["default"])({
var result = (0, _expandShorthand.default)({
name: String,

@@ -19,3 +19,3 @@ count: Number,

});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
name: {

@@ -34,7 +34,7 @@ type: String

it('test 2', function () {
var result = (0, _expandShorthand["default"])({
var result = (0, _expandShorthand.default)({
name: [String],
count: [Number]
});
(0, _expect["default"])(result).toEqual({
(0, _expect.default)(result).toEqual({
name: {

@@ -41,0 +41,0 @@ type: Array

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -56,4 +56,4 @@ /*

var _default = humanize;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;
"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _humanize = _interopRequireDefault(require("./humanize"));
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */
describe('humanize', function () {
it('works', function () {
(0, _expect["default"])((0, _humanize["default"])('super_snake_case')).toBe('Super snake case');
(0, _expect["default"])((0, _humanize["default"])('capitalizedCamelCase')).toBe('Capitalized camel case');
(0, _expect["default"])((0, _humanize["default"])('hyphen-case')).toBe('Hyphen case');
(0, _expect["default"])((0, _humanize["default"])('no-extensions-here.md')).toBe('No extensions here');
(0, _expect["default"])((0, _humanize["default"])('lower cased phrase')).toBe('Lower cased phrase');
(0, _expect["default"])((0, _humanize["default"])(' so many spaces ')).toBe('So many spaces');
(0, _expect["default"])((0, _humanize["default"])(123)).toBe('123');
(0, _expect["default"])((0, _humanize["default"])('')).toBe('');
(0, _expect["default"])((0, _humanize["default"])(null)).toBe('');
(0, _expect["default"])((0, _humanize["default"])(undefined)).toBe('');
(0, _expect["default"])((0, _humanize["default"])('externalSource')).toBe('External source');
(0, _expect["default"])((0, _humanize["default"])('externalSourceId')).toBe('External source ID');
(0, _expect["default"])((0, _humanize["default"])('externalSource_id')).toBe('External source ID');
(0, _expect["default"])((0, _humanize["default"])('_id')).toBe('ID'); // Make sure it does not mess with "id" in the middle of a word
(0, _expect.default)((0, _humanize.default)('super_snake_case')).toBe('Super snake case');
(0, _expect.default)((0, _humanize.default)('capitalizedCamelCase')).toBe('Capitalized camel case');
(0, _expect.default)((0, _humanize.default)('hyphen-case')).toBe('Hyphen case');
(0, _expect.default)((0, _humanize.default)('no-extensions-here.md')).toBe('No extensions here');
(0, _expect.default)((0, _humanize.default)('lower cased phrase')).toBe('Lower cased phrase');
(0, _expect.default)((0, _humanize.default)(' so many spaces ')).toBe('So many spaces');
(0, _expect.default)((0, _humanize.default)(123)).toBe('123');
(0, _expect.default)((0, _humanize.default)('')).toBe('');
(0, _expect.default)((0, _humanize.default)(null)).toBe('');
(0, _expect.default)((0, _humanize.default)(undefined)).toBe('');
(0, _expect.default)((0, _humanize.default)('externalSource')).toBe('External source');
(0, _expect.default)((0, _humanize.default)('externalSourceId')).toBe('External source ID');
(0, _expect.default)((0, _humanize.default)('externalSource_id')).toBe('External source ID');
(0, _expect.default)((0, _humanize.default)('_id')).toBe('ID'); // Make sure it does not mess with "id" in the middle of a word
(0, _expect["default"])((0, _humanize["default"])('overridden')).toBe('Overridden');
(0, _expect.default)((0, _humanize.default)('overridden')).toBe('Overridden');
});
});

@@ -6,12 +6,12 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _SimpleSchema = require("./SimpleSchema");
require("./clean.js");
require("./clean");
_SimpleSchema.SimpleSchema.ValidationContext = _SimpleSchema.ValidationContext;
var _default = _SimpleSchema.SimpleSchema;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
// this domain regex matches all domains that have at least one .

@@ -55,4 +55,4 @@ // sadly IPv4 Adresses will be caught too but technically those are valid domains

var _default = regEx;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;
"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
var _friendsSchema = _interopRequireDefault(require("./testHelpers/friendsSchema"));

@@ -15,3 +15,3 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -22,13 +22,13 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('valid string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedStrings: 'tuna'
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedStringsArray: ['tuna', 'fish', 'salad']
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedStringsSet: ['tuna', 'fish', 'salad']
}).toEqual(0); // Array of objects
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
friends: [{

@@ -42,15 +42,15 @@ name: 'Bob',

it('invalid string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedStrings: 'tunas'
}).toEqual(1); // Array
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedStringsArray: ['tuna', 'fish', 'sandwich']
}).toEqual(1); // Set Or Array
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedStringsSet: ['tuna', 'fish', 'sandwich']
}).toEqual(1); // Array of objects
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
friends: [{

@@ -64,13 +64,13 @@ name: 'Bob',

it('valid number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedNumbers: 1
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedNumbersArray: [1, 2, 3]
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedNumbersSet: [1, 2, 3]
}).toEqual(0); // Array of objects
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
friends: [{

@@ -87,15 +87,15 @@ name: 'Bob',

it('invalid number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedNumbers: 4
}).toEqual(1); // Array
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedNumbersArray: [1, 2, 3, 4]
}).toEqual(1); // Set or Array
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
allowedNumbersSet: [1, 2, 3, 4]
}).toEqual(1); // Array of objects
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
friends: [{

@@ -114,3 +114,3 @@ name: 'Bob',

it('valid string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -124,3 +124,3 @@ allowedStrings: 'tuna'

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -134,3 +134,3 @@ allowedStringsArray: ['tuna', 'fish', 'salad']

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -144,3 +144,3 @@ allowedStringsSet: ['tuna', 'fish', 'salad']

(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$setOnInsert: {

@@ -159,3 +159,3 @@ friends: [{

it('invalid string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -169,3 +169,3 @@ allowedStrings: 'tunas'

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -179,3 +179,3 @@ allowedStringsArray: ['tuna', 'fish', 'sandwich']

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -189,3 +189,3 @@ allowedStringsSet: ['tuna', 'fish', 'sandwich']

(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$setOnInsert: {

@@ -204,3 +204,3 @@ friends: [{

it('valid number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -214,3 +214,3 @@ allowedNumbers: 1

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -224,3 +224,3 @@ allowedNumbersArray: [1, 2, 3]

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -234,3 +234,3 @@ allowedNumbersSet: [1, 2, 3]

(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$setOnInsert: {

@@ -252,3 +252,3 @@ friends: [{

it('invalid number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -262,3 +262,3 @@ allowedNumbers: 4

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -272,3 +272,3 @@ allowedNumbersArray: [1, 2, 3, 4]

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -282,3 +282,3 @@ allowedNumbersSet: [1, 2, 3, 4]

(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$setOnInsert: {

@@ -302,3 +302,3 @@ friends: [{

it('valid string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -311,3 +311,3 @@ allowedStrings: 'tuna'

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -320,3 +320,3 @@ allowedStringsArray: ['tuna', 'fish', 'salad']

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -329,3 +329,3 @@ allowedStringsSet: ['tuna', 'fish', 'salad']

(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -337,3 +337,3 @@ 'friends.$.name': 'Bob'

}).toEqual(0);
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -347,3 +347,3 @@ 'friends.1.name': 'Bob'

it('invalid string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -356,3 +356,3 @@ allowedStrings: 'tunas'

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -365,3 +365,3 @@ allowedStringsArray: ['tuna', 'fish', 'sandwich']

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -374,3 +374,3 @@ allowedStringsSet: ['tuna', 'fish', 'sandwich']

(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -382,3 +382,3 @@ 'friends.$.name': 'Bobby'

}).toEqual(1);
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -392,3 +392,3 @@ 'friends.1.name': 'Bobby'

it('valid number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -400,3 +400,3 @@ allowedNumbers: 1

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -408,3 +408,3 @@ allowedNumbersArray: [1, 2, 3]

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -418,3 +418,3 @@ allowedNumbersSet: [1, 2, 3]

it('invalid number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -426,3 +426,3 @@ allowedNumbers: 4

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -434,3 +434,3 @@ allowedNumbersArray: [1, 2, 3, 4]

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -454,3 +454,3 @@ allowedNumbersSet: [1, 2, 3, 4]

});
(0, _expect["default"])(schema.getAllowedValuesForKey('foo')).toEqual(allowedValues);
(0, _expect.default)(schema.getAllowedValuesForKey('foo')).toEqual(allowedValues);
});

@@ -467,5 +467,5 @@ it('works with set, convert to array', function () {

var fetchedAllowedValues = schema.getAllowedValuesForKey('foo');
(0, _expect["default"])(fetchedAllowedValues).toInclude('a');
(0, _expect["default"])(fetchedAllowedValues).toInclude('b');
(0, _expect["default"])(fetchedAllowedValues.length).toEqual(2);
(0, _expect.default)(fetchedAllowedValues).toInclude('a');
(0, _expect.default)(fetchedAllowedValues).toInclude('b');
(0, _expect.default)(fetchedAllowedValues.length).toEqual(2);
});

@@ -479,5 +479,5 @@ it('returns null when allowedValues key is empty', function () {

});
(0, _expect["default"])(schema.getAllowedValuesForKey('foo')).toEqual(null);
(0, _expect.default)(schema.getAllowedValuesForKey('foo')).toEqual(null);
});
});
});

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,6 +20,6 @@ /* eslint-disable func-names, prefer-arrow-callback */

var autoValueFunctions = schema.autoValueFunctions();
(0, _expect["default"])(autoValueFunctions.length).toBe(1);
(0, _expect["default"])(!!autoValueFunctions[0].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect["default"])(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect.default)(autoValueFunctions.length).toBe(1);
(0, _expect.default)(!!autoValueFunctions[0].func).toBe(true);
(0, _expect.default)(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect.default)(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
});

@@ -47,12 +47,12 @@ it('one level of subschema', function () {

var autoValueFunctions = schema.autoValueFunctions();
(0, _expect["default"])(autoValueFunctions.length).toBe(3);
(0, _expect["default"])(!!autoValueFunctions[0].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect["default"])(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect["default"])(!!autoValueFunctions[1].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[1].fieldName).toBe('a.b');
(0, _expect["default"])(autoValueFunctions[1].closestSubschemaFieldName).toBe('');
(0, _expect["default"])(!!autoValueFunctions[2].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[2].fieldName).toBe('c.z');
(0, _expect["default"])(autoValueFunctions[2].closestSubschemaFieldName).toBe('c');
(0, _expect.default)(autoValueFunctions.length).toBe(3);
(0, _expect.default)(!!autoValueFunctions[0].func).toBe(true);
(0, _expect.default)(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect.default)(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect.default)(!!autoValueFunctions[1].func).toBe(true);
(0, _expect.default)(autoValueFunctions[1].fieldName).toBe('a.b');
(0, _expect.default)(autoValueFunctions[1].closestSubschemaFieldName).toBe('');
(0, _expect.default)(!!autoValueFunctions[2].func).toBe(true);
(0, _expect.default)(autoValueFunctions[2].fieldName).toBe('c.z');
(0, _expect.default)(autoValueFunctions[2].closestSubschemaFieldName).toBe('c');
});

@@ -96,18 +96,18 @@ it('two levels of subschemas', function () {

var autoValueFunctions = schema.autoValueFunctions();
(0, _expect["default"])(autoValueFunctions.length).toBe(5);
(0, _expect["default"])(!!autoValueFunctions[0].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect["default"])(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect["default"])(!!autoValueFunctions[1].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[1].fieldName).toBe('a.b');
(0, _expect["default"])(autoValueFunctions[1].closestSubschemaFieldName).toBe('');
(0, _expect["default"])(!!autoValueFunctions[2].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[2].fieldName).toBe('c.z');
(0, _expect["default"])(autoValueFunctions[2].closestSubschemaFieldName).toBe('c');
(0, _expect["default"])(!!autoValueFunctions[3].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[3].fieldName).toBe('c.z.y.x');
(0, _expect["default"])(autoValueFunctions[3].closestSubschemaFieldName).toBe('c.z.y');
(0, _expect["default"])(!!autoValueFunctions[4].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[4].fieldName).toBe('c.z.y.x.m');
(0, _expect["default"])(autoValueFunctions[4].closestSubschemaFieldName).toBe('c.z.y');
(0, _expect.default)(autoValueFunctions.length).toBe(5);
(0, _expect.default)(!!autoValueFunctions[0].func).toBe(true);
(0, _expect.default)(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect.default)(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect.default)(!!autoValueFunctions[1].func).toBe(true);
(0, _expect.default)(autoValueFunctions[1].fieldName).toBe('a.b');
(0, _expect.default)(autoValueFunctions[1].closestSubschemaFieldName).toBe('');
(0, _expect.default)(!!autoValueFunctions[2].func).toBe(true);
(0, _expect.default)(autoValueFunctions[2].fieldName).toBe('c.z');
(0, _expect.default)(autoValueFunctions[2].closestSubschemaFieldName).toBe('c');
(0, _expect.default)(!!autoValueFunctions[3].func).toBe(true);
(0, _expect.default)(autoValueFunctions[3].fieldName).toBe('c.z.y.x');
(0, _expect.default)(autoValueFunctions[3].closestSubschemaFieldName).toBe('c.z.y');
(0, _expect.default)(!!autoValueFunctions[4].func).toBe(true);
(0, _expect.default)(autoValueFunctions[4].fieldName).toBe('c.z.y.x.m');
(0, _expect.default)(autoValueFunctions[4].closestSubschemaFieldName).toBe('c.z.y');
});

@@ -134,10 +134,10 @@ it('array of objects', function () {

var autoValueFunctions = schema.autoValueFunctions();
(0, _expect["default"])(autoValueFunctions.length).toBe(2);
(0, _expect["default"])(!!autoValueFunctions[0].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect["default"])(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect["default"])(!!autoValueFunctions[1].func).toBe(true);
(0, _expect["default"])(autoValueFunctions[1].fieldName).toBe('a.b.$.z');
(0, _expect["default"])(autoValueFunctions[1].closestSubschemaFieldName).toBe('a.b.$');
(0, _expect.default)(autoValueFunctions.length).toBe(2);
(0, _expect.default)(!!autoValueFunctions[0].func).toBe(true);
(0, _expect.default)(autoValueFunctions[0].fieldName).toBe('a');
(0, _expect.default)(autoValueFunctions[0].closestSubschemaFieldName).toBe('');
(0, _expect.default)(!!autoValueFunctions[1].func).toBe(true);
(0, _expect.default)(autoValueFunctions[1].fieldName).toBe('a.b.$.z');
(0, _expect.default)(autoValueFunctions[1].closestSubschemaFieldName).toBe('a.b.$');
});
});

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,3 +20,3 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('allows an empty object', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
blackBoxObject: {}

@@ -26,3 +26,3 @@ }).toEqual(0);

it('allows any properties', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
blackBoxObject: {

@@ -34,3 +34,3 @@ foo: 'bar'

it('allows any properties on $set object', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
$set: {

@@ -46,3 +46,3 @@ blackBoxObject: {

it('allows to $set any subobject', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
$set: {

@@ -54,3 +54,3 @@ 'blackBoxObject.foo': 'bar'

}).toEqual(0);
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
$set: {

@@ -64,3 +64,3 @@ 'blackBoxObject.1': 'bar'

it('allows to $push into any subobject', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
$push: {

@@ -67,0 +67,0 @@ 'blackBoxObject.foo': 'bar'

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");

@@ -9,6 +11,4 @@

var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -53,3 +53,3 @@ var schema = new _SimpleSchema.SimpleSchema({

it('valid', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
password: 'password',

@@ -60,3 +60,3 @@ confirmPassword: 'password'

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])('passwordMismatch', schema, {
(0, _expectErrorOfTypeLength.default)('passwordMismatch', schema, {
password: 'password',

@@ -69,3 +69,3 @@ confirmPassword: 'password1'

it('valid', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
$setOnInsert: {

@@ -81,3 +81,3 @@ password: 'password',

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])('passwordMismatch', schema, {
(0, _expectErrorOfTypeLength.default)('passwordMismatch', schema, {
$setOnInsert: {

@@ -95,3 +95,3 @@ password: 'password',

it('valid', function () {
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
$set: {

@@ -106,3 +106,3 @@ password: 'password',

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])('passwordMismatch', schema, {
(0, _expectErrorOfTypeLength.default)('passwordMismatch', schema, {
$set: {

@@ -131,3 +131,3 @@ password: 'password',

customSchema.namedContext().validate({});
(0, _expect["default"])(ok).toBe(true);
(0, _expect.default)(ok).toBe(true);
});

@@ -146,4 +146,4 @@ it('custom validation runs even when the optional field is undefined', function () {

context.validate({});
(0, _expect["default"])(context.validationErrors().length).toEqual(1);
(0, _expect["default"])(context.validationErrors()[0]).toEqual({
(0, _expect.default)(context.validationErrors().length).toEqual(1);
(0, _expect.default)(context.validationErrors()[0]).toEqual({
name: 'foo',

@@ -172,4 +172,4 @@ type: 'custom',

});
(0, _expect["default"])(context.validationErrors().length).toEqual(1);
(0, _expect["default"])(context.validationErrors()[0]).toEqual({
(0, _expect.default)(context.validationErrors().length).toEqual(1);
(0, _expect.default)(context.validationErrors()[0]).toEqual({
name: 'foo',

@@ -182,3 +182,3 @@ type: 'custom',

var context = requiredCustomSchema.namedContext();
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$set: {

@@ -190,3 +190,3 @@ a: [{}]

})).toEqual(true);
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$set: {

@@ -201,3 +201,3 @@ 'a.0': {}

var context = requiredCustomSchema.namedContext();
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$push: {

@@ -204,0 +204,0 @@ a: {}

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */
describe('SimpleSchema - Extend Schema Definition', function () {
it('throws an error when the schema definition includes an unrecognized key', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
var schema = new _SimpleSchema.SimpleSchema({

@@ -27,3 +27,3 @@ // eslint-disable-line no-unused-vars

(0, _expect["default"])(function () {
(0, _expect.default)(function () {
var schema = new _SimpleSchema.SimpleSchema({

@@ -30,0 +30,0 @@ // eslint-disable-line no-unused-vars

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -28,3 +28,3 @@ describe('SimpleSchema', function () {

var newSchema = schema.getObjectSchema('foo');
(0, _expect["default"])(newSchema.mergedSchema()).toEqual({
(0, _expect.default)(newSchema.mergedSchema()).toEqual({
aaa: {

@@ -63,3 +63,3 @@ type: _SimpleSchema.SimpleSchema.oneOf(String),

var newSchema = schema.getObjectSchema('foo.bbb');
(0, _expect["default"])(newSchema.mergedSchema()).toEqual({
(0, _expect.default)(newSchema.mergedSchema()).toEqual({
zzz: {

@@ -91,3 +91,3 @@ type: _SimpleSchema.SimpleSchema.oneOf(Number),

var newSchema = schema.getObjectSchema('foo.aaa.$');
(0, _expect["default"])(newSchema.mergedSchema()).toEqual({
(0, _expect.default)(newSchema.mergedSchema()).toEqual({
zzz: {

@@ -122,3 +122,3 @@ type: _SimpleSchema.SimpleSchema.oneOf(String),

var newSchema = schema.getObjectSchema('foo');
(0, _expect["default"])(newSchema.mergedSchema()).toEqual({
(0, _expect.default)(newSchema.mergedSchema()).toEqual({
aaa: {

@@ -125,0 +125,0 @@ type: _SimpleSchema.SimpleSchema.oneOf(String),

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -17,3 +17,3 @@ describe('SimpleSchema', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('string');
(0, _expect.default)(type).toBe('string');
});

@@ -25,3 +25,3 @@ it('number', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('number');
(0, _expect.default)(type).toBe('number');
});

@@ -33,3 +33,3 @@ it('int', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('number');
(0, _expect.default)(type).toBe('number');
});

@@ -41,3 +41,3 @@ it('boolean', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('boolean');
(0, _expect.default)(type).toBe('boolean');
});

@@ -49,3 +49,3 @@ it('date', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('date');
(0, _expect.default)(type).toBe('date');
});

@@ -57,3 +57,3 @@ it('object', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('object');
(0, _expect.default)(type).toBe('object');
});

@@ -65,3 +65,3 @@ it('stringArray', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('stringArray');
(0, _expect.default)(type).toBe('stringArray');
});

@@ -73,3 +73,3 @@ it('numberArray', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('numberArray');
(0, _expect.default)(type).toBe('numberArray');
});

@@ -81,3 +81,3 @@ it('int array', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('numberArray');
(0, _expect.default)(type).toBe('numberArray');
});

@@ -89,3 +89,3 @@ it('booleanArray', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('booleanArray');
(0, _expect.default)(type).toBe('booleanArray');
});

@@ -97,3 +97,3 @@ it('dateArray', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('dateArray');
(0, _expect.default)(type).toBe('dateArray');
});

@@ -105,3 +105,3 @@ it('objectArray', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('objectArray');
(0, _expect.default)(type).toBe('objectArray');
});

@@ -116,5 +116,5 @@ it('objectArray (subschema)', function () {

var type = schema.getQuickTypeForKey('foo');
(0, _expect["default"])(type).toBe('objectArray');
(0, _expect.default)(type).toBe('objectArray');
});
});
});
"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -23,4 +23,4 @@ describe('SimpleSchema - label', function () {

});
(0, _expect["default"])(schema.label('minMaxNumber')).toEqual('Min max number');
(0, _expect["default"])(schema.label('obj.someString')).toEqual('Some string');
(0, _expect.default)(schema.label('minMaxNumber')).toEqual('Min max number');
(0, _expect.default)(schema.label('obj.someString')).toEqual('Some string');
});

@@ -39,7 +39,7 @@ it('dynamic', function () {

});
(0, _expect["default"])(schema.label('obj.someString')).toEqual('Some string');
(0, _expect.default)(schema.label('obj.someString')).toEqual('Some string');
schema.labels({
'obj.someString': 'A different label'
});
(0, _expect["default"])(schema.label('obj.someString')).toEqual('A different label');
(0, _expect.default)(schema.label('obj.someString')).toEqual('A different label');
});

@@ -58,3 +58,3 @@ it('callback', function () {

});
(0, _expect["default"])(schema.label('obj.someString')).toEqual('Some string');
(0, _expect.default)(schema.label('obj.someString')).toEqual('Some string');
schema.labels({

@@ -65,3 +65,3 @@ 'obj.someString': function objSomeString() {

});
(0, _expect["default"])(schema.label('obj.someString')).toEqual('A callback label');
(0, _expect.default)(schema.label('obj.someString')).toEqual('A callback label');
});

@@ -75,4 +75,4 @@ it('should allow apostrophes ("\'") in labels', function () {

});
(0, _expect["default"])(schema.label('foo')).toEqual('Manager/supervisor\'s name');
(0, _expect.default)(schema.label('foo')).toEqual('Manager/supervisor\'s name');
});
});

@@ -13,3 +13,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,15 +20,15 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxString: 'nottoolongnottoolong'
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxString: 'toolongtoolongtoolong'
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxStringArray: ['nottoolongnottoolong', 'nottoolongnottoolong']
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxStringArray: ['toolongtoolongtoolong', 'toolongtoolongtoolong']
}).toEqual(2);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxStringArray: ['nottoolongnottoolong', 'nottoolongnottoolong', 'nottoolongnottoolong']

@@ -38,12 +38,12 @@ }).toEqual(1);

it('number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumber: 20
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumber: 21
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberCalculated: 20
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberCalculated: 21

@@ -53,12 +53,12 @@ }).toEqual(1);

it('date', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDate: new Date(Date.UTC(2013, 11, 31))
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDate: new Date(Date.UTC(2014, 0, 1))
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDateCalculated: new Date(Date.UTC(2013, 11, 31))
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDateCalculated: new Date(Date.UTC(2014, 0, 1))

@@ -70,3 +70,3 @@ }).toEqual(1);

it('string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -79,3 +79,3 @@ minMaxString: 'nottoolongnottoolong'

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -88,3 +88,3 @@ minMaxString: 'toolongtoolongtoolong'

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -97,3 +97,3 @@ minMaxStringArray: ['nottoolongnottoolong', 'nottoolongnottoolong']

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -106,3 +106,3 @@ minMaxStringArray: ['toolongtoolongtoolong', 'toolongtoolongtoolong']

}).toEqual(2);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -117,3 +117,3 @@ minMaxStringArray: ['nottoolongnottoolong', 'nottoolongnottoolong', 'nottoolongnottoolong']

it('number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -126,3 +126,3 @@ minMaxNumber: 20

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -135,3 +135,3 @@ minMaxNumber: 21

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -144,3 +144,3 @@ minMaxNumberCalculated: 20

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -155,3 +155,3 @@ minMaxNumberCalculated: 21

it('date', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -164,3 +164,3 @@ minMaxDate: new Date(Date.UTC(2013, 11, 31))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -173,3 +173,3 @@ minMaxDate: new Date(Date.UTC(2014, 0, 1))

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -182,3 +182,3 @@ minMaxDateCalculated: new Date(Date.UTC(2013, 11, 31))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -195,3 +195,3 @@ minMaxDateCalculated: new Date(Date.UTC(2014, 0, 1))

it('string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -203,3 +203,3 @@ minMaxString: 'nottoolongnottoolong'

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -211,3 +211,3 @@ minMaxString: 'toolongtoolongtoolong'

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -219,3 +219,3 @@ minMaxStringArray: ['nottoolongnottoolong', 'nottoolongnottoolong']

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -227,3 +227,3 @@ minMaxStringArray: ['toolongtoolongtoolong', 'toolongtoolongtoolong']

}).toEqual(2);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -237,3 +237,3 @@ minMaxStringArray: ['nottoolongnottoolong', 'nottoolongnottoolong', 'nottoolongnottoolong']

it('number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -245,3 +245,3 @@ minMaxNumber: 20

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -253,3 +253,3 @@ minMaxNumber: 21

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -261,3 +261,3 @@ minMaxNumberCalculated: 20

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -269,3 +269,3 @@ minMaxNumberCalculated: 21

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -278,3 +278,3 @@ maxZero: 1

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$inc: {

@@ -288,3 +288,3 @@ maxZero: 5

it('date', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -296,3 +296,3 @@ minMaxDate: new Date(Date.UTC(2013, 11, 31))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -304,3 +304,3 @@ minMaxDate: new Date(Date.UTC(2014, 0, 1))

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -312,3 +312,3 @@ minMaxDateCalculated: new Date(Date.UTC(2013, 11, 31))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -324,3 +324,3 @@ minMaxDateCalculated: new Date(Date.UTC(2014, 0, 1))

it('valid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$push: {

@@ -337,3 +337,3 @@ friends: {

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$push: {

@@ -352,3 +352,3 @@ friends: {

it('valid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$push: {

@@ -370,3 +370,3 @@ friends: {

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$push: {

@@ -390,3 +390,3 @@ friends: {

it('valid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$addToSet: {

@@ -403,3 +403,3 @@ friends: {

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$addToSet: {

@@ -418,3 +418,3 @@ friends: {

it('valid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$addToSet: {

@@ -436,3 +436,3 @@ friends: {

it('invalid', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.MAX_STRING, _friendsSchema.default, {
$addToSet: {

@@ -439,0 +439,0 @@ friends: {

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -18,3 +18,3 @@ describe('SimpleSchema', function () {

context.validate({});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo is required');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo is required');
});

@@ -32,3 +32,3 @@ it('minString', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be at least 2 characters');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be at least 2 characters');
});

@@ -46,3 +46,3 @@ it('maxString', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo cannot exceed 2 characters');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo cannot exceed 2 characters');
});

@@ -60,3 +60,3 @@ it('minNumber', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be at least 2');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be at least 2');
});

@@ -74,3 +74,3 @@ it('maxNumber', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo cannot exceed 2');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo cannot exceed 2');
});

@@ -89,3 +89,3 @@ it('minNumberExclusive', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be greater than 2');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be greater than 2');
});

@@ -104,3 +104,3 @@ it('maxNumberExclusive', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be less than 2');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be less than 2');
});

@@ -118,3 +118,3 @@ it('minDate', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be on or after 2015-12-15');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be on or after 2015-12-15');
});

@@ -132,3 +132,3 @@ it('maxDate', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo cannot be after 2015-12-15');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo cannot be after 2015-12-15');
});

@@ -145,3 +145,3 @@ it('badDate', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo is not a valid date');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo is not a valid date');
});

@@ -160,3 +160,3 @@ it('minCount', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('You must specify at least 2 values');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('You must specify at least 2 values');
});

@@ -175,3 +175,3 @@ it('maxCount', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('You cannot specify more than 2 values');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('You cannot specify more than 2 values');
});

@@ -186,3 +186,3 @@ it('noDecimal', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be an integer');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be an integer');
});

@@ -200,3 +200,3 @@ it('notAllowed', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('d is not an allowed value');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('d is not an allowed value');
});

@@ -211,3 +211,3 @@ it('expectedType', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be of type String');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be of type String');
});

@@ -225,3 +225,3 @@ it('regEx built in', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo must be a valid email address');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo must be a valid email address');
});

@@ -239,3 +239,3 @@ it('regEx other', function () {

});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Foo failed regular expression validation');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Foo failed regular expression validation');
});

@@ -251,3 +251,3 @@ describe('keyNotInSchema', function () {

});
(0, _expect["default"])(context.keyErrorMessage('bar')).toBe('bar is not allowed by the schema');
(0, _expect.default)(context.keyErrorMessage('bar')).toBe('bar is not allowed by the schema');
});

@@ -263,3 +263,3 @@ it('$set', function () {

});
(0, _expect["default"])(context.keyErrorMessage('bar')).toBe('bar is not allowed by the schema');
(0, _expect.default)(context.keyErrorMessage('bar')).toBe('bar is not allowed by the schema');
});

@@ -275,3 +275,3 @@ it('$unset does not complain', function () {

});
(0, _expect["default"])(context.isValid()).toBe(true);
(0, _expect.default)(context.isValid()).toBe(true);
});

@@ -288,3 +288,3 @@ });

context.validate({});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Manager/supervisor\'s name is required');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Manager/supervisor\'s name is required');
});

@@ -317,5 +317,5 @@ });

context.validate({});
(0, _expect["default"])(context.keyErrorMessage('foo')).toBe('Your foo is required mate');
(0, _expect.default)(context.keyErrorMessage('foo')).toBe('Your foo is required mate');
});
});
});

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -14,18 +14,18 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxString: 'longenough'
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxString: 'short'
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxString: ''
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxStringArray: ['longenough', 'longenough']
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxStringArray: ['longenough', 'short']
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxStringArray: ['short', 'short']

@@ -35,27 +35,27 @@ }).toEqual(2);

it('number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberExclusive: 20
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberExclusive: 10
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberInclusive: 20
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberInclusive: 10
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumber: 10
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumber: 9
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberCalculated: 10
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxNumberCalculated: 9
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minZero: -1

@@ -65,12 +65,12 @@ }).toEqual(1);

it('date', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDate: new Date(Date.UTC(2013, 0, 1))
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDate: new Date(Date.UTC(2012, 11, 31))
}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDateCalculated: new Date(Date.UTC(2013, 0, 1))
}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
minMaxDateCalculated: new Date(Date.UTC(2012, 11, 31))

@@ -82,3 +82,3 @@ }).toEqual(1);

it('string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -91,3 +91,3 @@ minMaxString: 'longenough'

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -100,3 +100,3 @@ minMaxString: 'short'

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -109,3 +109,3 @@ minMaxStringArray: ['longenough', 'longenough']

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -118,3 +118,3 @@ minMaxStringArray: ['longenough', 'short']

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -129,3 +129,3 @@ minMaxStringArray: ['short', 'short']

it('number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -138,3 +138,3 @@ minMaxNumber: 10

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -147,3 +147,3 @@ minMaxNumber: 9

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -156,3 +156,3 @@ minMaxNumberCalculated: 10

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -165,3 +165,3 @@ minMaxNumberCalculated: 9

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -176,3 +176,3 @@ minZero: -1

it('date', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -185,3 +185,3 @@ minMaxDate: new Date(Date.UTC(2013, 0, 1))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -194,3 +194,3 @@ minMaxDate: new Date(Date.UTC(2012, 11, 31))

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -203,3 +203,3 @@ minMaxDateCalculated: new Date(Date.UTC(2013, 0, 1))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$setOnInsert: {

@@ -216,3 +216,3 @@ minMaxDateCalculated: new Date(Date.UTC(2012, 11, 31))

it('string', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -224,3 +224,3 @@ minMaxString: 'longenough'

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -232,3 +232,3 @@ minMaxString: 'short'

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -240,3 +240,3 @@ minMaxStringArray: ['longenough', 'longenough']

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -248,3 +248,3 @@ minMaxStringArray: ['longenough', 'short']

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -258,3 +258,3 @@ minMaxStringArray: ['short', 'short']

it('number', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -266,3 +266,3 @@ minMaxNumber: 10

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -274,3 +274,3 @@ minMaxNumber: 9

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -282,3 +282,3 @@ minMaxNumberCalculated: 10

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -290,3 +290,3 @@ minMaxNumberCalculated: 9

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -299,3 +299,3 @@ minZero: -1

(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$inc: {

@@ -309,3 +309,3 @@ minZero: -5

it('date', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -317,3 +317,3 @@ minMaxDate: new Date(Date.UTC(2013, 0, 1))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -325,3 +325,3 @@ minMaxDate: new Date(Date.UTC(2012, 11, 31))

}).toEqual(1);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -333,3 +333,3 @@ minMaxDateCalculated: new Date(Date.UTC(2013, 0, 1))

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$set: {

@@ -336,0 +336,0 @@ minMaxDateCalculated: new Date(Date.UTC(2012, 11, 31))

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -13,7 +13,7 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('ensures array count is at least the minimum', function () {
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
friends: [],
enemies: []
}).toEqual(1);
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -25,3 +25,3 @@ friends: []

}).toEqual(1);
(0, _expectErrorLength["default"])(_friendsSchema["default"], {
(0, _expectErrorLength.default)(_friendsSchema.default, {
$setOnInsert: {

@@ -28,0 +28,0 @@ friends: [],

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -30,10 +30,10 @@ describe('SimpleSchema', function () {

var newSchema = schema.omit('foo');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual(['fooArray', 'fooArray.$', 'fooArray.$.bar']);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual(['fooArray', 'fooArray.$', 'fooArray.$.bar']);
newSchema = schema.omit('fooArray');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar']);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar']);
newSchema = schema.omit('foo', 'fooArray');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual([]);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual([]);
newSchema = schema.omit('blah');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar', 'fooArray', 'fooArray.$', 'fooArray.$.bar']);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar', 'fooArray', 'fooArray.$', 'fooArray.$.bar']);
});
});
"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -19,27 +19,27 @@ describe('SimpleSchema', function () {

};
(0, _expect["default"])(function test1func() {
(0, _expect.default)(function test1func() {
schema.validate(test1);
}).toNotThrow();
(0, _expect["default"])(test1.foo).toBeA('number');
(0, _expect.default)(test1.foo).toBeA('number');
var test2 = {
foo: 'bar'
};
(0, _expect["default"])(function test2func() {
(0, _expect.default)(function test2func() {
schema.validate(test2);
}).toNotThrow();
(0, _expect["default"])(test2.foo).toBeA('string');
(0, _expect.default)(test2.foo).toBeA('string');
var test3 = {
foo: new Date()
};
(0, _expect["default"])(function test2func() {
(0, _expect.default)(function test2func() {
schema.validate(test3);
}).toNotThrow();
(0, _expect["default"])(test3.foo instanceof Date).toBe(true);
(0, _expect.default)(test3.foo instanceof Date).toBe(true);
var test4 = {
foo: false
};
(0, _expect["default"])(function test3func() {
(0, _expect.default)(function test3func() {
schema.validate(test4);
}).toThrow();
(0, _expect["default"])(test4.foo).toBeA('boolean');
(0, _expect.default)(test4.foo).toBeA('boolean');
});

@@ -62,3 +62,3 @@ it.skip('allows either type including schemas', function () {

console.log(combinedSchema.namedContext().validationErrors());
(0, _expect["default"])(isValid).toBe(true);
(0, _expect.default)(isValid).toBe(true);
isValid = combinedSchema.namedContext().validate({

@@ -71,3 +71,3 @@ item: {

console.log(combinedSchema.namedContext().validationErrors());
(0, _expect["default"])(isValid).toBe(true);
(0, _expect.default)(isValid).toBe(true);
isValid = combinedSchema.namedContext().validate({

@@ -80,3 +80,3 @@ item: {

console.log(combinedSchema.namedContext().validationErrors());
(0, _expect["default"])(isValid).toBe(true);
(0, _expect.default)(isValid).toBe(true);
});

@@ -93,3 +93,3 @@ it('is valid as long as one min value is met', function () {

});
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
schema.validate({

@@ -110,3 +110,3 @@ foo: 7

});
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
schema.validate({

@@ -113,0 +113,0 @@ foo: 3

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -30,9 +30,9 @@ describe('SimpleSchema', function () {

var newSchema = schema.pick('foo');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar']);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar']);
newSchema = schema.pick('fooArray');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual(['fooArray', 'fooArray.$', 'fooArray.$.bar']);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual(['fooArray', 'fooArray.$', 'fooArray.$.bar']);
newSchema = schema.pick('foo', 'fooArray');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar', 'fooArray', 'fooArray.$', 'fooArray.$.bar']);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual(['foo', 'foo.bar', 'fooArray', 'fooArray.$', 'fooArray.$.bar']);
newSchema = schema.pick('blah');
(0, _expect["default"])(Object.keys(newSchema.schema())).toEqual([]);
(0, _expect.default)(Object.keys(newSchema.schema())).toEqual([]);
});

@@ -48,3 +48,3 @@ it('error when you do not pick the parent', function () {

});
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
schema.pick('level1.level2');

@@ -51,0 +51,0 @@ }).toThrow('"level1.level2" is in the schema but "level1" is not');

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -20,7 +20,7 @@ describe('SimpleSchema', function () {

});
(0, _expect["default"])(schema.newContext().validate({})).toEqual(true);
(0, _expect["default"])(schema.newContext().validate({
(0, _expect.default)(schema.newContext().validate({})).toEqual(true);
(0, _expect.default)(schema.newContext().validate({
foo: null
})).toEqual(true);
(0, _expect["default"])(schema.newContext().validate({
(0, _expect.default)(schema.newContext().validate({
foo: ''

@@ -81,44 +81,44 @@ })).toEqual(false);

});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('email')).toEqual('Email must be a valid email address');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('email')).toEqual('Email must be a valid email address');
c1.validate({
emailWithTLD: 'foo'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('emailWithTLD')).toEqual('Email with tld must be a valid email address');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('emailWithTLD')).toEqual('Email with tld must be a valid email address');
c1.validate({
domain: 'foo'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('domain')).toEqual('Domain must be a valid domain');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('domain')).toEqual('Domain must be a valid domain');
c1.validate({
weakDomain: '///jioh779&%'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('weakDomain')).toEqual('Weak domain must be a valid domain');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('weakDomain')).toEqual('Weak domain must be a valid domain');
c1.validate({
ip: 'foo'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('ip')).toEqual('Ip must be a valid IPv4 or IPv6 address');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('ip')).toEqual('Ip must be a valid IPv4 or IPv6 address');
c1.validate({
ip4: 'foo'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('ip4')).toEqual('Ip4 must be a valid IPv4 address');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('ip4')).toEqual('Ip4 must be a valid IPv4 address');
c1.validate({
ip6: 'foo'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('ip6')).toEqual('Ip6 must be a valid IPv6 address');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('ip6')).toEqual('Ip6 must be a valid IPv6 address');
c1.validate({
url: 'foo'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('url')).toEqual('Url must be a valid URL');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('url')).toEqual('Url must be a valid URL');
c1.validate({
id: '%#$%'
});
(0, _expect["default"])(c1.validationErrors().length).toEqual(1);
(0, _expect["default"])(c1.keyErrorMessage('id')).toEqual('ID must be a valid alphanumeric ID');
(0, _expect.default)(c1.validationErrors().length).toEqual(1);
(0, _expect.default)(c1.keyErrorMessage('id')).toEqual('ID must be a valid alphanumeric ID');
});

@@ -138,7 +138,7 @@ it('Optional regEx in subobject', function () {

var context = schema.namedContext();
(0, _expect["default"])(context.validate({})).toEqual(true);
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({})).toEqual(true);
(0, _expect.default)(context.validate({
foo: {}
})).toEqual(true);
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
foo: {

@@ -148,3 +148,3 @@ url: null

})).toEqual(true);
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$set: {

@@ -156,3 +156,3 @@ foo: {}

})).toEqual(true);
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$set: {

@@ -164,3 +164,3 @@ 'foo.url': null

})).toEqual(true);
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$unset: {

@@ -177,7 +177,7 @@ 'foo.url': ''

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}
function isFalse(s) {
(0, _expect["default"])(expr.test(s)).toBe(false);
(0, _expect.default)(expr.test(s)).toBe(false);
}

@@ -199,7 +199,7 @@

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}
function isFalse(s) {
(0, _expect["default"])(expr.test(s)).toBe(false);
(0, _expect.default)(expr.test(s)).toBe(false);
}

@@ -221,7 +221,7 @@

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}
function isFalse(s) {
(0, _expect["default"])(expr.test(s)).toBe(false);
(0, _expect.default)(expr.test(s)).toBe(false);
}

@@ -238,3 +238,3 @@

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}

@@ -251,7 +251,7 @@

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}
function isFalse(s) {
(0, _expect["default"])(expr.test(s)).toBe(false);
(0, _expect.default)(expr.test(s)).toBe(false);
}

@@ -273,7 +273,7 @@

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}
function isFalse(s) {
(0, _expect["default"])(expr.test(s)).toBe(false);
(0, _expect.default)(expr.test(s)).toBe(false);
}

@@ -295,7 +295,7 @@

function isTrue(s) {
(0, _expect["default"])(expr.test(s)).toBe(true);
(0, _expect.default)(expr.test(s)).toBe(true);
}
function isFalse(s) {
(0, _expect["default"])(expr.test(s)).toBe(false);
(0, _expect.default)(expr.test(s)).toBe(false);
}

@@ -302,0 +302,0 @@

@@ -17,3 +17,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,3 +24,3 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('valid', function () {
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
requiredString: 'test',

@@ -39,3 +39,3 @@ requiredBoolean: true,

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
requiredString: 'test',

@@ -53,4 +53,4 @@ requiredBoolean: true,

it('invalid', function () {
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {}).toBe(8);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {}).toBe(8);
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: null,

@@ -67,3 +67,3 @@ requiredBoolean: null,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: null,

@@ -79,3 +79,3 @@ requiredBoolean: null,

(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: null,

@@ -91,3 +91,3 @@ requiredBoolean: null,

(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: null,

@@ -101,3 +101,3 @@ requiredBoolean: null,

}).toBe(8);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: undefined,

@@ -114,3 +114,3 @@ requiredBoolean: undefined,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: '',

@@ -127,3 +127,3 @@ requiredBoolean: null,

}).toBe(7);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
requiredString: ' ',

@@ -141,3 +141,3 @@ requiredBoolean: null,

(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
friends: [{

@@ -156,3 +156,3 @@ name: 'Bob'

});
(0, _expectRequiredErrorLength["default"])(schema, {}).toBe(0);
(0, _expectRequiredErrorLength.default)(schema, {}).toBe(0);
});

@@ -168,7 +168,7 @@ it('required option', function () {

});
(0, _expectRequiredErrorLength["default"])(schema, {}).toBe(1);
(0, _expectRequiredErrorLength.default)(schema, {}).toBe(1);
});
describe('modifier with $set', function () {
it('valid upsert', function () {
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {

@@ -192,3 +192,3 @@ requiredString: 'test',

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {

@@ -221,3 +221,3 @@ requiredString: 'test',

});
(0, _expectValid["default"])(schema, {
(0, _expectValid.default)(schema, {
$set: {

@@ -231,3 +231,3 @@ name: 'name'

it('invalid upsert', function () {
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {}

@@ -239,3 +239,3 @@ }, {

(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -251,3 +251,3 @@ requiredEmail: null,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -267,3 +267,3 @@ requiredString: null,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -283,3 +283,3 @@ requiredString: undefined,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -299,3 +299,3 @@ requiredString: '',

}).toBe(7);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -318,3 +318,3 @@ requiredString: ' ',

// Would not cause DB changes, so should not be an error
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {}

@@ -324,3 +324,3 @@ }, {

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {

@@ -339,3 +339,3 @@ requiredString: 'test',

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {

@@ -357,3 +357,3 @@ requiredString: 'test',

(0, _expectValid["default"])(_friendsSchema["default"], {
(0, _expectValid.default)(_friendsSchema.default, {
$set: {

@@ -367,3 +367,3 @@ enemies: [{

});
(0, _expectValid["default"])(_friendsSchema["default"], {
(0, _expectValid.default)(_friendsSchema.default, {
$set: {

@@ -375,3 +375,3 @@ 'friends.1.name': 'Bob'

});
(0, _expectValid["default"])(_friendsSchema["default"], {
(0, _expectValid.default)(_friendsSchema.default, {
$set: {

@@ -386,3 +386,3 @@ friends: [{

});
(0, _expectValid["default"])(_friendsSchema["default"], {
(0, _expectValid.default)(_friendsSchema.default, {
$set: {

@@ -400,3 +400,3 @@ enemies: [{

// MongoDB will set the props to `undefined`
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -415,3 +415,3 @@ requiredString: undefined,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -430,3 +430,3 @@ requiredString: null,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -445,3 +445,3 @@ requiredString: '',

}).toBe(7);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -461,3 +461,3 @@ requiredString: ' ',

(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -470,3 +470,3 @@ enemies: [{}]

(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -479,3 +479,3 @@ 'friends.1.name': null

(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -489,3 +489,3 @@ friends: [{

}).toBe(1);
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -500,3 +500,3 @@ enemies: [{

}).toBe(2);
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -511,3 +511,3 @@ enemies: [{

}).toBe(4);
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$set: {

@@ -528,3 +528,3 @@ enemies: [{

it('valid upsert', function () {
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$setOnInsert: {

@@ -548,3 +548,3 @@ requiredString: 'test',

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$setOnInsert: {

@@ -568,3 +568,3 @@ requiredString: 'test',

it('invalid upsert', function () {
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$setOnInsert: {}

@@ -575,3 +575,3 @@ }, {

}).toBe(8);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$setOnInsert: {

@@ -591,3 +591,3 @@ requiredString: null,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$setOnInsert: {

@@ -607,3 +607,3 @@ requiredString: undefined,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$setOnInsert: {

@@ -623,3 +623,3 @@ requiredString: '',

}).toBe(7);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$setOnInsert: {

@@ -640,3 +640,3 @@ requiredString: ' ',

(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$setOnInsert: {

@@ -658,3 +658,3 @@ friends: [{

// Make sure they're merged for validation purposes.
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {

@@ -678,3 +678,3 @@ requiredString: 'test',

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$set: {

@@ -700,3 +700,3 @@ requiredString: 'test',

it('invalid upsert', function () {
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$setOnInsert: {},

@@ -708,3 +708,3 @@ $set: {}

}).toBe(8);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -726,3 +726,3 @@ requiredString: null,

}).toBe(9);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -744,3 +744,3 @@ requiredString: undefined,

}).toBe(8);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -762,3 +762,3 @@ requiredString: '',

}).toBe(5);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$set: {

@@ -785,3 +785,3 @@ requiredString: ' ',

// Would not cause DB changes, so should not be an error
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$unset: {}

@@ -793,3 +793,3 @@ }, {

(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$unset: {

@@ -801,3 +801,3 @@ anOptionalOne: 1

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$unset: {

@@ -809,3 +809,3 @@ anOptionalOne: null

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$unset: {

@@ -817,3 +817,3 @@ anOptionalOne: ''

});
(0, _expectValid["default"])(_requiredSchema["default"], {
(0, _expectValid.default)(_requiredSchema.default, {
$unset: {

@@ -826,3 +826,3 @@ optionalObject: ''

(0, _expectValid["default"])(_friendsSchema["default"], {
(0, _expectValid.default)(_friendsSchema.default, {
$unset: {

@@ -834,3 +834,3 @@ 'friends.1.a.b': ''

});
(0, _expectValid["default"])(_friendsSchema["default"], {
(0, _expectValid.default)(_friendsSchema.default, {
$unset: {

@@ -846,3 +846,3 @@ 'friends.1.a.b': 1,

it('invalid', function () {
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$unset: {

@@ -859,3 +859,3 @@ requiredString: 1,

}).toBe(6);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$unset: {

@@ -867,3 +867,3 @@ 'optionalObject.requiredString': 1

}).toBe(1);
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$unset: {

@@ -876,3 +876,3 @@ 'requiredObject.requiredNumber': 1

(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$unset: {

@@ -884,3 +884,3 @@ 'friends.1.name': 1

}).toBe(1);
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$unset: {

@@ -898,3 +898,3 @@ 'friends.1.name': 1,

it('rename from optional key to another key in schema', function () {
(0, _expectValid["default"])(_testSchema["default"], {
(0, _expectValid.default)(_testSchema.default, {
$rename: {

@@ -908,3 +908,3 @@ string: 'minMaxString'

it('rename from optional key to a key not in schema', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$rename: {

@@ -918,3 +918,3 @@ string: 'newString'

it('rename from required key', function () {
(0, _expectRequiredErrorLength["default"])(_requiredSchema["default"], {
(0, _expectRequiredErrorLength.default)(_requiredSchema.default, {
$rename: {

@@ -930,3 +930,3 @@ requiredString: 'requiredUrl'

it('valid', function () {
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$push: {

@@ -943,3 +943,3 @@ friends: {

it('invalid', function () {
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$push: {

@@ -957,3 +957,3 @@ friends: {

it('valid', function () {
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$addToSet: {

@@ -970,3 +970,3 @@ friends: {

it('invalid', function () {
(0, _expectRequiredErrorLength["default"])(_friendsSchema["default"], {
(0, _expectRequiredErrorLength.default)(_friendsSchema.default, {
$addToSet: {

@@ -973,0 +973,0 @@ friends: {

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _expectErrorLength = _interopRequireDefault(require("./testHelpers/expectErrorLength"));

@@ -15,6 +17,4 @@

var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable func-names, prefer-arrow-callback */

@@ -28,3 +28,3 @@ describe('SimpleSchema - type', function () {

});
(0, _expectErrorLength["default"])(schema, {
(0, _expectErrorLength.default)(schema, {
ta: new Uint8Array(100000000)

@@ -34,3 +34,3 @@ }).toEqual(0);

it('array of objects', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _friendsSchema.default, {
$set: {

@@ -48,3 +48,3 @@ enemies: [{

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _friendsSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _friendsSchema.default, {
$set: {

@@ -67,3 +67,3 @@ enemies: [{

address: {
type: _Address["default"]
type: _Address.default
},

@@ -77,6 +77,6 @@ createdAt: {

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
createdAt: new Date(),
file: new Uint8Array([104, 101, 108, 108, 111]),
address: new _Address["default"]('San Francisco', 'CA')
address: new _Address.default('San Francisco', 'CA')
}).toEqual(0);

@@ -87,3 +87,3 @@ });

address: {
type: _Address["default"]
type: _Address.default
},

@@ -97,3 +97,3 @@ createdAt: {

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
createdAt: {},

@@ -106,3 +106,3 @@ file: {},

it('weird type', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
new _SimpleSchema.SimpleSchema({

@@ -118,12 +118,12 @@ // eslint-disable-line no-new

it('normal', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
string: 'test'
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
string: true
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
string: 1
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
string: {

@@ -133,6 +133,6 @@ test: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
string: ['test']
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
string: new Date()

@@ -142,3 +142,3 @@ }).toEqual(1);

it('modifier with $setOnInsert', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -151,3 +151,3 @@ string: 'test'

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -160,3 +160,3 @@ string: true

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -169,3 +169,3 @@ string: 1

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -180,3 +180,3 @@ string: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -189,3 +189,3 @@ string: ['test']

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -200,3 +200,3 @@ string: new Date()

it('modifier with $set', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -208,3 +208,3 @@ string: 'test'

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -216,3 +216,3 @@ string: true

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -224,3 +224,3 @@ string: 1

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -234,3 +234,3 @@ string: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -242,3 +242,3 @@ string: ['test']

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -252,3 +252,3 @@ string: new Date()

it('modifier with $push', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -260,3 +260,3 @@ allowedStringsArray: 'test'

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -268,3 +268,3 @@ allowedStringsArray: true

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -276,3 +276,3 @@ allowedStringsArray: 1

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -286,3 +286,3 @@ allowedStringsArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -294,3 +294,3 @@ allowedStringsArray: ['test']

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -304,3 +304,3 @@ allowedStringsArray: new Date()

it('modifier with $addToSet', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -312,3 +312,3 @@ allowedStringsArray: 'test'

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -320,3 +320,3 @@ allowedStringsArray: true

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -328,3 +328,3 @@ allowedStringsArray: 1

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -338,3 +338,3 @@ allowedStringsArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -346,3 +346,3 @@ allowedStringsArray: ['test']

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -356,3 +356,3 @@ allowedStringsArray: new Date()

it('modifier with $push + $each', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -366,3 +366,3 @@ allowedStringsArray: {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -376,3 +376,3 @@ allowedStringsArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -386,3 +386,3 @@ allowedStringsArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -400,3 +400,3 @@ allowedStringsArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -410,3 +410,3 @@ allowedStringsArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -424,30 +424,30 @@ allowedStringsArray: {

it('normal', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": true
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: true
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": false
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: false
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": 'true'
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: 'true'
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": 0
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: 0
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: {
test: true
}
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": [false]
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: [false]
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
"boolean": new Date()
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
boolean: new Date()
}).toEqual(1);
});
it('modifier with $setOnInsert', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": true
boolean: true
}

@@ -458,5 +458,5 @@ }, {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": false
boolean: false
}

@@ -467,5 +467,5 @@ }, {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": 'true'
boolean: 'true'
}

@@ -476,5 +476,5 @@ }, {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": 0
boolean: 0
}

@@ -485,5 +485,5 @@ }, {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": {
boolean: {
test: true

@@ -496,5 +496,5 @@ }

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": [false]
boolean: [false]
}

@@ -505,5 +505,5 @@ }, {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {
"boolean": new Date()
boolean: new Date()
}

@@ -516,5 +516,5 @@ }, {

it('modifier with $set', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": true
boolean: true
}

@@ -524,5 +524,5 @@ }, {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": false
boolean: false
}

@@ -532,5 +532,5 @@ }, {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": 'true'
boolean: 'true'
}

@@ -540,5 +540,5 @@ }, {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": 0
boolean: 0
}

@@ -548,5 +548,5 @@ }, {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": {
boolean: {
test: true

@@ -558,5 +558,5 @@ }

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": [false]
boolean: [false]
}

@@ -566,5 +566,5 @@ }, {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {
"boolean": new Date()
boolean: new Date()
}

@@ -576,3 +576,3 @@ }, {

it('modifier with $push', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -584,3 +584,3 @@ booleanArray: true

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -592,3 +592,3 @@ booleanArray: false

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -600,3 +600,3 @@ booleanArray: 'true'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -608,3 +608,3 @@ booleanArray: 0

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -618,3 +618,3 @@ booleanArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -626,3 +626,3 @@ booleanArray: [false]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -636,3 +636,3 @@ booleanArray: new Date()

it('modifier with $addToSet', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -644,3 +644,3 @@ booleanArray: true

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -652,3 +652,3 @@ booleanArray: false

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -660,3 +660,3 @@ booleanArray: 'true'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -668,3 +668,3 @@ booleanArray: 0

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -678,3 +678,3 @@ booleanArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -686,3 +686,3 @@ booleanArray: [false]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -696,3 +696,3 @@ booleanArray: new Date()

it('modifier with $push + $each', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -706,3 +706,3 @@ booleanArray: {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -716,3 +716,3 @@ booleanArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -726,3 +726,3 @@ booleanArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -740,3 +740,3 @@ booleanArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -750,3 +750,3 @@ booleanArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -764,15 +764,15 @@ booleanArray: {

it('normal', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: 1
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: 0
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: 'test'
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: false
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: {

@@ -782,10 +782,10 @@ test: 1

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: [1]
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: new Date()
}).toEqual(1); // NaN does not count
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
number: NaN

@@ -795,3 +795,3 @@ }).toEqual(1);

it('modifier with $setOnInsert', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -804,3 +804,3 @@ number: 1

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -813,3 +813,3 @@ number: 0

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -822,3 +822,3 @@ number: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -831,3 +831,3 @@ number: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -842,3 +842,3 @@ number: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -851,3 +851,3 @@ number: [1]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -861,3 +861,3 @@ number: new Date()

(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -872,3 +872,3 @@ number: NaN

it('modifier with $set', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -880,3 +880,3 @@ number: 1

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -888,3 +888,3 @@ number: 0

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -896,3 +896,3 @@ number: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -904,3 +904,3 @@ number: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -914,3 +914,3 @@ number: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -922,3 +922,3 @@ number: [1]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -931,3 +931,3 @@ number: new Date()

(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -941,3 +941,3 @@ number: NaN

it('modifier with $push', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -949,3 +949,3 @@ allowedNumbersArray: 1

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -957,3 +957,3 @@ allowedNumbersArray: 0

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -965,3 +965,3 @@ allowedNumbersArray: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -973,3 +973,3 @@ allowedNumbersArray: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -983,3 +983,3 @@ allowedNumbersArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -991,3 +991,3 @@ allowedNumbersArray: [1]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1000,3 +1000,3 @@ allowedNumbersArray: new Date()

(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1010,3 +1010,3 @@ allowedNumbersArray: NaN

it('modifier with $addToSet', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1018,3 +1018,3 @@ allowedNumbersArray: 1

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1026,3 +1026,3 @@ allowedNumbersArray: 0

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1034,3 +1034,3 @@ allowedNumbersArray: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1042,3 +1042,3 @@ allowedNumbersArray: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1052,3 +1052,3 @@ allowedNumbersArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1060,3 +1060,3 @@ allowedNumbersArray: [1]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1069,3 +1069,3 @@ allowedNumbersArray: new Date()

(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1079,3 +1079,3 @@ allowedNumbersArray: NaN

it('modifier with $push + $each', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1089,3 +1089,3 @@ allowedNumbersArray: {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1099,3 +1099,3 @@ allowedNumbersArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1109,3 +1109,3 @@ allowedNumbersArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1123,3 +1123,3 @@ allowedNumbersArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1133,3 +1133,3 @@ allowedNumbersArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1144,3 +1144,3 @@ allowedNumbersArray: {

(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1158,12 +1158,12 @@ allowedNumbersArray: {

it('normal', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
date: new Date()
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
date: 'test'
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
date: false
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
date: {

@@ -1173,6 +1173,6 @@ test: new Date()

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
date: [new Date()]
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
date: 1

@@ -1182,3 +1182,3 @@ }).toEqual(1);

it('modifier with $setOnInsert', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1191,3 +1191,3 @@ date: new Date()

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1200,3 +1200,3 @@ date: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1209,3 +1209,3 @@ date: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1220,3 +1220,3 @@ date: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1229,3 +1229,3 @@ date: [new Date()]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1240,3 +1240,3 @@ date: 1

it('modifier with $set', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1248,3 +1248,3 @@ date: new Date()

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1256,3 +1256,3 @@ date: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1264,3 +1264,3 @@ date: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1274,3 +1274,3 @@ date: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1282,3 +1282,3 @@ date: [new Date()]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1292,3 +1292,3 @@ date: 1

it('modifier with $push', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1300,3 +1300,3 @@ dateArray: new Date()

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1308,3 +1308,3 @@ dateArray: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1316,3 +1316,3 @@ dateArray: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1326,3 +1326,3 @@ dateArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1334,3 +1334,3 @@ dateArray: [new Date()]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1344,3 +1344,3 @@ dateArray: 1

it('modifier with $addToSet', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1352,3 +1352,3 @@ dateArray: new Date()

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1360,3 +1360,3 @@ dateArray: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1368,3 +1368,3 @@ dateArray: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1378,3 +1378,3 @@ dateArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1386,3 +1386,3 @@ dateArray: [new Date()]

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$addToSet: {

@@ -1396,3 +1396,3 @@ dateArray: 1

it('modifier with $push + $each', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1406,3 +1406,3 @@ dateArray: {

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1416,3 +1416,3 @@ dateArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1426,3 +1426,3 @@ dateArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1440,3 +1440,3 @@ dateArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1450,3 +1450,3 @@ dateArray: {

}).toEqual(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$push: {

@@ -1464,18 +1464,18 @@ dateArray: {

it('normal', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: []
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: [true]
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: [false]
}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: 'test'
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: false
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: {

@@ -1485,6 +1485,6 @@ test: []

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: ['test']
}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
booleanArray: 1

@@ -1494,3 +1494,3 @@ }).toEqual(1);

it('modifier with $setOnInsert', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1503,3 +1503,3 @@ booleanArray: [true, false]

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1512,3 +1512,3 @@ booleanArray: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1521,3 +1521,3 @@ booleanArray: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1532,3 +1532,3 @@ booleanArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1541,3 +1541,3 @@ booleanArray: new Date()

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$setOnInsert: {

@@ -1552,3 +1552,3 @@ booleanArray: 1

it('modifier with $set', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1560,3 +1560,3 @@ booleanArray: [true, false]

}).toEqual(0);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1568,3 +1568,3 @@ booleanArray: 'test'

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1576,3 +1576,3 @@ booleanArray: false

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1586,3 +1586,3 @@ booleanArray: {

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1594,3 +1594,3 @@ booleanArray: new Date()

}).toEqual(1);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema["default"], {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, _testSchema.default, {
$set: {

@@ -1604,3 +1604,3 @@ booleanArray: 1

it('ignores slice', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$push: {

@@ -1629,3 +1629,3 @@ booleanArray: {

it('ignores pull', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$pull: {

@@ -1642,3 +1642,3 @@ booleanArray: 'foo',

it('ignores pull + $each', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$pull: {

@@ -1663,3 +1663,3 @@ booleanArray: {

it('ignores pullAll', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$pullAll: {

@@ -1676,3 +1676,3 @@ booleanArray: ['foo', 'bar'],

it('ignores pop', function () {
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$pop: {

@@ -1687,3 +1687,3 @@ booleanArray: 1,

}).toEqual(0);
(0, _expectErrorLength["default"])(_testSchema["default"], {
(0, _expectErrorLength.default)(_testSchema.default, {
$pop: {

@@ -1690,0 +1690,0 @@ booleanArray: -1,

@@ -9,3 +9,3 @@ "use strict";

get: function get() {
return _ValidationContext["default"];
return _ValidationContext.default;
}

@@ -17,10 +17,4 @@ });

var _lodash = _interopRequireDefault(require("lodash.every"));
var _deepExtend = _interopRequireDefault(require("deep-extend"));
var _extend2 = _interopRequireDefault(require("extend"));
var _lodash2 = _interopRequireDefault(require("lodash.includes"));
var _lodash3 = _interopRequireDefault(require("lodash.isempty"));
var _messageBox = _interopRequireDefault(require("message-box"));

@@ -30,10 +24,4 @@

var _lodash4 = _interopRequireDefault(require("lodash.omit"));
var _humanize = _interopRequireDefault(require("./humanize"));
var _lodash5 = _interopRequireDefault(require("lodash.pick"));
var _lodash6 = _interopRequireDefault(require("lodash.uniq"));
var _humanize = _interopRequireDefault(require("./humanize.js"));
var _ValidationContext = _interopRequireDefault(require("./ValidationContext"));

@@ -53,3 +41,3 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -70,2 +58,6 @@ 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 _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; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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; }

@@ -139,3 +131,3 @@

this.messageBox = new _messageBox["default"]((0, _clone["default"])(_defaultMessages["default"]));
this.messageBox = new _messageBox.default((0, _clone.default)(_defaultMessages.default));
this.version = SimpleSchema.version;

@@ -149,3 +141,3 @@ }

var genericKey = _mongoObject["default"].makeKeyGeneric(key);
var genericKey = _mongoObject.default.makeKeyGeneric(key);

@@ -179,3 +171,3 @@ (0, _utility.forEachKeyAncestor)(genericKey, function (ancestor) {

var genericKey = _mongoObject["default"].makeKeyGeneric(key); // If in this schema
var genericKey = _mongoObject.default.makeKeyGeneric(key); // If in this schema

@@ -214,3 +206,3 @@

var genericKey = _mongoObject["default"].makeKeyGeneric(key);
var genericKey = _mongoObject.default.makeKeyGeneric(key);

@@ -279,3 +271,3 @@ var keySchema = this._schema[genericKey]; // If not defined in this schema, see if it's defined in a subschema

return function (prop) {
if (Array.isArray(propList) && !(0, _lodash2["default"])(propList, prop)) return;
if (Array.isArray(propList) && !propList.includes(prop)) return;
var val = obj[prop]; // For any options that support specifying a function, evaluate the functions

@@ -369,3 +361,3 @@

var genericKey = _mongoObject["default"].makeKeyGeneric(key);
var genericKey = _mongoObject.default.makeKeyGeneric(key);

@@ -414,3 +406,3 @@ var searchString = "".concat(genericKey, ".");

var blackboxKeys = this._blackboxKeys;
var blackboxKeys = new Set(this._blackboxKeys);

@@ -420,5 +412,4 @@ this._schemaKeys.forEach(function (key) {

if (!SimpleSchema.isSimpleSchema(typeDef.type)) return;
typeDef.type._blackboxKeys.forEach(function (blackboxKey) {
blackboxKeys.push("".concat(key, ".").concat(blackboxKey));
typeDef.type.blackboxKeys().forEach(function (blackboxKey) {
blackboxKeys.add("".concat(key, ".").concat(blackboxKey));
});

@@ -428,3 +419,3 @@ });

return (0, _lodash6["default"])(blackboxKeys);
return Array.from(blackboxKeys);
} // Check if the key is a nested dot-syntax key inside of a blackbox object

@@ -438,4 +429,4 @@

var isInBlackBox = false;
(0, _utility.forEachKeyAncestor)(_mongoObject["default"].makeKeyGeneric(key), function (ancestor, remainder) {
if (_this6._blackboxKeys.indexOf(ancestor) > -1) {
(0, _utility.forEachKeyAncestor)(_mongoObject.default.makeKeyGeneric(key), function (ancestor, remainder) {
if (_this6._blackboxKeys.has(ancestor)) {
isInBlackBox = true;

@@ -476,3 +467,3 @@ } else {

if (_this7._blackboxKeys.indexOf(loopKey) > -1) {
if (_this7._blackboxKeys.has(loopKey)) {
// If the test key is the black box key + ".$", then the test

@@ -520,3 +511,3 @@ // key is NOT allowed because black box keys are by definition

value: function _copyWithSchema(schema) {
var cl = new SimpleSchema(schema, (0, _clone["default"])(this._constructorOptions, false, 1));
var cl = new SimpleSchema(schema, _objectSpread({}, this._constructorOptions));
cl._cleanOptions = this._cleanOptions;

@@ -558,6 +549,6 @@ cl.messageBox = this.messageBox.clone();

this._docValidators = this._docValidators.concat(schema._docValidators);
this._cleanOptions = (0, _extend2["default"])(false, this._cleanOptions, schema._cleanOptions);
this._constructorOptions = (0, _extend2["default"])(false, this._constructorOptions, schema._constructorOptions);
Object.assign(this._cleanOptions, schema._cleanOptions);
Object.assign(this._constructorOptions, schema._constructorOptions);
} else {
schemaObj = (0, _expandShorthand["default"])(schema);
schemaObj = (0, _expandShorthand.default)(schema);
} // Update all of the information cached on the instance

@@ -570,3 +561,3 @@

if (_this8._schema[fieldName]) {
if (!_this8._schema.hasOwnProperty(fieldName)) {
if (!Object.prototype.hasOwnProperty.call(_this8._schema, fieldName)) {
// fieldName is actually a method from Object itself!

@@ -576,3 +567,6 @@ throw new Error("".concat(fieldName, " key is actually the name of a method on Object, please rename it"));

_this8._schema[fieldName] = _objectSpread({}, _this8._schema[fieldName], {}, (0, _lodash4["default"])(definition, 'type'));
var type = definition.type,
definitionWithoutType = _objectWithoutProperties(definition, ["type"]);
_this8._schema[fieldName] = _objectSpread({}, _this8._schema[fieldName], {}, definitionWithoutType);
if (definition.type) _this8._schema[fieldName].type.extend(definition.type);

@@ -589,3 +583,3 @@ } else {

this._autoValues = [];
this._blackboxKeys = [];
this._blackboxKeys = new Set();
this._firstLevelSchemaKeys = [];

@@ -598,3 +592,3 @@ this._objectKeys = {}; // Update all of the information cached on the instance

var parentFieldName = fieldName.slice(0, fieldName.lastIndexOf('.'));
if (!_this8._schema.hasOwnProperty(parentFieldName)) throw new Error("\"".concat(fieldName, "\" is in the schema but \"").concat(parentFieldName, "\" is not"));
if (!Object.prototype.hasOwnProperty.call(_this8._schema, parentFieldName)) throw new Error("\"".concat(fieldName, "\" is in the schema but \"").concat(parentFieldName, "\" is not"));
}

@@ -607,12 +601,36 @@

(0, _lodash["default"])(definition.type.definitions, function (oneOfDef) {
// XXX If the type is SS.Any, also consider it a blackbox
if (oneOfDef.blackbox === true || oneOfDef.type === SimpleSchema.Any) {
_this8._blackboxKeys.push(fieldName);
/* eslint-disable no-restricted-syntax */
return false; // exit loop
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = definition.type.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var oneOfDef = _step.value;
// XXX If the type is SS.Any, also consider it a blackbox
if (oneOfDef.blackbox === true || oneOfDef.type === SimpleSchema.Any) {
_this8._blackboxKeys.add(fieldName);
break;
}
}
/* eslint-enable no-restricted-syntax */
// Keep list of autoValue functions
return true;
}); // Keep list of autoValue functions
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}

@@ -667,3 +685,8 @@ if (typeof definition.autoValue === 'function') {

var allowedValues = this.get(key, 'allowedValues');
return (0, _lodash3["default"])(allowedValues) ? null : _toConsumableArray(allowedValues);
if (Array.isArray(allowedValues) || allowedValues instanceof Set) {
return _toConsumableArray(allowedValues);
}
return null;
}

@@ -673,3 +696,3 @@ }, {

value: function newContext() {
return new _ValidationContext["default"](this);
return new _ValidationContext.default(this);
}

@@ -682,3 +705,3 @@ }, {

if (!this._validationContexts[name]) {
this._validationContexts[name] = new _ValidationContext["default"](this);
this._validationContexts[name] = new _ValidationContext.default(this);
}

@@ -737,3 +760,4 @@

var error = new Error(message);
error.name = error.errorType = 'ClientError';
error.errorType = 'ClientError';
error.name = 'ClientError';
error.error = 'validation-error'; // Add meaningful error messages for each validation error.

@@ -791,3 +815,3 @@ // Useful for display messages when using 'mdg:validated-method'.

// Do this here and pass into both functions for better performance
optionsClone.mongoObject = new _mongoObject["default"](obj, _this11.blackboxKeys());
optionsClone.mongoObject = new _mongoObject.default(obj, _this11.blackboxKeys());

@@ -819,3 +843,3 @@ _this11.clean(obj, optionsClone);

return _clean2["default"].apply(void 0, [this].concat(args));
return _clean2.default.apply(void 0, [this].concat(args));
}

@@ -837,3 +861,3 @@ /**

if (typeof label !== 'string' && typeof label !== 'function') return;
if (!_this12._schema.hasOwnProperty(key)) return;
if (!Object.prototype.hasOwnProperty.call(_this12._schema, key)) return;
_this12._schema[key].label = label;

@@ -887,3 +911,3 @@ _this12._depsLabels[key] && _this12._depsLabels[key].changed();

if ((0, _lodash2["default"])(schemaDefinitionOptions, prop)) {
if (schemaDefinitionOptions.includes(prop)) {
return def[prop];

@@ -964,3 +988,3 @@ }

return _construct(_SimpleSchemaGroup["default"], definitions);
return _construct(_SimpleSchemaGroup.default, definitions);
}

@@ -994,3 +1018,3 @@ }, {

_defineProperty(SimpleSchema, "RegEx", _regExp["default"]);
_defineProperty(SimpleSchema, "RegEx", _regExp.default);

@@ -1023,8 +1047,8 @@ _defineProperty(SimpleSchema, "_validators", []);

_defineProperty(SimpleSchema, "_makeGeneric", _mongoObject["default"].makeKeyGeneric);
_defineProperty(SimpleSchema, "_makeGeneric", _mongoObject.default.makeKeyGeneric);
_defineProperty(SimpleSchema, "ValidationContext", _ValidationContext["default"]);
_defineProperty(SimpleSchema, "ValidationContext", _ValidationContext.default);
_defineProperty(SimpleSchema, "setDefaultMessages", function (messages) {
(0, _extend2["default"])(true, _defaultMessages["default"], messages);
(0, _deepExtend.default)(_defaultMessages.default, messages);
});

@@ -1041,3 +1065,3 @@

if (schema.hasOwnProperty(newKey)) {
if (Object.prototype.hasOwnProperty.call(schema, newKey)) {
throw new Error("The type for \"".concat(key, "\" is set to a SimpleSchema instance that defines \"").concat(key, ".").concat(subKey, "\", but the parent SimpleSchema instance also tries to define \"").concat(key, ".").concat(subKey, "\""));

@@ -1064,3 +1088,3 @@ }

return shouldHumanize ? (0, _humanize["default"])(label) : label;
return shouldHumanize ? (0, _humanize.default)(label) : label;
}

@@ -1089,11 +1113,23 @@

function standardizeDefinition(def) {
var standardizedDef = (0, _lodash4["default"])(def, oneOfProps); // Internally, all definition types are stored as groups for simplicity of access.
var standardizedDef = Object.keys(def).reduce(function (newDef, prop) {
if (!oneOfProps.includes(prop)) {
newDef[prop] = def[prop];
}
return newDef;
}, {}); // Internally, all definition types are stored as groups for simplicity of access.
// If we are extending, there may not actually be def.type, but it's okay because
// it will be added later when the two SimpleSchemaGroups are merged.
if (def.type && def.type instanceof _SimpleSchemaGroup["default"]) {
if (def.type && def.type instanceof _SimpleSchemaGroup.default) {
standardizedDef.type = def.type.clone();
} else {
var groupProps = (0, _lodash5["default"])(def, oneOfProps);
standardizedDef.type = new _SimpleSchemaGroup["default"](groupProps);
var groupProps = Object.keys(def).reduce(function (newDef, prop) {
if (oneOfProps.includes(prop)) {
newDef[prop] = def[prop];
}
return newDef;
}, {});
standardizedDef.type = new _SimpleSchemaGroup.default(groupProps);
}

@@ -1123,3 +1159,3 @@

if (type.constructor === Object && (0, _lodash3["default"])(type)) {
if (type.constructor === Object && (0, _utility.isEmptyObject)(type)) {
throw new Error("Invalid definition for ".concat(fieldName, " field: \"type\" may not be an object. Change it to Object"));

@@ -1134,3 +1170,3 @@ }

if (fullSchemaObj.hasOwnProperty(newKey)) {
if (Object.prototype.hasOwnProperty.call(fullSchemaObj, newKey)) {
throw new Error("The type for \"".concat(fieldName, "\" is set to a SimpleSchema instance that defines \"").concat(newKey, "\", but the parent SimpleSchema instance also tries to define \"").concat(newKey, "\""));

@@ -1143,3 +1179,3 @@ }

if (couldBeArray && !fullSchemaObj.hasOwnProperty("".concat(fieldName, ".$"))) {
if (couldBeArray && !Object.prototype.hasOwnProperty.call(fullSchemaObj, "".concat(fieldName, ".$"))) {
throw new Error("\"".concat(fieldName, "\" is Array type but the schema does not include a \"").concat(fieldName, ".$\" definition for the array items\""));

@@ -1167,19 +1203,17 @@ } // defaultValue -> autoValue

definition.optional = true;
} else {
if (!definition.hasOwnProperty('optional')) {
if (definition.hasOwnProperty('required')) {
if (typeof definition.required === 'function') {
definition.optional = function optional() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
} else if (!Object.prototype.hasOwnProperty.call(definition, 'optional')) {
if (Object.prototype.hasOwnProperty.call(definition, 'required')) {
if (typeof definition.required === 'function') {
definition.optional = function optional() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return !definition.required.apply(this, args);
};
} else {
definition.optional = !definition.required;
}
return !definition.required.apply(this, args);
};
} else {
definition.optional = options.requiredByDefault === false;
definition.optional = !definition.required;
}
} else {
definition.optional = options.requiredByDefault === false;
}

@@ -1190,3 +1224,3 @@ }

if (!definition.hasOwnProperty('label')) {
if (!Object.prototype.hasOwnProperty.call(definition, 'label')) {
if (options.defaultLabel) {

@@ -1193,0 +1227,0 @@ definition.label = options.defaultLabel;

"use strict";
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("./SimpleSchema");
var _expect = _interopRequireDefault(require("expect"));
var _testSchema = _interopRequireDefault(require("./testHelpers/testSchema"));

@@ -13,3 +13,3 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -53,3 +53,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

it('throws error if first argument is an array', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
return new _SimpleSchema.SimpleSchema([]);

@@ -59,3 +59,3 @@ }).toThrow('You may not pass an array of schemas to the SimpleSchema constructor or to extend()');

it('throws error if a key is missing type', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
return new _SimpleSchema.SimpleSchema({

@@ -67,3 +67,3 @@ foo: {}

it('throws an explicit error if you define fields that override object methods', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
return new _SimpleSchema.SimpleSchema({

@@ -77,3 +77,3 @@ valueOf: {

it('throws a error if array item definition is missing', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
return new _SimpleSchema.SimpleSchema({

@@ -86,3 +86,3 @@ someArray: Array

it('throws an error if a nested schema defines a field that its parent also defines', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
return new _SimpleSchema.SimpleSchema({

@@ -106,3 +106,3 @@ foo: new _SimpleSchema.SimpleSchema({

});
(0, _expect["default"])(context.validationErrors()).toEqual([{
(0, _expect.default)(context.validationErrors()).toEqual([{
dataType: 'Object',

@@ -126,3 +126,3 @@ name: 'foo',

});
(0, _expect["default"])(context.validationErrors()).toEqual([{
(0, _expect.default)(context.validationErrors()).toEqual([{
dataType: 'String',

@@ -149,3 +149,3 @@ name: 'foo.bar',

});
(0, _expect["default"])(context.validationErrors()).toEqual([{
(0, _expect.default)(context.validationErrors()).toEqual([{
name: 'foo.bar',

@@ -170,3 +170,3 @@ type: _SimpleSchema.SimpleSchema.ErrorTypes.VALUE_NOT_ALLOWED,

});
(0, _expect["default"])(context.validationErrors()).toEqual([{
(0, _expect.default)(context.validationErrors()).toEqual([{
dataType: 'String',

@@ -196,3 +196,3 @@ name: 'foo.bar',

});
(0, _expect["default"])(context.validationErrors()).toEqual([{
(0, _expect.default)(context.validationErrors()).toEqual([{
name: 'a.b',

@@ -212,3 +212,3 @@ type: _SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED,

});
(0, _expect["default"])(context.validationErrors()).toEqual([{
(0, _expect.default)(context.validationErrors()).toEqual([{
name: 'a.b.c',

@@ -220,3 +220,3 @@ type: _SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED,

it('issue #307 - throws an error if incorrect import results in empty object', function () {
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
// Assume that default import of a file with no default export returns an empty object

@@ -269,3 +269,3 @@ var Place = {}; // eslint-disable-next-line no-new

});
(0, _expect["default"])(cleaned).toEqual({
(0, _expect.default)(cleaned).toEqual({
$set: {

@@ -293,3 +293,3 @@ nested: [{

var context = userSchema.namedContext();
(0, _expect["default"])(context.validate({
(0, _expect.default)(context.validate({
$set: {

@@ -314,3 +314,3 @@ profile: {}

var context2 = userSchema2.namedContext();
(0, _expect["default"])(context2.validate({
(0, _expect.default)(context2.validate({
$push: {

@@ -333,6 +333,6 @@ profile: {}

var context = schema.namedContext();
(0, _expect["default"])(context.validate(testObj)).toBe(true);
(0, _expect["default"])(testObj instanceof CustomObject).toBe(true);
(0, _expect.default)(context.validate(testObj)).toBe(true);
(0, _expect.default)(testObj instanceof CustomObject).toBe(true);
testObj.foo = 'not a number';
(0, _expect["default"])(context.validate(testObj)).toBe(false);
(0, _expect.default)(context.validate(testObj)).toBe(false);
});

@@ -351,10 +351,10 @@ it('validate object with prototype within normal object', function () {

var context = schema.namedContext();
(0, _expect["default"])(context.validate(testObj)).toBe(true);
(0, _expect["default"])(testObj.customObject instanceof CustomObject).toBe(true);
(0, _expect.default)(context.validate(testObj)).toBe(true);
(0, _expect.default)(testObj.customObject instanceof CustomObject).toBe(true);
testObj.customObject.foo = 'not a number';
(0, _expect["default"])(context.validate(testObj)).toBe(false);
(0, _expect.default)(context.validate(testObj)).toBe(false);
});
it('allowsKey', function () {
function run(key, allowed) {
(0, _expect["default"])(_testSchema["default"].allowsKey(key)).toBe(allowed);
(0, _expect.default)(_testSchema.default.allowsKey(key)).toBe(allowed);
}

@@ -398,6 +398,6 @@

});
(0, _expect["default"])(schema.allowsKey('foo.bar')).toBe(true);
(0, _expect["default"])(schema.allowsKey('foo.bar.baz')).toBe(true);
(0, _expect["default"])(schema.allowsKey('foo.bar.bum')).toBe(false);
(0, _expect["default"])(schema.allowsKey('foo.bar.baz.bum')).toBe(false);
(0, _expect.default)(schema.allowsKey('foo.bar')).toBe(true);
(0, _expect.default)(schema.allowsKey('foo.bar.baz')).toBe(true);
(0, _expect.default)(schema.allowsKey('foo.bar.bum')).toBe(false);
(0, _expect.default)(schema.allowsKey('foo.bar.baz.bum')).toBe(false);
});

@@ -411,3 +411,3 @@ it('validating an object with a "length" property should not error', function () {

});
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
schema.validate({

@@ -437,3 +437,3 @@ length: 10

});
(0, _expect["default"])(schema.get('name', 'max')).toBe(15);
(0, _expect.default)(schema.get('name', 'max')).toBe(15);
});

@@ -452,4 +452,4 @@ it('this.key in label function context', function () {

});
(0, _expect["default"])(schema.label('items.0')).toBe('Item 0');
(0, _expect["default"])(schema.label('items.1')).toBe('Item 1');
(0, _expect.default)(schema.label('items.0')).toBe('Item 0');
(0, _expect.default)(schema.label('items.1')).toBe('Item 1');
});

@@ -465,5 +465,5 @@ it('keyIsInBlackBox in subschema', function () {

});
(0, _expect["default"])(schema.keyIsInBlackBox('foo.bar')).toBe(false);
(0, _expect["default"])(schema.keyIsInBlackBox('foo.bar.baz')).toBe(true);
(0, _expect["default"])(schema.keyIsInBlackBox('foo.bar.baz.$.bum')).toBe(true);
(0, _expect.default)(schema.keyIsInBlackBox('foo.bar')).toBe(false);
(0, _expect.default)(schema.keyIsInBlackBox('foo.bar.baz')).toBe(true);
(0, _expect.default)(schema.keyIsInBlackBox('foo.bar.baz.$.bum')).toBe(true);
});

@@ -484,3 +484,3 @@ describe('blackboxKeys from subschema', function () {

});
(0, _expect["default"])(schema.blackboxKeys()).toEqual(['apple', 'pear.info']);
(0, _expect.default)(schema.blackboxKeys()).toEqual(['apple', 'pear.info']);
});

@@ -503,3 +503,3 @@ it('are updated after extending', function () {

});
(0, _expect["default"])(schema.blackboxKeys()).toEqual(['apple']);
(0, _expect.default)(schema.blackboxKeys()).toEqual(['apple']);
});

@@ -526,3 +526,3 @@ });

});
(0, _expect["default"])(schema.schema()).toEqual({
(0, _expect.default)(schema.schema()).toEqual({
firstName: {

@@ -561,3 +561,3 @@ type: _SimpleSchema.SimpleSchema.oneOf(String),

schema2.addDocValidator(function () {});
(0, _expect["default"])(schema1.schema()).toEqual({
(0, _expect.default)(schema1.schema()).toEqual({
firstName: {

@@ -574,6 +574,6 @@ type: _SimpleSchema.SimpleSchema.oneOf(String),

});
(0, _expect["default"])(schema1._validators.length).toBe(0);
(0, _expect["default"])(schema1._docValidators.length).toBe(0);
(0, _expect.default)(schema1._validators.length).toBe(0);
(0, _expect.default)(schema1._docValidators.length).toBe(0);
schema1.extend(schema2);
(0, _expect["default"])(schema1.schema()).toEqual({
(0, _expect.default)(schema1.schema()).toEqual({
firstName: {

@@ -595,4 +595,4 @@ type: _SimpleSchema.SimpleSchema.oneOf(String),

});
(0, _expect["default"])(schema1._validators.length).toBe(1);
(0, _expect["default"])(schema1._docValidators.length).toBe(1);
(0, _expect.default)(schema1._validators.length).toBe(1);
(0, _expect.default)(schema1._docValidators.length).toBe(1);
});

@@ -612,4 +612,4 @@ it('keeps both min and max', function () {

});
(0, _expect["default"])(schema._schema.name.type.definitions[0].min).toBe(5);
(0, _expect["default"])(schema._schema.name.type.definitions[0].max).toBe(15);
(0, _expect.default)(schema._schema.name.type.definitions[0].min).toBe(5);
(0, _expect.default)(schema._schema.name.type.definitions[0].max).toBe(15);
});

@@ -632,3 +632,3 @@ it('does not mutate a schema that is passed to extend', function () {

new _SimpleSchema.SimpleSchema({}).extend(mainSchema).extend(main2Schema);
(0, _expect["default"])(mainSchema._schema['items.$'].type.definitions[0].type._schemaKeys).toEqual(['_id']);
(0, _expect.default)(mainSchema._schema['items.$'].type.definitions[0].type._schemaKeys).toEqual(['_id']);
});

@@ -645,3 +645,3 @@ });

});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
names: []

@@ -659,3 +659,3 @@ });

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
names: [null]

@@ -671,3 +671,3 @@ });

});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
test: null

@@ -692,3 +692,3 @@ });

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
emails: [{

@@ -701,3 +701,3 @@ address: 12321,

}).toBe(2);
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE, schema, {
emails: [{

@@ -718,6 +718,6 @@ address: 12321,

});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
foo: 'bar'
});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
foo: 'bar'

@@ -727,3 +727,3 @@ }, {

});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
foo: 'bar'

@@ -734,6 +734,6 @@ }, {

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.KEY_NOT_IN_SCHEMA, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.KEY_NOT_IN_SCHEMA, schema, {
bar: 'foo'
});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
bar: 'foo'

@@ -743,3 +743,3 @@ }, {

});
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
bar: 'foo'

@@ -753,3 +753,3 @@ }, {

var schema = new _SimpleSchema.SimpleSchema({
"int": _SimpleSchema.SimpleSchema.Integer,
int: _SimpleSchema.SimpleSchema.Integer,
string: String

@@ -759,16 +759,16 @@ });

function verify(error) {
(0, _expect["default"])(error.name).toBe('ClientError');
(0, _expect["default"])(error.errorType).toBe('ClientError');
(0, _expect["default"])(error.error).toBe('validation-error');
(0, _expect["default"])(error.details.length).toBe(2);
(0, _expect["default"])(error.details[0].name).toBe('int');
(0, _expect["default"])(error.details[0].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE);
(0, _expect["default"])(error.details[0].message).toBe('Int must be of type Integer');
(0, _expect["default"])(error.details[1].name).toBe('string');
(0, _expect["default"])(error.details[1].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED);
(0, _expect["default"])(error.details[1].message).toBe('String is required'); // In order for the message at the top of the stack trace to be useful,
(0, _expect.default)(error.name).toBe('ClientError');
(0, _expect.default)(error.errorType).toBe('ClientError');
(0, _expect.default)(error.error).toBe('validation-error');
(0, _expect.default)(error.details.length).toBe(2);
(0, _expect.default)(error.details[0].name).toBe('int');
(0, _expect.default)(error.details[0].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE);
(0, _expect.default)(error.details[0].message).toBe('Int must be of type Integer');
(0, _expect.default)(error.details[1].name).toBe('string');
(0, _expect.default)(error.details[1].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED);
(0, _expect.default)(error.details[1].message).toBe('String is required'); // In order for the message at the top of the stack trace to be useful,
// we set it to the first validation error message.
(0, _expect["default"])(error.reason, 'Int must be of type Integer');
(0, _expect["default"])(error.message, 'Int must be of type Integer [validation-error]');
(0, _expect.default)(error.reason, 'Int must be of type Integer');
(0, _expect.default)(error.message, 'Int must be of type Integer [validation-error]');
}

@@ -778,3 +778,3 @@

schema.validate({
"int": '5'
int: '5'
});

@@ -787,3 +787,3 @@ } catch (error) {

_SimpleSchema.SimpleSchema.validate({
"int": '5'
int: '5'
}, schema);

@@ -796,5 +796,5 @@ } catch (error) {

_SimpleSchema.SimpleSchema.validate({
"int": '5'
int: '5'
}, {
"int": _SimpleSchema.SimpleSchema.Integer,
int: _SimpleSchema.SimpleSchema.Integer,
string: String

@@ -808,3 +808,3 @@ });

schema.validator()({
"int": '5'
int: '5'
});

@@ -815,7 +815,7 @@ } catch (error) {

(0, _expect["default"])(function () {
(0, _expect.default)(function () {
schema.validator({
clean: true
})({
"int": '5',
int: '5',
string: 'test'

@@ -827,9 +827,9 @@ });

var schema = new _SimpleSchema.SimpleSchema({
"int": _SimpleSchema.SimpleSchema.Integer,
int: _SimpleSchema.SimpleSchema.Integer,
string: String
});
return Promise.all([schema.getFormValidator()({
"int": '5'
int: '5'
}).then(function (errors) {
(0, _expect["default"])(errors).toEqual([{
(0, _expect.default)(errors).toEqual([{
dataType: 'Integer',

@@ -849,6 +849,6 @@ message: 'Int must be of type Integer',

})({
"int": '5',
int: '5',
string: 'test'
}).then(function (errors) {
(0, _expect["default"])(errors).toEqual([]);
(0, _expect.default)(errors).toEqual([]);
})]);

@@ -858,3 +858,3 @@ });

var schema = new _SimpleSchema.SimpleSchema({
"int": _SimpleSchema.SimpleSchema.Integer,
int: _SimpleSchema.SimpleSchema.Integer,
string: String

@@ -864,14 +864,14 @@ });

function verify(error) {
(0, _expect["default"])(error.name).toBe('ClientError');
(0, _expect["default"])(error.errorType).toBe('ClientError');
(0, _expect["default"])(error.error).toBe('validation-error');
(0, _expect["default"])(error.details.length).toBe(2);
(0, _expect["default"])(error.details[0].name).toBe('int');
(0, _expect["default"])(error.details[0].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE);
(0, _expect["default"])(error.details[1].name).toBe('string');
(0, _expect["default"])(error.details[1].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED); // In order for the message at the top of the stack trace to be useful,
(0, _expect.default)(error.name).toBe('ClientError');
(0, _expect.default)(error.errorType).toBe('ClientError');
(0, _expect.default)(error.error).toBe('validation-error');
(0, _expect.default)(error.details.length).toBe(2);
(0, _expect.default)(error.details[0].name).toBe('int');
(0, _expect.default)(error.details[0].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.EXPECTED_TYPE);
(0, _expect.default)(error.details[1].name).toBe('string');
(0, _expect.default)(error.details[1].type).toBe(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED); // In order for the message at the top of the stack trace to be useful,
// we set it to the first validation error message.
(0, _expect["default"])(error.reason, 'Int must be of type Integer');
(0, _expect["default"])(error.message, 'Int must be of type Integer [validation-error]');
(0, _expect.default)(error.reason, 'Int must be of type Integer');
(0, _expect.default)(error.message, 'Int must be of type Integer [validation-error]');
}

@@ -881,6 +881,6 @@

schema.validate([{
"int": 5,
int: 5,
string: 'test'
}, {
"int": '5'
int: '5'
}]);

@@ -893,6 +893,6 @@ } catch (error) {

_SimpleSchema.SimpleSchema.validate([{
"int": 5,
int: 5,
string: 'test'
}, {
"int": '5'
int: '5'
}], schema);

@@ -905,8 +905,8 @@ } catch (error) {

_SimpleSchema.SimpleSchema.validate([{
"int": 5,
int: 5,
string: 'test'
}, {
"int": '5'
int: '5'
}], {
"int": _SimpleSchema.SimpleSchema.Integer,
int: _SimpleSchema.SimpleSchema.Integer,
string: String

@@ -920,6 +920,6 @@ });

schema.validator()([{
"int": 5,
int: 5,
string: 'test'
}, {
"int": '5'
int: '5'
}]);

@@ -943,3 +943,3 @@ } catch (error) {

} catch (e) {
(0, _expect["default"])(e.message).toBe('validationErrorTransform');
(0, _expect.default)(e.message).toBe('validationErrorTransform');
} // Don't mess up other tests

@@ -964,3 +964,3 @@

_SimpleSchema.SimpleSchema.addDocValidator(function (obj) {
(0, _expect["default"])(obj).toEqual(validatedObject);
(0, _expect.default)(obj).toEqual(validatedObject);
return errorArray;

@@ -971,3 +971,3 @@ });

context.validate(validatedObject);
(0, _expect["default"])(context.validationErrors()).toEqual(errorArray); // Don't mess up other tests
(0, _expect.default)(context.validationErrors()).toEqual(errorArray); // Don't mess up other tests

@@ -989,3 +989,3 @@ _SimpleSchema.SimpleSchema._docValidators = [];

schema.addDocValidator(function (obj) {
(0, _expect["default"])(obj).toEqual(validatedObject);
(0, _expect.default)(obj).toEqual(validatedObject);
return errorArray;

@@ -995,3 +995,3 @@ });

context.validate(validatedObject);
(0, _expect["default"])(context.validationErrors()).toEqual(errorArray);
(0, _expect.default)(context.validationErrors()).toEqual(errorArray);
});

@@ -1007,3 +1007,3 @@ it('sets _objectKeys', function () {

});
(0, _expect["default"])(schema._objectKeys).toEqual({
(0, _expect.default)(schema._objectKeys).toEqual({
'a.': ['b'],

@@ -1029,4 +1029,4 @@ 'a.b.': ['c'],

});
(0, _expect["default"])(schema.objectKeys('a')).toEqual(['b']);
(0, _expect["default"])(schema.objectKeys('a.b')).toEqual(['c']);
(0, _expect.default)(schema.objectKeys('a')).toEqual(['b']);
(0, _expect.default)(schema.objectKeys('a.b')).toEqual(['c']);
});

@@ -1058,5 +1058,5 @@ it('gets schema property by key', function () {

});
(0, _expect["default"])(schema.get('a', 'defaultValue')).toBe(undefined);
(0, _expect["default"])(schema.get('a.b', 'defaultValue')).toBe('ab');
(0, _expect["default"])(schema.get('a.d', 'maxCount')).toBe(3);
(0, _expect.default)(schema.get('a', 'defaultValue')).toBe(undefined);
(0, _expect.default)(schema.get('a.b', 'defaultValue')).toBe('ab');
(0, _expect.default)(schema.get('a.d', 'maxCount')).toBe(3);
});

@@ -1079,9 +1079,9 @@ it('exposes defaultValue for a key', function () {

});
(0, _expect["default"])(schema.defaultValue('a')).toBe(undefined);
(0, _expect["default"])(schema.defaultValue('a.b')).toBe('ab');
(0, _expect["default"])(schema.defaultValue('a.b.c')).toBe('abc');
(0, _expect.default)(schema.defaultValue('a')).toBe(undefined);
(0, _expect.default)(schema.defaultValue('a.b')).toBe('ab');
(0, _expect.default)(schema.defaultValue('a.b.c')).toBe('abc');
});
it('issue #232', function () {
var foo;
(0, _expect["default"])(function () {
(0, _expect.default)(function () {
var schema3 = new _SimpleSchema.SimpleSchema({

@@ -1104,3 +1104,3 @@ foo: String

}).toNotThrow();
(0, _expect["default"])(foo instanceof _SimpleSchema.SimpleSchema).toBe(true);
(0, _expect.default)(foo instanceof _SimpleSchema.SimpleSchema).toBe(true);
});

@@ -1122,3 +1122,3 @@ describe('SimpleSchema.Any', function () {

it("on it's own", function () {
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
testAny: type

@@ -1128,3 +1128,3 @@ });

it('as a nested key', function () {
(0, _expectValid4["default"])(new _SimpleSchema.SimpleSchema({
(0, _expectValid4.default)(new _SimpleSchema.SimpleSchema({
testNested: schema

@@ -1147,3 +1147,3 @@ }), {

it("can be used for ".concat(mod, " modifiers"), function () {
(0, _expectValid4["default"])(schema, _defineProperty({}, mod, {
(0, _expectValid4.default)(schema, _defineProperty({}, mod, {
testAny: 3.1415

@@ -1158,3 +1158,3 @@ }), {

});
(0, _expectValid4["default"])(parentSchema, _defineProperty({}, mod, {
(0, _expectValid4.default)(parentSchema, _defineProperty({}, mod, {
parent: {

@@ -1171,3 +1171,3 @@ testAny: 3.1415

});
(0, _expectValid4["default"])(parentSchema, _defineProperty({}, mod, {
(0, _expectValid4.default)(parentSchema, _defineProperty({}, mod, {
'parent.testAny': 3.1415

@@ -1183,3 +1183,3 @@ }), {

it('can be used for $unset modifiers', function () {
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED, schema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED, schema, {
$unset: {

@@ -1196,3 +1196,3 @@ testAny: 1

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED, parentSchema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED, parentSchema, {
$unset: {

@@ -1209,3 +1209,3 @@ parent: 1

});
(0, _expectErrorOfTypeLength["default"])(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED, parentSchema, {
(0, _expectErrorOfTypeLength.default)(_SimpleSchema.SimpleSchema.ErrorTypes.REQUIRED, parentSchema, {
$unset: {

@@ -1221,3 +1221,3 @@ 'parent.testAny': 1

it('can be used for $addToSet modifiers', function () {
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
$addToSet: {

@@ -1234,3 +1234,3 @@ testAny: 1

});
(0, _expectValid4["default"])(parentSchema, {
(0, _expectValid4.default)(parentSchema, {
$addToSet: {

@@ -1246,3 +1246,3 @@ 'parent.testAny': 3.1415

it('can be used for $push modifiers', function () {
(0, _expectValid4["default"])(schema, {
(0, _expectValid4.default)(schema, {
$push: {

@@ -1259,3 +1259,3 @@ testAny: 1

});
(0, _expectValid4["default"])(parentSchema, {
(0, _expectValid4.default)(parentSchema, {
$push: {

@@ -1262,0 +1262,0 @@ 'parent.testAny': 3.1415

@@ -6,10 +6,8 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _mongoObject = _interopRequireDefault(require("mongo-object"));
var _extend2 = _interopRequireDefault(require("extend"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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; } }

@@ -29,2 +27,8 @@

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; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -47,3 +51,5 @@

this.definitions = definitions.map(function (definition) {
if (_mongoObject["default"].isBasicObject(definition)) return (0, _extend2["default"])(true, {}, definition);
if (_mongoObject.default.isBasicObject(definition)) {
return _objectSpread({}, definition);
}

@@ -75,3 +81,3 @@ if (definition instanceof RegExp) {

if (!otherDef) return def;
return (0, _extend2["default"])(true, {}, def, otherDef);
return _objectSpread({}, def, {}, otherDef);
});

@@ -90,4 +96,4 @@ }

var _default = SimpleSchemaGroup;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -47,2 +47,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

value: function typeName() {
// eslint-disable-line class-methods-use-this
return 'Address';

@@ -64,4 +65,4 @@ }

var _default = Address;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,12 +6,12 @@ "use strict";

});
exports["default"] = expectErrorLength;
exports.default = expectErrorLength;
var _expect = _interopRequireDefault(require("expect"));
var _validate = _interopRequireDefault(require("./validate"));
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function expectErrorLength() {
return (0, _expect["default"])(_validate["default"].apply(void 0, arguments).validationErrors().length);
return (0, _expect.default)(_validate.default.apply(void 0, arguments).validationErrors().length);
}

@@ -18,0 +18,0 @@

@@ -6,10 +6,10 @@ "use strict";

});
exports["default"] = expectErrorOfTypeLength;
exports.default = expectErrorOfTypeLength;
var _expect = _interopRequireDefault(require("expect"));
var _validate = _interopRequireDefault(require("./validate"));
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function expectErrorOfTypeLength(type) {

@@ -20,3 +20,3 @@ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

var errors = _validate["default"].apply(void 0, args).validationErrors();
var errors = _validate.default.apply(void 0, args).validationErrors();

@@ -27,3 +27,3 @@ var errorCount = 0;

});
return (0, _expect["default"])(errorCount);
return (0, _expect.default)(errorCount);
}

@@ -30,0 +30,0 @@

@@ -6,14 +6,14 @@ "use strict";

});
exports["default"] = expectRequiredErrorLength;
exports.default = expectRequiredErrorLength;
var _expect = _interopRequireDefault(require("expect"));
var _validate = _interopRequireDefault(require("./validate"));
var _expect = _interopRequireDefault(require("expect"));
var _SimpleSchema = require("../SimpleSchema");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function expectRequiredErrorLength() {
var errors = _validate["default"].apply(void 0, arguments).validationErrors();
var errors = _validate.default.apply(void 0, arguments).validationErrors();

@@ -24,3 +24,3 @@ var requiredErrorCount = 0;

});
return (0, _expect["default"])(requiredErrorCount);
return (0, _expect.default)(requiredErrorCount);
}

@@ -27,0 +27,0 @@

@@ -6,12 +6,12 @@ "use strict";

});
exports["default"] = expectValid;
exports.default = expectValid;
var _expect = _interopRequireDefault(require("expect"));
var _validate = _interopRequireDefault(require("./validate"));
var _expect = _interopRequireDefault(require("expect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function expectValid() {
(0, _expect["default"])(_validate["default"].apply(void 0, arguments).isValid()).toBe(true);
(0, _expect.default)(_validate.default.apply(void 0, arguments).isValid()).toBe(true);
}

@@ -18,0 +18,0 @@

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -63,4 +63,4 @@ var _SimpleSchema = require("../SimpleSchema");

var _default = friendsSchema;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -21,4 +21,4 @@ var _SimpleSchema = require("../SimpleSchema");

var _default = optionalCustomSchema;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -34,4 +34,4 @@ var _SimpleSchema = require("../SimpleSchema");

var _default = requiredCustomSchema;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -56,4 +56,4 @@ var _SimpleSchema = require("../SimpleSchema");

var _default = requiredSchema;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -15,3 +15,3 @@ var _SimpleSchema = require("../SimpleSchema");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -62,3 +62,3 @@ var testSchema = new _SimpleSchema.SimpleSchema({

},
"boolean": {
boolean: {
type: Boolean,

@@ -191,3 +191,3 @@ optional: true

customObject: {
type: _Address["default"],
type: _Address.default,
optional: true,

@@ -208,4 +208,4 @@ blackbox: true

var _default = testSchema;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = validate;
exports.default = validate;

@@ -9,0 +9,0 @@ function validate(ss, doc, options) {

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = appendAffectedKey;
exports.default = appendAffectedKey;

@@ -9,0 +9,0 @@ function appendAffectedKey(affectedKey, key) {

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = dateToDateString;
exports.default = dateToDateString;

@@ -9,0 +9,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = forEachKeyAncestor;
exports.default = forEachKeyAncestor;

@@ -9,0 +9,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = getKeysWithValueInObj;
exports.default = getKeysWithValueInObj;

@@ -9,0 +9,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = getLastPartOfKey;
exports.default = getLastPartOfKey;

@@ -9,0 +9,0 @@ /**

@@ -7,3 +7,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -13,7 +13,7 @@ /* eslint-disable func-names, prefer-arrow-callback */

it('returns the correct string for a non-array key', function () {
(0, _expect["default"])((0, _getLastPartOfKey["default"])('a.b.c', 'a')).toBe('b.c');
(0, _expect.default)((0, _getLastPartOfKey.default)('a.b.c', 'a')).toBe('b.c');
});
it('returns the correct string for an array key', function () {
(0, _expect["default"])((0, _getLastPartOfKey["default"])('a.b.$.c', 'a.b')).toBe('c');
(0, _expect.default)((0, _getLastPartOfKey.default)('a.b.$.c', 'a.b')).toBe('c');
});
});

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = getParentOfKey;
exports.default = getParentOfKey;

@@ -9,0 +9,0 @@ /**

@@ -9,3 +9,3 @@ "use strict";

get: function get() {
return _appendAffectedKey["default"];
return _appendAffectedKey.default;
}

@@ -16,3 +16,3 @@ });

get: function get() {
return _dateToDateString["default"];
return _dateToDateString.default;
}

@@ -23,3 +23,3 @@ });

get: function get() {
return _forEachKeyAncestor["default"];
return _forEachKeyAncestor.default;
}

@@ -30,3 +30,3 @@ });

get: function get() {
return _getKeysWithValueInObj["default"];
return _getKeysWithValueInObj.default;
}

@@ -37,3 +37,3 @@ });

get: function get() {
return _getLastPartOfKey["default"];
return _getLastPartOfKey.default;
}

@@ -44,9 +44,15 @@ });

get: function get() {
return _getParentOfKey["default"];
return _getParentOfKey.default;
}
});
Object.defineProperty(exports, "isEmptyObject", {
enumerable: true,
get: function get() {
return _isEmptyObject.default;
}
});
Object.defineProperty(exports, "isObjectWeShouldTraverse", {
enumerable: true,
get: function get() {
return _isObjectWeShouldTraverse["default"];
return _isObjectWeShouldTraverse.default;
}

@@ -57,3 +63,3 @@ });

get: function get() {
return _looksLikeModifier["default"];
return _looksLikeModifier.default;
}

@@ -74,2 +80,4 @@ });

var _isEmptyObject = _interopRequireDefault(require("./isEmptyObject"));
var _isObjectWeShouldTraverse = _interopRequireDefault(require("./isObjectWeShouldTraverse"));

@@ -79,2 +87,2 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = isObjectWeShouldTraverse;
exports.default = isObjectWeShouldTraverse;

@@ -9,0 +9,0 @@ function isObjectWeShouldTraverse(val) {

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = looksLikeModifier;
exports.default = looksLikeModifier;

@@ -9,0 +9,0 @@ /**

@@ -6,10 +6,6 @@ "use strict";

});
exports["default"] = allowedValuesValidator;
exports.default = allowedValuesValidator;
var _SimpleSchema = require("../SimpleSchema");
var _lodash = _interopRequireDefault(require("lodash.includes"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function allowedValuesValidator() {

@@ -24,3 +20,3 @@ if (!this.valueShouldBeChecked) return;

} else {
isAllowed = (0, _lodash["default"])(allowedValues, this.value);
isAllowed = allowedValues.includes(this.value);
}

@@ -27,0 +23,0 @@

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = requiredValidator;
exports.default = requiredValidator;

@@ -9,0 +9,0 @@ var _SimpleSchema = require("../SimpleSchema");

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = doArrayChecks;
exports.default = doArrayChecks;

@@ -9,0 +9,0 @@ var _SimpleSchema = require("../../SimpleSchema");

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = doDateChecks;
exports.default = doDateChecks;

@@ -9,0 +9,0 @@ var _SimpleSchema = require("../../SimpleSchema");

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = doNumberChecks;
exports.default = doNumberChecks;

@@ -26,5 +26,5 @@ var _SimpleSchema = require("../../SimpleSchema");

if (op !== '$inc' && def.max !== null && (!!def.exclusiveMax ? def.max <= keyValue : def.max < keyValue)) {
if (op !== '$inc' && def.max !== null && (def.exclusiveMax ? def.max <= keyValue : def.max < keyValue)) {
return {
type: !!def.exclusiveMax ? _SimpleSchema.SimpleSchema.ErrorTypes.MAX_NUMBER_EXCLUSIVE : _SimpleSchema.SimpleSchema.ErrorTypes.MAX_NUMBER,
type: def.exclusiveMax ? _SimpleSchema.SimpleSchema.ErrorTypes.MAX_NUMBER_EXCLUSIVE : _SimpleSchema.SimpleSchema.ErrorTypes.MAX_NUMBER,
max: def.max

@@ -35,5 +35,5 @@ };

if (op !== '$inc' && def.min !== null && (!!def.exclusiveMin ? def.min >= keyValue : def.min > keyValue)) {
if (op !== '$inc' && def.min !== null && (def.exclusiveMin ? def.min >= keyValue : def.min > keyValue)) {
return {
type: !!def.exclusiveMin ? _SimpleSchema.SimpleSchema.ErrorTypes.MIN_NUMBER_EXCLUSIVE : _SimpleSchema.SimpleSchema.ErrorTypes.MIN_NUMBER,
type: def.exclusiveMin ? _SimpleSchema.SimpleSchema.ErrorTypes.MIN_NUMBER_EXCLUSIVE : _SimpleSchema.SimpleSchema.ErrorTypes.MIN_NUMBER,
min: def.min

@@ -40,0 +40,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = doStringChecks;
exports.default = doStringChecks;

@@ -9,0 +9,0 @@ var _SimpleSchema = require("../../SimpleSchema");

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = typeValidator;
exports.default = typeValidator;

@@ -19,3 +19,3 @@ var _SimpleSchema = require("../../SimpleSchema");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -28,5 +28,5 @@ function typeValidator() {

var op = this.operator;
if (expectedType === String) return (0, _doStringChecks["default"])(def, keyValue);
if (expectedType === Number) return (0, _doNumberChecks["default"])(def, keyValue, op, false);
if (expectedType === _SimpleSchema.SimpleSchema.Integer) return (0, _doNumberChecks["default"])(def, keyValue, op, true);
if (expectedType === String) return (0, _doStringChecks.default)(def, keyValue);
if (expectedType === Number) return (0, _doNumberChecks.default)(def, keyValue, op, false);
if (expectedType === _SimpleSchema.SimpleSchema.Integer) return (0, _doNumberChecks.default)(def, keyValue, op, true);

@@ -51,3 +51,3 @@ if (expectedType === Boolean) {

if (expectedType === Array) return (0, _doArrayChecks["default"])(def, keyValue);
if (expectedType === Array) return (0, _doArrayChecks.default)(def, keyValue);

@@ -61,3 +61,3 @@ if (expectedType instanceof Function) {

if (expectedType === Date) return (0, _doDateChecks["default"])(def, keyValue);
if (expectedType === Date) return (0, _doDateChecks.default)(def, keyValue);
}

@@ -64,0 +64,0 @@ }

@@ -6,12 +6,10 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _mongoObject = _interopRequireDefault(require("mongo-object"));
var _doValidation = _interopRequireDefault(require("./doValidation.js"));
var _doValidation = _interopRequireDefault(require("./doValidation"));
var _lodash = _interopRequireDefault(require("lodash.findwhere"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -51,5 +49,5 @@

value: function _markKeyChanged(key) {
var genericKey = _mongoObject["default"].makeKeyGeneric(key);
var genericKey = _mongoObject.default.makeKeyGeneric(key);
if (this._deps.hasOwnProperty(genericKey)) this._deps[genericKey].changed();
if (Object.prototype.hasOwnProperty.call(this._deps, genericKey)) this._deps[genericKey].changed();
}

@@ -106,9 +104,11 @@ }, {

value: function getErrorForKey(key) {
var genericKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _mongoObject["default"].makeKeyGeneric(key);
var genericKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _mongoObject.default.makeKeyGeneric(key);
var errors = this._validationErrors;
return (0, _lodash["default"])(errors, {
name: key
}) || (0, _lodash["default"])(errors, {
name: genericKey
var errorForKey = errors.find(function (error) {
return error.name === key;
});
if (errorForKey) return errorForKey;
return errors.find(function (error) {
return error.name === genericKey;
});
}

@@ -124,4 +124,4 @@ }, {

value: function keyIsInvalid(key) {
var genericKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _mongoObject["default"].makeKeyGeneric(key);
if (this._deps.hasOwnProperty(genericKey)) this._deps[genericKey].depend();
var genericKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _mongoObject.default.makeKeyGeneric(key);
if (Object.prototype.hasOwnProperty.call(this._deps, genericKey)) this._deps[genericKey].depend();
return this._keyIsInvalid(key, genericKey);

@@ -132,4 +132,4 @@ }

value: function keyErrorMessage(key) {
var genericKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _mongoObject["default"].makeKeyGeneric(key);
if (this._deps.hasOwnProperty(genericKey)) this._deps[genericKey].depend();
var genericKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _mongoObject.default.makeKeyGeneric(key);
if (Object.prototype.hasOwnProperty.call(this._deps, genericKey)) this._deps[genericKey].depend();
var errorObj = this.getErrorForKey(key, genericKey);

@@ -158,3 +158,3 @@ if (!errorObj) return '';

var validationErrors = (0, _doValidation["default"])({
var validationErrors = (0, _doValidation.default)({
extendedCustomContext: extendedCustomContext,

@@ -175,2 +175,4 @@ ignoreTypes: ignoreTypes,

// we should keep these errors.
/* eslint-disable no-restricted-syntax */
var _iteratorNormalCompletion = true;

@@ -192,2 +194,4 @@ var _didIteratorError = false;

}
/* eslint-enable no-restricted-syntax */
} catch (err) {

@@ -198,4 +202,4 @@ _didIteratorError = true;

try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}

@@ -238,4 +242,4 @@ } finally {

exports["default"] = ValidationContext;
exports.default = ValidationContext;
module.exports = exports.default;
module.exports.default = exports.default;
{
"name": "simpl-schema",
"version": "1.5.9",
"version": "1.6.0",
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.",

@@ -21,2 +21,3 @@ "author": "Eric Dobbertin <aldeed@gmail.com>",

"main": "./dist/main.js",
"browserslist": "> 0.5%, last 2 versions, Firefox ESR, not dead",
"scripts": {

@@ -34,14 +35,4 @@ "build": "rm -rf dist/** && babel lib --out-dir dist --ignore *.tests.js,testHelpers/*",

"clone": "^2.1.2",
"extend": "^3.0.2",
"lodash.every": "^4.6.0",
"lodash.find": "^4.6.0",
"lodash.findwhere": "^3.1.0",
"lodash.includes": "^4.3.0",
"lodash.isempty": "^4.4.0",
"lodash.isobject": "^3.0.2",
"lodash.omit": "^4.5.0",
"lodash.pick": "^4.4.0",
"lodash.union": "^4.6.0",
"lodash.uniq": "^4.5.0",
"message-box": "^0.2.2",
"deep-extend": "^0.6.0",
"message-box": "^0.2.3",
"mongo-object": "^0.1.4"

@@ -61,6 +52,5 @@ },

"eslint": "^6.8.0",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.7.0",
"eslint-plugin-jsx-a11y": "^1.5.3",
"eslint-plugin-react": "^5.2.2",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
"expect": "^1.20.1",

@@ -89,3 +79,6 @@ "mocha": "^7.1.1"

"eslintConfig": {
"extends": "airbnb",
"extends": [
"airbnb-base",
"plugin:you-dont-need-lodash-underscore/compatible"
],
"parser": "babel-eslint",

@@ -99,4 +92,9 @@ "env": {

"consistent-return": 0,
"import/no-cycle": 0,
"import/no-extraneous-dependencies": 0,
"max-len": 0,
"no-continue": 0,
"no-param-reassign": 0,
"no-plusplus": 0,
"no-restricted-globals": 0,
"no-underscore-dangle": 0,

@@ -110,7 +108,5 @@ "no-useless-escape": 0,

"no-console": 0,
"space-before-function-paren": 0,
"react/prefer-stateless-function": 0,
"react/no-multi-comp": 0
"space-before-function-paren": 0
}
}
}

@@ -756,11 +756,16 @@ # SimpleSchema (simpl-schema NPM package)

- `this.key`: The schema key for which the autoValue is running. This is usually known, but if your autoValue function is shared among various keys or if your schema is used as a subschema in another schema, this can be useful.
- `this.closestSubschemaFieldName`: If your schema is used as a subschema in another schema, this will be set to the name of the key that references the schema. Otherwise it will be `null`.
- `this.field()`: Use this method to get information about other fields. Pass a field name (schema key) as the only argument. The return object will have `isSet`, `value`, and `operator` properties for that field.
- `this.genericKey`: The generic schema key for which the autoValue is running (`$` in place of actual array index).
- `this.isInArrayItemObject`: True if we're traversing an object that's in an array.
- `this.isInSubObject`: True if we're traversing an object that's somewhere within another object.
- `this.isModifier`: True if this is running on a MongoDB modifier object.
- `this.isSet`: True if the field is already set in the document or modifier
- `this.key`: The schema key for which the autoValue is running. This is usually known, but if your autoValue function is shared among various keys or if your schema is used as a subschema in another schema, this can be useful.
- `this.obj`: The full object.
- `this.operator`: If isSet = true and isUpdate = true, this contains the name of the update operator in the modifier in which this field is being changed. For example, if the modifier were `{$set: {name: "Alice"}}`, in the autoValue function for the `name` field, `this.isSet` would be true, `this.value` would be "Alice", and `this.operator` would be "$set".
- `this.parentField()`: Use this method to get information about the parent object. Works the same way as `field()`.
- `this.siblingField()`: Use this method to get information about other fields that have the same parent object. Works the same way as `field()`. This is helpful when you use sub-schemas or when you're dealing with arrays of objects.
- `this.unset()`: Call this method to prevent the original value from being used when you return undefined.
- `this.value`: If isSet = true, this contains the field's current (requested) value in the document or modifier.
- `this.operator`: If isSet = true and isUpdate = true, this contains the name of the update operator in the modifier in which this field is being changed. For example, if the modifier were `{$set: {name: "Alice"}}`, in the autoValue function for the `name` field, `this.isSet` would be true, `this.value` would be "Alice", and `this.operator` would be "$set".
- `this.field()`: Use this method to get information about other fields. Pass a field name (schema key) as the only argument. The return object will have `isSet`, `value`, and `operator` properties for that field.
- `this.siblingField()`: Use this method to get information about other fields that have the same parent object. Works the same way as `field()`. This is helpful when you use sub-schemas or when you're dealing with arrays of objects.
- `this.parentField()`: Use this method to get information about the parent object. Works the same way as `field()`.

@@ -780,3 +785,14 @@ If an `autoValue` function does not return anything (i.e., returns `undefined`), the field's value will be whatever the document or modifier says it should be. If that field is already in the document or modifier, it stays in the document or modifier with the same value. If it's not in the document or modifier, it's still not there. If you don't want it to be in the doc or modifier, you must call `this.unset()`.

- `this.key`: The schema key for which the function is running. This is usually known, but if your function is shared among various keys or is within an array, or if your schema is used as a subschema in another schema, this can be useful.
- `this.field()`: Use this method to get information about other fields. Pass a field name (schema key) as the only argument. The return object will have `isSet`, `value`, and `operator` properties for that field.
- `this.genericKey`: The generic schema key for which the autoValue is running (`$` in place of actual array index).
- `this.isInArrayItemObject`: True if we're traversing an object that's in an array.
- `this.isInSubObject`: True if we're traversing an object that's somewhere within another object.
- `this.isModifier`: True if this is running on a MongoDB modifier object.
- `this.isSet`: True if the field is already set in the document or modifier
- `this.key`: The schema key for which the autoValue is running. This is usually known, but if your autoValue function is shared among various keys or if your schema is used as a subschema in another schema, this can be useful.
- `this.obj`: The full object.
- `this.operator`: If isSet = true and isUpdate = true, this contains the name of the update operator in the modifier in which this field is being changed. For example, if the modifier were `{$set: {name: "Alice"}}`, in the autoValue function for the `name` field, `this.isSet` would be true, `this.value` would be "Alice", and `this.operator` would be "$set".
- `this.parentField()`: Use this method to get information about the parent object. Works the same way as `field()`.
- `this.siblingField()`: Use this method to get information about other fields that have the same parent object. Works the same way as `field()`. This is helpful when you use sub-schemas or when you're dealing with arrays of objects.
- `this.value`: If isSet = true, this contains the field's current (requested) value in the document or modifier.

@@ -993,2 +1009,13 @@ ### Getting field properties

Whole-document validators have the following available on `this` context:
- `this.ignoreTypes`: The value of the `ignore` option that was passed to `validate`.
- `this.isModifier`: True if this is running on a MongoDB modifier object.
- `this.isUpsert`: True if this is running on a MongoDB modifier object that is for an upsert.
- `this.keysToValidate`: The value of the `keys` option that was passed to `validate`.
- `this.mongoObject`: The `MongoObject` instance.
- `this.obj`: The full object.
- `this.schema`: The schema instance.
- `this.validationContext`: The `ValidationContext` instance.
### Manually Adding a Validation Error

@@ -995,0 +1022,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