Skip to content

Commit 4eebf94

Browse files
committed
Minor cleanup
1 parent 7b8960c commit 4eebf94

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/sync.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ module.exports = function (x, options) {
6767
}
6868

6969
function loadpkg(dir) {
70-
if (dir === '' || dir === '/' || (/[/\\]node_modules[/\\]*$/).test(dir)) {
71-
return null;
70+
if (dir === '' || dir === '/') return;
71+
if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
72+
return;
7273
}
74+
if (/[/\\]node_modules[/\\]*$/.test(dir)) return;
7375

7476
var pkgfile = path.join(dir, 'package.json');
7577

readme.markdown

+6
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ options are:
115115

116116
* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json contents before looking at the "main" field
117117

118+
* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
119+
* pkg - package data
120+
* path - the path being resolved
121+
* relativePath - the path relative from the package.json location
122+
* returns - a relative path that will be joined from the package.json location
123+
118124
* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this)
119125

120126
* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`

0 commit comments

Comments
 (0)