Skip to content

Commit

Permalink
Wrap requireAll in require for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak committed Aug 17, 2012
1 parent d70b8e3 commit a5ec219
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (typeof document !== "undefined") {
}
},

require: function(name) {
requireModule: function(name) {
var loaded = minispade.loaded[name];
var mod = minispade.modules[name];

Expand All @@ -33,7 +33,7 @@ if (typeof document !== "undefined") {
}
} else {
if (minispade.root && name.substr(0,minispade.root.length) !== minispade.root) {
return minispade.require(minispade.root+name);
return minispade.requireModule(minispade.root+name);
} else {
throw "The module '" + name + "' could not be found";
}
Expand All @@ -47,7 +47,15 @@ if (typeof document !== "undefined") {
for (var module in this.modules) {
if (!this.modules.hasOwnProperty(module)) { continue; }
if (regex && !regex.test(module)) { continue; }
minispade.require(module);
minispade.requireModule(module);
}
},

require: function(path) {
if (typeof path === 'string') {
minispade.requireModule(path);
} else {
minispade.requireAll(path);
}
},

Expand Down

0 comments on commit a5ec219

Please sign in to comment.