Last active
June 14, 2022 08:09
-
-
Save davidbarral/41a5cdc9f2216acc15c74df476feca8f to your computer and use it in GitHub Desktop.
DI middle 1
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 userRepo = require("./repos/user.js"); | |
const defaultRepositories = () => ({ user: userRepo() }); | |
const updateUserPreference = ({ key, value, repositories = defaultRepositories() }) => { | |
// Do stuff and updade the user. | |
repositories.user.update(updatedUser); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment