[Pkg-javascript-commits] [node-browser-pack] 22/141: fix prelude name lookup for parent

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:23:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browser-pack.

commit 162ae59c1249527043e78997907d97ec58f156f0
Author: Roman Shtylman <shtylman at gmail.com>
Date:   Sat Feb 23 01:22:42 2013 -0500

    fix prelude name lookup for parent
    
    If no id mapped in current scope, call require with original id and it
    will call up to parent require if there is one.
---
 prelude.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/prelude.js b/prelude.js
index e9e803b..55cd9a8 100644
--- a/prelude.js
+++ b/prelude.js
@@ -11,14 +11,14 @@ module.exports = function(parent_req, modules, cache, entry) {
     function require(name){
         if(!cache[name]) {
             if(!modules[name]) {
+                // if we cannot find the item within our internal map revert to parent
                 if (parent_req) return parent_req(name);
                 throw new Error('Cannot find module \'' + name + '\'');
             }
             var m = cache[name] = {exports:{}};
             modules[name][0](function(x){
                 var id = modules[name][1][x];
-                // if we cannot find the item within our internal map revert to parent
-                return id ? require(id) : parent_req(x);
+                return require(id ? id : x);
             },m,m.exports);
         }
         return cache[name].exports

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browser-pack.git



More information about the Pkg-javascript-commits mailing list