async-validator
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -21,14 +21,4 @@ 'use strict'; | ||
var _lodash = require('lodash.mergewith'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function mergeCustomizer(objValue, srcValue) { | ||
if ((typeof objValue === 'undefined' ? 'undefined' : _typeof(objValue)) !== 'object') { | ||
return srcValue; | ||
} | ||
} | ||
/** | ||
@@ -49,3 +39,3 @@ * Encapsulates a validation schema. | ||
if (_messages) { | ||
this._messages = (0, _lodash2["default"])((0, _messages2.newMessages)(), _messages, mergeCustomizer); | ||
this._messages = (0, _util.deepMerge)((0, _messages2.newMessages)(), _messages); | ||
} | ||
@@ -79,5 +69,2 @@ return this._messages; | ||
var options = o; | ||
if (!this.rules) { | ||
throw new Error('Cannot validate with no rules.'); | ||
} | ||
var callback = oc; | ||
@@ -88,2 +75,8 @@ if (typeof options === 'function') { | ||
} | ||
if (!this.rules || Object.keys(this.rules).length === 0) { | ||
if (callback) { | ||
callback(); | ||
} | ||
return; | ||
} | ||
function complete(results) { | ||
@@ -124,3 +117,3 @@ var i = void 0; | ||
} | ||
(0, _lodash2["default"])(messages, options.messages, mergeCustomizer); | ||
(0, _util.deepMerge)(messages, options.messages); | ||
options.messages = messages; | ||
@@ -127,0 +120,0 @@ } else { |
@@ -6,2 +6,7 @@ 'use strict'; | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
exports.warning = warning; | ||
@@ -13,2 +18,3 @@ exports.format = format; | ||
exports.complementError = complementError; | ||
exports.deepMerge = deepMerge; | ||
var formatRegExp = /%[sdj%]/g; | ||
@@ -187,2 +193,18 @@ | ||
}; | ||
} | ||
function deepMerge(target, source) { | ||
if (source) { | ||
for (var s in source) { | ||
if (source.hasOwnProperty(s)) { | ||
var value = source[s]; | ||
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(target[s]) === 'object') { | ||
target[s] = _extends({}, target[s], value); | ||
} else { | ||
target[s] = value; | ||
} | ||
} | ||
} | ||
} | ||
return target; | ||
} |
{ | ||
"name": "async-validator", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "validate form asynchronous", | ||
@@ -46,6 +46,3 @@ "keywords": [ | ||
"lint" | ||
], | ||
"dependencies": { | ||
"lodash.mergewith": "4.x" | ||
} | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56231
0
1188
- Removedlodash.mergewith@4.x
- Removedlodash.mergewith@4.6.2(transitive)