Skip to content

Commit

Permalink
Merge pull request #1 from mkay581/master
Browse files Browse the repository at this point in the history
few small updates
  • Loading branch information
fracmak committed Jun 26, 2015
2 parents 5c6678f + 05991ef commit 105dda2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,7 +1,7 @@
# singleton-require
When you need to a single reference to a global singleton (mongoose, config, cache) shared amongst all npm modules, useful for plugin systems
When you need a single reference to a global singleton (mongoose, config, cache) shared amongst all npm modules, useful for plugin systems

# Usage
Instead of calling require directly, route it through singleton-require to guarentee only one instance of the module is loaded and you have a reference to it
Instead of calling require directly, route it through singleton-require to guarantee only one instance of the module is loaded and you have a reference to it

var config = require('singleton-require')('config');
1 change: 0 additions & 1 deletion index.js
Expand Up @@ -2,7 +2,6 @@

module.exports = function(requireName) {
var singleton = global['singleton-' + requireName];
console.log('test');
if (!singleton) {
singleton = global['singleton-' + requireName] = require(requireName);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "singleton-require",
"version": "1.0.0",
"description": "When you need to a single reference to a global singleton (mongoose, config, cache) shared amongst all npm modules, useful for plugin systems",
"description": "When you need a single reference to a global singleton (mongoose, config, cache) shared amongst all npm modules, useful for plugin systems",
"main": "index.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit 105dda2

Please sign in to comment.