From d808b287a71648a1b39f27e159ad9e245845359a Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 2 Dec 2021 17:37:27 +0000 Subject: [PATCH] Simplify code --- src/export/packer/next-compiler.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/export/packer/next-compiler.ts b/src/export/packer/next-compiler.ts index 24cf9d3186..2afe0fde98 100644 --- a/src/export/packer/next-compiler.ts +++ b/src/export/packer/next-compiler.ts @@ -44,14 +44,9 @@ export class Compiler { public compile(file: File, prettifyXml?: boolean): JSZip { const zip = new JSZip(); const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml); + const map = new Map(Object.entries(xmlifiedFileMapping)); - for (const key in xmlifiedFileMapping) { - if (!xmlifiedFileMapping[key]) { - continue; - } - - const obj = xmlifiedFileMapping[key] as IXmlifyedFile | IXmlifyedFile[]; - + for (const [, obj] of map) { if (Array.isArray(obj)) { for (const subFile of obj) { zip.file(subFile.path, subFile.data);