Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
userSchema.methods.validPassword = function (password) {
return bcrypt
.compareAsync(password, this.password)
.then((result, err) => {
/* istanbul ignore if */
if (err) throw new Error(err);
return result;
});
};