models/User.js
function hashPassword (data) {
  var password = data.password
  var hash = data.hash

  if (password) {
    var salt = bcrypt.genSaltSync(10)
    hash = bcrypt.hashSync(password, salt)
  }

  this.hash = hash
}
function hashPassword (data) {
  var password = data.password
  var hash = data.hash

  if (password) {
    var salt = bcrypt.genSaltSync(10)
    hash = bcrypt.hashSync(password, salt)
  }

  this.hash = hash
}
function hashPassword ( data ) { var password = data . password var hash = data . hash if ( password ) { var salt = bcrypt . genSaltSync ( 10 ) hash = bcrypt . hashSync ( password , salt ) } this . hash = hash }
Hash Password Setter
Hash Password Setter