diff --git a/lib/id-validator.js b/lib/id-validator.js index 65ad962..388dbf5 100644 --- a/lib/id-validator.js +++ b/lib/id-validator.js @@ -71,7 +71,7 @@ IdValidator.prototype.validateSchema = function ( if (!(self instanceof IdValidator) || self.enabled) { if (Object.keys(conditionsCopy).length > 0) { var instance = this - + conditionsCopy = clone(conditions) traverse(conditionsCopy).forEach(function (value) { if (typeof value === 'function') { @@ -79,7 +79,7 @@ IdValidator.prototype.validateSchema = function ( } }) } - + return validateFunction(this, connection, refModelName, value, conditionsCopy, resolve, reject, allowDuplicates) } @@ -102,7 +102,7 @@ function executeQuery (query, conditions, validateValue, resolve, reject) { reject(err) return } - return count === validateValue ? resolve(true) : reject(false) + return count === validateValue ? resolve(true) : resolve(false) }) }