Permalink
Browse files

Merge pull request #6 from tchak/requireAll

Wrap requireAll in require for convenience
  • Loading branch information...
wycats committed Sep 6, 2012
2 parents d70b8e3 + a5ec219 commit 617c2968506ff693b95c671ec66f90ae0c086a84
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/main.js
View
@@ -18,7 +18,7 @@ if (typeof document !== "undefined") {
}
},
- require: function(name) {
+ requireModule: function(name) {
var loaded = minispade.loaded[name];
var mod = minispade.modules[name];
@@ -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";
}
@@ -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);
}
},

0 comments on commit 617c296

Please sign in to comment.