Simplify code
This commit is contained in:
@ -44,14 +44,9 @@ export class Compiler {
|
|||||||
public compile(file: File, prettifyXml?: boolean): JSZip {
|
public compile(file: File, prettifyXml?: boolean): JSZip {
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
|
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
|
||||||
|
const map = new Map<string, IXmlifyedFile | IXmlifyedFile[]>(Object.entries(xmlifiedFileMapping));
|
||||||
|
|
||||||
for (const key in xmlifiedFileMapping) {
|
for (const [, obj] of map) {
|
||||||
if (!xmlifiedFileMapping[key]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const obj = xmlifiedFileMapping[key] as IXmlifyedFile | IXmlifyedFile[];
|
|
||||||
|
|
||||||
if (Array.isArray(obj)) {
|
if (Array.isArray(obj)) {
|
||||||
for (const subFile of obj) {
|
for (const subFile of obj) {
|
||||||
zip.file(subFile.path, subFile.data);
|
zip.file(subFile.path, subFile.data);
|
||||||
|
Reference in New Issue
Block a user