All files / src/utils hash.js

77.78% Statements 7/9
50% Branches 2/4
100% Functions 4/4
77.78% Lines 7/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201x     29x 29x 29x       29x 29x       29x          
import bcrypt from 'bcryptjs';
 
export default function hasher (password) {
  return new Promise((resolve, reject) => {
    bcrypt.genSalt(10, function (error, salt) {
      Iif (error) {
        return reject(error);
      }
 
      bcrypt.hash(password, salt, function (error, hashedPassword) {
        Iif (error) {
          return reject(error);
        }
 
        resolve(hashedPassword);
      });
    });
  });
}