function sanitize (form) {
  let keys = Object.keys(form);
  let val = keys.filter((k) => form[k] !== '' );
  if(keys.length == val.length)
    return true
  return false
};

function authenticate(username, password) {
  if(username === 'alen' && password === 'thomas')
    return true
  return false
}

function displayError(errMsg, errData) {
  if (errData)
    return {error_message: errMsg, data: errData}
  return {error_message: errMsg}
}

const utilFuns = {
  sanitize: sanitize,
  authenticate: authenticate,
  displayError: displayError
}

module.exports = utilFuns;

@@ -1,16 +1,47 @@
+let bcrypt = require('bcrypt')%0A
 function sanitiz
@@ -81,17 +81,16 @@
 ys(form)
-;
 %0A  let v
@@ -131,16 +131,15 @@
 = ''
- );
+)
 %0A  if
+ 
 (key
@@ -161,20 +161,18 @@
 .length)
-%0A  
  
+%7B
  return 
@@ -167,32 +167,34 @@
 h) %7B return true
+ %7D
 %0A  return false%0A
@@ -218,16 +218,17 @@
 enticate
+ 
 (usernam
@@ -246,16 +246,17 @@
 ) %7B%0A  if
+ 
 (usernam
@@ -293,20 +293,18 @@
 thomas')
-%0A  
  
+%7B
  return 
@@ -307,16 +307,18 @@
 urn true
+ %7D
 %0A  retur
@@ -349,16 +349,17 @@
 layError
+ 
 (errMsg,
@@ -388,12 +388,10 @@
 ata)
-%0A  
  
+%7B
  ret
@@ -432,16 +432,18 @@
 errData%7D
+ %7D
 %0A  retur
@@ -470,16 +470,242 @@
 rMsg%7D%0A%7D%0A
+function hashPassword (password) %7B%0A  let salt = bcrypt.genSaltSync(10)%0A  let hash = bcrypt.hashSync(password, salt)%0A  return hash%0A%7D%0Afunction compareHash (password, hash) %7B%0A  return bcrypt.compareSync(password, hash) === true%0A%7D
 %0Aconst u
@@ -825,10 +825,9 @@
 utilFuns
-;
 %0A

Add hashing support