Comparing version 8.0.0 to 8.0.1
23
index.js
@@ -28,9 +28,8 @@ "use strict"; | ||
function build(dirent, path, stats, opts) { | ||
const entry = { | ||
return { | ||
path, | ||
directory: stats ? stats.isDirectory() : dirent.isDirectory(), | ||
symlink: stats ? stats.isSymbolicLink() : dirent.isSymbolicLink(), | ||
directory: (stats || dirent).isDirectory(), | ||
symlink: (stats || dirent).isSymbolicLink(), | ||
...(opts.stats ? {stats} : {}), | ||
}; | ||
if (opts.stats) entry.stats = stats; | ||
return entry; | ||
} | ||
@@ -40,4 +39,4 @@ | ||
return { | ||
includeMatcher: include ? picomatch(include, match) : () => true, | ||
excludeMatcher: exclude ? picomatch(exclude, match) : () => false, | ||
includeMatcher: include ? picomatch(include, match) : null, | ||
excludeMatcher: exclude ? picomatch(exclude, match) : null, | ||
}; | ||
@@ -88,3 +87,3 @@ } | ||
if (includeMatcher(path)) yield build(dirent, path, stats, opts); | ||
if (!includeMatcher || includeMatcher(path)) yield build(dirent, path, stats, opts); | ||
if (recurse) yield* await rrdir(path, opts, {includeMatcher, excludeMatcher}); | ||
@@ -117,3 +116,3 @@ } | ||
const path = makePath(dirent, dir); | ||
if (excludeMatcher(path)) return; | ||
if (excludeMatcher && excludeMatcher(path)) return; | ||
@@ -138,3 +137,3 @@ let stats; | ||
if (includeMatcher(path)) results.push(build(dirent, path, stats, opts)); | ||
if (!includeMatcher || includeMatcher(path)) results.push(build(dirent, path, stats, opts)); | ||
if (recurse) results.push(...await module.exports.async(path, opts, {includeMatcher, excludeMatcher})); | ||
@@ -169,3 +168,3 @@ })); | ||
const path = makePath(dirent, dir); | ||
if (excludeMatcher(path)) continue; | ||
if (excludeMatcher && excludeMatcher(path)) continue; | ||
@@ -190,3 +189,3 @@ let stats; | ||
if (includeMatcher(path)) results.push(build(dirent, path, stats, opts)); | ||
if (!includeMatcher || includeMatcher(path)) results.push(build(dirent, path, stats, opts)); | ||
if (recurse) results.push(...module.exports.sync(path, opts, {includeMatcher, excludeMatcher})); | ||
@@ -193,0 +192,0 @@ } |
{ | ||
"name": "rrdir", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "Recursive directory reader with a delightful API", | ||
@@ -25,3 +25,3 @@ "author": "silverwind <me@silverwind.io>", | ||
"eslint-config-silverwind": "11.0.2", | ||
"jest": "25.2.3", | ||
"jest": "25.2.4", | ||
"tempy": "0.5.0", | ||
@@ -28,0 +28,0 @@ "updates": "10.2.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9693
197
159