mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
use Set instead of object
This commit is contained in:
parent
b03812bf06
commit
11ef3c27ed
1 changed files with 8 additions and 9 deletions
|
@ -26,10 +26,9 @@ module.exports = OutputFileFinder = {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function (error, outputFiles, allFiles) {}
|
callback = function (error, outputFiles, allFiles) {}
|
||||||
}
|
}
|
||||||
const incomingResources = {}
|
const incomingResources = new Set(
|
||||||
for (const resource of Array.from(resources)) {
|
resources.map((resource) => resource.path)
|
||||||
incomingResources[resource.path] = true
|
)
|
||||||
}
|
|
||||||
|
|
||||||
return OutputFileFinder._getAllFiles(directory, function (error, allFiles) {
|
return OutputFileFinder._getAllFiles(directory, function (error, allFiles) {
|
||||||
if (allFiles == null) {
|
if (allFiles == null) {
|
||||||
|
@ -41,10 +40,10 @@ module.exports = OutputFileFinder = {
|
||||||
}
|
}
|
||||||
const outputFiles = []
|
const outputFiles = []
|
||||||
for (const file of Array.from(allFiles)) {
|
for (const file of Array.from(allFiles)) {
|
||||||
if (!incomingResources[file]) {
|
if (!incomingResources.has(file)) {
|
||||||
outputFiles.push({
|
outputFiles.push({
|
||||||
path: file,
|
path: file,
|
||||||
type: __guard__(file.match(/\.([^\.]+)$/), (x) => x[1])
|
type: __guard__(file.match(/\.([^\.]+)$/), (x) => x[1]),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +69,7 @@ module.exports = OutputFileFinder = {
|
||||||
'.archive',
|
'.archive',
|
||||||
'-o',
|
'-o',
|
||||||
'-name',
|
'-name',
|
||||||
'.project-*'
|
'.project-*',
|
||||||
]
|
]
|
||||||
const args = [
|
const args = [
|
||||||
directory,
|
directory,
|
||||||
|
@ -81,7 +80,7 @@ module.exports = OutputFileFinder = {
|
||||||
'-o',
|
'-o',
|
||||||
'-type',
|
'-type',
|
||||||
'f',
|
'f',
|
||||||
'-print'
|
'-print',
|
||||||
]
|
]
|
||||||
logger.log({ args }, 'running find command')
|
logger.log({ args }, 'running find command')
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ module.exports = OutputFileFinder = {
|
||||||
})
|
})
|
||||||
return callback(null, fileList)
|
return callback(null, fileList)
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function __guard__(value, transform) {
|
function __guard__(value, transform) {
|
||||||
|
|
Loading…
Reference in a new issue