Skip to content

Instantly share code, notes, and snippets.

@faustoct1
Created July 29, 2022 15:55
Show Gist options
  • Save faustoct1/a3ed57e4d7d20ebf0ed21802d2d7dc00 to your computer and use it in GitHub Desktop.
Save faustoct1/a3ed57e4d7d20ebf0ed21802d2d7dc00 to your computer and use it in GitHub Desktop.
Passar parâmetro para um require
module.exports = (params) => {
const app = {
print: async () => {
console.log(params)
}
}
return app
}
const params = {appName:'App test',description:'Passar params para um require', version:'1.0.0'}
const app = require('./app')(params)
const test = async () => {
app.print()
}
(async () => test())()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment