I removed exactly three words from the code. Very helpful
const { createHash } = require("node:crypto"); const databaseUser = [ { email: "tvorchesky@mail.com", password: "6827ef24aa9c59195dc19cbc2b597f6d" /* password nya adalah Taralolet123, udah di enkripsi pakai MD5 */, }, ]; const md5 = (value) => createHash("md5").update(value).digest("hex"); function login(userEmail, userPassword) { return Boolean( databaseUser.find( ({ email, password }) => userEmail === email && password === md5(userPassword) ) ); }
const crypto = require("node:crypto");- const { createHash } = require("node:crypto");
- const databaseUser = [
- {
- email: "tvorchesky@mail.com",
- password:
- "6827ef24aa9c59195dc19cbc2b597f6d" /* password nya adalah Taralolet123, udah di enkripsi pakai MD5 */,
- },
- ];
const md5 = (value) => crypto.createHash("md5").update(value).digest("hex");- const md5 = (value) => createHash("md5").update(value).digest("hex");
- function login(userEmail, userPassword) {
const isExists = databaseUser.find(({ email, password }) =>userEmail === email && password === md5(userPassword),- return Boolean(
- databaseUser.find(
- ({ email, password }) =>
- userEmail === email && password === md5(userPassword)
- )
- );
return Boolean(isExists);- }