Skip to content

Commit c449d48

Browse files
committed
Minor cleanup
1 parent dc23387 commit c449d48

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/sync.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = function (x, options) {
5050
var rfile = path.relative(pkg.dir, x);
5151
var r = opts.pathFilter(pkg.pkg, x, rfile);
5252
if (r) {
53-
x = path.resolve(pkg.dir, r);
53+
x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign
5454
}
5555
}
5656

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

Lines changed: 6 additions & 0 deletions
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)