title: bcrypt.compare cb is not a function error
body: <p>I'm using passport-local and I've already hashed my passwords in my mongo database. I can't figure out why my bcrypt.compare() isn't working correctly. It says 'cb is not a function' but it is. I just saved the callback as a variable in the same file instead of saving it in my User schema. Anyone ran across this problem before or see any errors in my code??</p>
  
  <pre><code>passport.use(new LocalStrategy((username, password, done) =&gt; {
  User.findOne({ username: username }).exec().then((user, err) =&gt; {
  if (err) return done(err)
  if (!user) return done(null, false, { message: 'Incorrect username.' })
  
  const comparePassword = function (candidatePassword, hashedPassword, cb) {
    bcrypt.compare(candidatePassword, hashedPassword, function (err, isMatch) {
      if (err) return cb(err)
      return cb(null, isMatch)
    })
  }
   comparePassword(password, user.password, function (err, isMatch) {
     if (err) return done(err)
     if (!isMatch) return done(null, false, { message: 'Incorrect password.' })
     return done(null, user)
   })
  })
  }))
  </code></pre>