(function () {

function descend(path, o) {
    var step = path.shift();

    while (path.length > 0) {
        return descend(path, o[step]);
    }

    return o[step];
}

define({
    load: function (name, req, load, config) {
        var mod, x;

        if (name.indexOf("?") === -1) {
            load.error("No params specified");
        } else {
            x = name.slice(0, name.indexOf("?")).split(",");
            mod = name.slice(name.indexOf("?") + 1);

            req([mod], function (inc) {
                var ret = {};
                var path;

                if (x.length > 1) {
                    x.forEach(function (pname) {
                        path = pname.split(".");
                        ret[path[path.length - 1]] = descend(path, inc);
                    });
                } else {
                    path = x[0].split(".");
                    ret = descend(path, inc);
                }

                load(ret);
            });
        }
    }
});

}());

@@ -75,33 +75,238 @@
     
-while (path.length %3E 0) %7B
+if (typeof(o%5Bstep%5D) === %22undefined%22) %7B%0A        throw new Error(%22Broken descend path%22);%0A    %7D%0A%0A    while (path.length %3E 0) %7B%0A        if (typeof(o%5Bstep%5D) !== %22object%22) %7B%0A            throw new Error(%22Invalid descend path%22);%0A        %7D
 %0A   
@@ -764,16 +764,42 @@
  path;%0A%0A
+                try %7B%0A    
         
@@ -822,24 +822,28 @@
 ngth %3E 1) %7B%0A
+    
             
@@ -899,24 +899,28 @@
             
+    
 path = pname
@@ -924,32 +924,36 @@
 ame.split(%22.%22);%0A
+    
                 
@@ -1021,36 +1021,44 @@
                 
+ 
+   
 %7D);%0A
+    
                 
@@ -1082,24 +1082,28 @@
             
+   
+ 
 path = x%5B0%5D.
@@ -1106,32 +1106,36 @@
 %5B0%5D.split(%22.%22);%0A
+    
                 
@@ -1156,32 +1156,36 @@
 end(path, inc);%0A
+    
                 
@@ -1199,24 +1199,28 @@
             
+    
 load(ret);%0A 
@@ -1218,16 +1218,107 @@
 d(ret);%0A
+                %7D catch (e) %7B%0A                    load.error(e.message);%0A                %7D%0A
         

Handle invalid paths