lib/npm-graph.js
function (currDeps, loc) {
      loc.deps = loc.deps || [];
      var covered = []; // only cover unique paths once to avoid stack overflow
      currDeps.forEach(function (obj) {
        if (covered.indexOf(obj.path) < 0) {
          covered.push(obj.path); // cover unique paths only once per level

          var key = obj.name
            , isRelative = (['\\', '/', '.'].indexOf(key[0]) >= 0)
            , notCovered = notCoveredInArray(loc.deps, key)
            , isRecorded = (!isRelative || opts.showLocal) && notCovered
            , res = isRecorded ? { name: key } : loc;

          if (isRecorded) {
            // NB: !isRecorded => only inspect the file for recorded deps
            res.path = obj.path;
            loc.deps.push(res);
          }

          // recurse (!isRecorded => keep adding to previous location)
          traverse(lookup[obj.path] || [], res);
        }
      });
    }
function (currDeps, loc) {
      loc.deps = loc.deps || [];
      var covered = []; // only cover unique paths once to avoid stack overflow
      currDeps.forEach(function (obj) {
        if (covered.indexOf(obj.path) < 0) {
          covered.push(obj.path); // cover unique paths only once per level

          var key = obj.name
            , isRelative = (['\\', '/', '.'].indexOf(key[0]) >= 0)
            , notCovered = notCoveredInArray(loc.deps, key)
            , isRecorded = (!isRelative || opts.showLocal) && notCovered
            , res = isRecorded ? { name: key } : loc;

          if (isRecorded) {
            // NB: !isRecorded => only inspect the file for recorded deps
            res.path = obj.path;
            loc.deps.push(res);
          }

          // recurse (!isRecorded => keep adding to previous location)
          traverse(lookup[obj.path] || [], res);
        }
      });
    }
function ( currDeps , loc ) { loc . deps = loc . deps || [ ] ; var covered = [ ] ; // only cover unique paths once to avoid stack overflow currDeps . forEach ( function ( obj ) { if ( covered . indexOf ( obj . path ) < 0 ) { covered . push ( obj . path ) ; // cover unique paths only once per level var key = obj . name , isRelative = ( [ '\\' , '/' , '.' ] . indexOf ( key [ 0 ] ) >= 0 ) , notCovered = notCoveredInArray ( loc . deps , key ) , isRecorded = ( ! isRelative || opts . showLocal ) && notCovered , res = isRecorded ? { name : key } : loc ; if ( isRecorded ) { // NB: !isRecorded => only inspect the file for recorded deps res . path = obj . path ; loc . deps . push ( res ) ; } // recurse (!isRecorded => keep adding to previous location) traverse ( lookup [ obj . path ] || [ ] , res ) ; } } ) ; }
build a dependency tree from the flat mdeps list by recursing
build a dependency tree from the flat mdeps list by recursing