Skip to content

Instantly share code, notes, and snippets.

@joepie91
Last active August 29, 2015 14:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepie91/9b1ca2392a72e82b44fb to your computer and use it in GitHub Desktop.
Save joepie91/9b1ca2392a72e82b44fb to your computer and use it in GitHub Desktop.
Configurable exports in Node.js
module.exports = function(configuration) {
var configuredInstance = createInstance(configuration);
return function(argOne, argTwo) {
configuredInstance.doThing(argOne)
return configuredInstance.doAnotherThing(argTwo);
}
}
var someModule = require("./some-module")(configuration);
someModule(argOne, argTwo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment