aboutsummaryrefslogtreecommitdiff
path: root/dev/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'dev/util.js')
-rw-r--r--dev/util.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/dev/util.js b/dev/util.js
index 6a7fa8f5..542ad6a2 100644
--- a/dev/util.js
+++ b/dev/util.js
@@ -72,7 +72,7 @@ export function getArgs(args, argMap) {
/**
* @param {string} baseDirectory
- * @param {?(fileName: string) => boolean} predicate
+ * @param {?(fileName: string, isDirectory: boolean) => boolean} predicate
* @returns {string[]}
*/
export function getAllFiles(baseDirectory, predicate = null) {
@@ -86,11 +86,13 @@ export function getAllFiles(baseDirectory, predicate = null) {
const relativeFileName = path.relative(baseDirectory, fullFileName);
const stats = fs.lstatSync(fullFileName);
if (stats.isFile()) {
- if (typeof predicate !== 'function' || predicate(relativeFileName)) {
+ if (typeof predicate !== 'function' || predicate(relativeFileName, false)) {
results.push(relativeFileName);
}
} else if (stats.isDirectory()) {
- directories.push(fullFileName);
+ if (typeof predicate !== 'function' || predicate(relativeFileName, true)) {
+ directories.push(fullFileName);
+ }
}
}
}