[Pkg-javascript-commits] [node-module-deps] 350/444: Split NODE_PATH by local OS delimiter Empty or undefined paths are sorted out Handle opts.paths provided as a string

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:12 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 4cdea56df4e1d5148f492fec099b59e059406f4e
Author: ElNounch <ElNounch at users.noreply.github.com>
Date:   Thu Mar 26 23:01:50 2015 +0100

    Split NODE_PATH by local OS delimiter
    Empty or undefined paths are sorted out
    Handle opts.paths provided as a string
    
    On Windows, fix browserify test case 'paths.js'
---
 index.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index 18244cf..f3094cb 100644
--- a/index.js
+++ b/index.js
@@ -36,14 +36,15 @@ function Deps (opts) {
     this.entries = [];
     this._input = [];
     
-    this.paths = opts.paths || process.env.NODE_PATH;
+    this.paths = opts.paths || process.env.NODE_PATH || '';
     if (typeof this.paths === 'string') {
-        this.paths = process.env.NODE_PATH.split(':');
+        this.paths = this.paths.split(path.delimiter);
     }
-    if (!this.paths) this.paths = [];
-    this.paths = this.paths.map(function (p) {
-        return path.resolve(self.basedir, p);
-    });
+    this.paths = this.paths
+        .filter(Boolean)
+        .map(function (p) {
+            return path.resolve(self.basedir, p);
+        });
     
     this.transforms = [].concat(opts.transform).filter(Boolean);
     this.globalTransforms = [].concat(opts.globalTransform).filter(Boolean);

-- 
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