use a Set instead of an Object

This commit is contained in:
Brian Gough 2020-12-18 14:52:04 +00:00
parent 43b0429c28
commit ca98ee5cff

View file

@ -106,14 +106,11 @@ module.exports = ResourceStateManager = {
return callback(new Error('relative path in resource file list')) return callback(new Error('relative path in resource file list'))
} }
// check if any of the input files are not present in list of files // check if any of the input files are not present in list of files
const seenFile = {} const seenFiles = new Set(allFiles)
for (file of allFiles) {
seenFile[file] = true
}
const missingFiles = resources const missingFiles = resources
.filter((resource) => !seenFile[resource.path])
.map((resource) => resource.path) .map((resource) => resource.path)
if (missingFiles && missingFiles.length > 0) { .filter((path) => !seenFiles.has(path))
if (missingFiles.length > 0) {
logger.err( logger.err(
{ missingFiles, basePath, allFiles, resources }, { missingFiles, basePath, allFiles, resources },
'missing input files for project' 'missing input files for project'