From 5ec92f40b4a12597fde8dba2f87421ddb00a7c8e Mon Sep 17 00:00:00 2001 From: olsonpm Date: Fri, 23 Jan 2015 23:09:00 -0800 Subject: [PATCH] documented use of module.paths This should really be documented in code that uses the object since it doesn't exist on node documentation. Unfortunately node didn't prefix the variable with underscores or gave any semantic naming to signify the intention of it being private. --- bin/slush.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/slush.js b/bin/slush.js index 2cfcb48..7b0ff1f 100755 --- a/bin/slush.js +++ b/bin/slush.js @@ -184,6 +184,9 @@ function getModulesPaths () { paths.push('/usr/lib/node_modules'); } paths.push(path.join(__dirname, '..', '..')); + // require.main points to the main module being ran (in this case slush). Module.paths + // is an undocumented array of strings that hold each directory starting from the current + // module directory all the way down to root. paths.push.apply(paths, require.main.paths); return paths.map(function(path){ return path.toLowerCase();