readdir-glob
Advanced tools
Comparing version 1.1.0 to 1.1.1
17
index.js
@@ -65,3 +65,10 @@ module.exports = readdirGlob; | ||
for(const file of files) { | ||
const filename = dir + '/' + file.name; | ||
let name = file.name; | ||
if(name === undefined) { | ||
// undefined file.name means the `withFileTypes` options is not supported by node | ||
// we have to call the stat function to know if file is directory or not. | ||
name = file; | ||
useStat = true; | ||
} | ||
const filename = dir + '/' + name; | ||
const relative = filename.slice(1); // Remove the leading / | ||
@@ -73,3 +80,8 @@ const absolute = path + '/' + relative; | ||
} | ||
stats = stats || file; | ||
if(!stats && file.name !== undefined) { | ||
stats = file; | ||
} | ||
if(stats === null) { | ||
stats = { isDirectory: () => false }; | ||
} | ||
@@ -115,2 +127,3 @@ if(stats.isDirectory()) { | ||
cb = options; | ||
options = null; | ||
} | ||
@@ -117,0 +130,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Recursive fs.readdir with streaming API and glob filtering.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"homepage": "https://github.com/Yqnn/node-readdir-glob", | ||
@@ -21,3 +21,3 @@ "repository": { | ||
"coveralls": "^3.1.0", | ||
"jest": "^26.1.0", | ||
"jest": "^25.5.4", | ||
"mkdirp": "^1.0.0", | ||
@@ -24,0 +24,0 @@ "path-is-absolute": "^1.0.0", |
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
22997
219