Monday 21 August 2017

Question regarding promises

I saw this code: bcrypt.hash(req.body.password, 10) .then(function(hash){ //do something with hash }) .catch(console.error) }); I know for a fact that bcrypt.hash() will retiher return the hash valueor return an error value. When using promises, how do you know which value bcrypt.hash() will resolve or reject? do all bcrypt methods always resolve the desired value, and reject the error?

Submitted August 21, 2017 at 02:51PM by badboyzpwns

No comments:

Post a Comment