diff --git a/CHANGELOG.md b/CHANGELOG.md index c9bb85e..ae6b557 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [v1.1.0](https://github.com/uphold/validator.js-validate/releases/tag/v1.1.0) (2017-05-29) +- Add deepRequired option [\#4](https://github.com/uphold/validator.js-validate/pull/4) ([ricardogama](https://github.com/ricardogama)) + ## [v1.0.1](https://github.com/uphold/validator.js-validate/releases/tag/v1.0.1) (2017-05-23) - Fix masking collection elements [\#3](https://github.com/uphold/validator.js-validate/pull/3) ([ricardogama](https://github.com/ricardogama)) diff --git a/dist/index.js b/dist/index.js index b804b99..b5fb4f5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -64,15 +64,17 @@ exports.default = ValidationFailedError => { const validator = new _validator.Validator(); return function (data, constraints) { - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + _ref$deepRequired = _ref.deepRequired; - let groups = _ref.groups; + let deepRequired = _ref$deepRequired === undefined ? true : _ref$deepRequired, + groups = _ref.groups; var _ref$mask = _ref.mask; let mask = _ref$mask === undefined ? true : _ref$mask; var _ref$throws = _ref.throws; let throws = _ref$throws === undefined ? true : _ref$throws; - const constraint = constraints instanceof _validator.Assert ? constraints : new _validator.Constraint(constraints, { deepRequired: true }); + const constraint = constraints instanceof _validator.Assert ? constraints : new _validator.Constraint(constraints, { deepRequired: deepRequired }); const errors = validator.validate(data, constraint, groups); if (errors === true) { diff --git a/package.json b/package.json index f09572d..8425214 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "validator.js-validate", - "version": "1.0.1", + "version": "1.1.0", "description": "Opinionated object validation function based on validator.js", "homepage": "http://uphold.github.io/validator.js-validate", "bugs": "https://github.com/uphold/validator.js-validate/issues",