31
rated 0 times
[
36]
[
5]
/ answers: 1 / hits: 15350
/ 7 Years ago, sat, october 7, 2017, 12:00:00
I'm looking to create a simple helper function which returns the hash for a given password using bcrypt
but everytime i call the function, it resolves to Promises { <pending> }
what am i doing wrong?
const saltPassword = async (password) => {
const newHash = await bcrypt.hash(password, saltRounds, (err, hash) => {
if (err) return err;
return hash;
});
return await newHash;
}
cheers
More From » async-await