simpl-schema
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -147,4 +147,5 @@ "use strict"; | ||
var type = def.type, | ||
definitionWithoutType = _objectWithoutProperties(def, ["type"]); | ||
definitionWithoutType = _objectWithoutProperties(def, ["type"]); // eslint-disable-line no-unused-vars | ||
var finalValidatorContext = _objectSpread({}, validatorContext, { | ||
@@ -151,0 +152,0 @@ // Take outer definition props like "optional" and "label" |
@@ -23,3 +23,23 @@ "use strict"; | ||
var rxWeakDomain = "(?:".concat([rxNameDomain, rxIPv4, rxIPv6].join('|'), ")"); | ||
var rxWeakDomain = "(?:".concat([rxNameDomain, rxIPv4, rxIPv6].join('|'), ")"); // unique id from the random package also used by minimongo | ||
// min and max are used to set length boundaries | ||
// set both for explicit lower and upper bounds | ||
// set min as integer and max to null for explicit lower bound and arbitrary upper bound | ||
// set none for arbitrary length | ||
// set only min for fixed length | ||
// character list: https://github.com/meteor/meteor/blob/release/0.8.0/packages/random/random.js#L88 | ||
// string length: https://github.com/meteor/meteor/blob/release/0.8.0/packages/random/random.js#L143 | ||
var isValidBound = function isValidBound(value, lower) { | ||
return !value || Number.isSafeInteger(value) && value > lower; | ||
}; | ||
var idOfLength = function idOfLength(min, max) { | ||
if (!isValidBound(min, 0)) throw new Error("Expected a non-negative safe integer, got ".concat(min)); | ||
if (!isValidBound(max, min)) throw new Error("Expected a non-negative safe integer greater than 1 and greater than min, got ".concat(max)); | ||
var bounds; | ||
if (min && max) bounds = "".concat(min, ",").concat(max);else if (min && max === null) bounds = "".concat(min, ",");else if (min && !max) bounds = "".concat(min);else if (!min && !max) bounds = '0,';else throw new Error("Unexpected state for min (".concat(min, ") and max (").concat(max, ")")); | ||
return new RegExp("^[23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz]{".concat(bounds, "}$")); | ||
}; | ||
var regEx = { | ||
@@ -40,6 +60,5 @@ // We use the RegExp suggested by W3C in http://www.w3.org/TR/html5/forms.html#valid-e-mail-address | ||
Url: /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/i, | ||
// unique id from the random package also used by minimongo | ||
// character list: https://github.com/meteor/meteor/blob/release/0.8.0/packages/random/random.js#L88 | ||
// string length: https://github.com/meteor/meteor/blob/release/0.8.0/packages/random/random.js#L143 | ||
Id: /^[23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz]{17}$/, | ||
// default id is defined with exact 17 chars of length | ||
Id: idOfLength(17), | ||
idOfLength: idOfLength, | ||
// allows for a 5 digit zip code followed by a whitespace or dash and then 4 more digits | ||
@@ -46,0 +65,0 @@ // matches 11111 and 11111-1111 and 11111 1111 |
@@ -16,4 +16,2 @@ "use strict"; | ||
var _deepExtend = _interopRequireDefault(require("deep-extend")); | ||
var _messageBox = _interopRequireDefault(require("message-box")); | ||
@@ -550,4 +548,5 @@ | ||
var type = definition.type, | ||
definitionWithoutType = _objectWithoutProperties(definition, ["type"]); | ||
definitionWithoutType = _objectWithoutProperties(definition, ["type"]); // eslint-disable-line no-unused-vars | ||
_this8._schema[fieldName] = _objectSpread({}, _this8._schema[fieldName], {}, definitionWithoutType); | ||
@@ -1021,3 +1020,3 @@ if (definition.type) _this8._schema[fieldName].type.extend(definition.type); | ||
_defineProperty(SimpleSchema, "setDefaultMessages", function (messages) { | ||
(0, _deepExtend.default)(_defaultMessages.default, messages); | ||
(0, _utility.merge)(_defaultMessages.default, messages); | ||
}); | ||
@@ -1024,0 +1023,0 @@ |
@@ -60,2 +60,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "merge", { | ||
enumerable: true, | ||
get: function get() { | ||
return _merge.default; | ||
} | ||
}); | ||
@@ -80,2 +86,4 @@ var _appendAffectedKey = _interopRequireDefault(require("./appendAffectedKey")); | ||
var _merge = _interopRequireDefault(require("./merge")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
{ | ||
"name": "simpl-schema", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.", | ||
@@ -34,4 +34,3 @@ "author": "Eric Dobbertin <aldeed@gmail.com>", | ||
"clone": "^2.1.2", | ||
"deep-extend": "^0.6.0", | ||
"message-box": "^0.2.3", | ||
"message-box": "^0.2.5", | ||
"mongo-object": "^0.1.4" | ||
@@ -83,4 +82,5 @@ }, | ||
"env": { | ||
"node": true, | ||
"mocha": true | ||
"es6": true, | ||
"mocha": true, | ||
"shared-node-browser": true | ||
}, | ||
@@ -87,0 +87,0 @@ "rules": { |
@@ -714,2 +714,5 @@ # SimpleSchema (simpl-schema NPM package) | ||
- `SimpleSchema.RegEx.Id` for IDs generated by `Random.id()` of the random package, also usable to validate a relation id. | ||
- `SimpleSchema.RegEx.idOfLength(min, max)` for IDs generated by `Random.id(length)` where min/max define lower and upper bounds. | ||
Call without params for allowing an arbitrary length. Call with `min` only for fixed length. | ||
Call with `max = null` for fixed lower and arbitrary upper bounds. | ||
- `SimpleSchema.RegEx.ZipCode` for 5- and 9-digit ZIP codes | ||
@@ -716,0 +719,0 @@ - `SimpleSchema.RegEx.Phone` for phone numbers (taken from Google's libphonenumber library) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
197035
3
35
2881
1348
0
- Removeddeep-extend@^0.6.0
- Removeddeep-extend@0.6.0(transitive)
Updatedmessage-box@^0.2.5