mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Reduced nesting
This commit is contained in:
parent
fc7b33cd53
commit
2e4f15d5a8
@ -124,25 +124,25 @@ export class ImporterUtil {
|
|||||||
|
|
||||||
while (filesToProcess.length !== 0) {
|
while (filesToProcess.length !== 0) {
|
||||||
const fileNode = filesToProcess.dequeue();
|
const fileNode = filesToProcess.dequeue();
|
||||||
if (!fileNode) continue;
|
if (!fileNode || this.vfs.getFileExtension(fileNode.fileName) !== "json") {
|
||||||
|
continue;
|
||||||
if (this.vfs.getFileExtension(fileNode.fileName) === "json") {
|
|
||||||
const filePathAndName = `${fileNode.filePath}${fileNode.fileName}`;
|
|
||||||
promises.push(
|
|
||||||
this.vfs
|
|
||||||
.readFileAsync(filePathAndName)
|
|
||||||
.then(async (fileData) => {
|
|
||||||
onReadCallback(filePathAndName, fileData);
|
|
||||||
return this.jsonUtil.deserializeWithCacheCheckAsync<any>(fileData, filePathAndName);
|
|
||||||
})
|
|
||||||
.then(async (fileDeserialized) => {
|
|
||||||
onObjectDeserialized(filePathAndName, fileDeserialized);
|
|
||||||
const strippedFilePath = this.vfs.stripExtension(filePathAndName).replace(filepath, "");
|
|
||||||
this.placeObject(fileDeserialized, strippedFilePath, result, strippablePath);
|
|
||||||
})
|
|
||||||
.then(() => progressWriter.increment()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filePathAndName = `${fileNode.filePath}${fileNode.fileName}`;
|
||||||
|
promises.push(
|
||||||
|
this.vfs
|
||||||
|
.readFileAsync(filePathAndName)
|
||||||
|
.then(async (fileData) => {
|
||||||
|
onReadCallback(filePathAndName, fileData);
|
||||||
|
return this.jsonUtil.deserializeWithCacheCheckAsync<any>(fileData, filePathAndName);
|
||||||
|
})
|
||||||
|
.then(async (fileDeserialized) => {
|
||||||
|
onObjectDeserialized(filePathAndName, fileDeserialized);
|
||||||
|
const strippedFilePath = this.vfs.stripExtension(filePathAndName).replace(filepath, "");
|
||||||
|
this.placeObject(fileDeserialized, strippedFilePath, result, strippablePath);
|
||||||
|
})
|
||||||
|
.then(() => progressWriter.increment()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(promises).catch((e) => console.error(e));
|
await Promise.all(promises).catch((e) => console.error(e));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user