[Pkg-javascript-commits] [node-module-deps] 190/444: formatting, use a variable

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:54 UTC 2017


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

rouca pushed a commit to branch master
in repository node-module-deps.

commit a8759947f2e3e832d68cfd76d11037881bef710f
Author: James Halliday <mail at substack.net>
Date:   Fri Apr 11 01:06:05 2014 -0700

    formatting, use a variable
---
 index.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index 09bfb68..9ffa1c9 100644
--- a/index.js
+++ b/index.js
@@ -14,6 +14,12 @@ module.exports = function (mains, opts) {
     var cache = opts.cache;
     var pkgCache = opts.packageCache || {};
     
+    var paths = opts.paths || process.env.NODE_PATH;
+    if (typeof paths === 'string') {
+        paths = process.env.NODE_PATH.split(':');
+    }
+    if (!paths) paths = [];
+    
     if (!Array.isArray(mains)) mains = [ mains ].filter(Boolean);
     var basedir = opts.basedir || process.cwd();
     
@@ -39,7 +45,7 @@ module.exports = function (mains, opts) {
         if (--pending === 0) output.queue(null);
     }
     
-    var top = { id: '/', filename: '/', paths: paths() };
+    var top = { id: '/', filename: '/', paths: paths };
     
     (function () {
         var pkgCount = mains.length;
@@ -252,7 +258,7 @@ module.exports = function (mains, opts) {
             }
         }
         var p = deps.length;
-        var current = { id: file, filename: file, paths: paths(), package: pkg };
+        var current = { id: file, filename: file, paths: paths, package: pkg };
         var resolved = {};
         
         deps.forEach(function (id) {
@@ -338,7 +344,3 @@ function lookupPkg (file, cb) {
         });
     })();
 }
-
-function paths () {
-  return (process.env.NODE_PATH) ? process.env.NODE_PATH.split(':') : [];
-}

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



More information about the Pkg-javascript-commits mailing list