-
-
Save brunosabot/393fe888dadb25cd11461a01b2b39325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const defaultUser = { role: "user" }; | |
const database = { | |
// ... | |
1234: { name: "Bruno", password: "0123456789abcdef", salt: "1a2b3c" }, // ... | |
}; | |
function getUserFromDatabase(id) { | |
return database[id]; | |
} | |
const { password, salt, ...user } = { | |
...defaultUser, | |
...getUserFromDatabase(1234), | |
}; | |
console.log(user); // {role: "user", name: "Bruno"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment