var bcrypt = require('bcryptjs');

/**
 * Compare a pure password with hashed password
 *
 * @param {string} password Pure password
 * @param {string} hashedPassword Hashed password
 * @return {boolean} result
 *
 * @example
 * var snu = require('s-node-utils');
 *
 * (async () => {
 *   console.log(
 *     await snu.password.compare(
 *       "F@3Ltv{>=q[8T%,",
 *       "$2a$10$OOJ2FlB56wSEhtwvVQxub.hoiWcEzcFsX2ERdNBo3fSXPSoSPK8zW"
 *     )
 *   );
 * })();
 * //=> true
 */
module.exports = function(password, hashedPassword) {
  var result = bcrypt.compare(password, hashedPassword);
  return result;
};
