Skip to content

Commit 18f8f73

Browse files
committed
Simplified logic.
1 parent cee5392 commit 18f8f73

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/index.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,14 @@ export const unzipFile = async (
7979
.filter(entry => entry.isDirectory)
8080
.map(entry => entry.entryName);
8181

82-
const files = entries.filter(
83-
(entry: { isDirectory: boolean }) => !entry.isDirectory
84-
);
82+
const files = entries
83+
.filter(entry => !entry.isDirectory)
84+
.filter(entry =>
85+
filterPatterns.some(pattern => entry.entryName.match(pattern))
86+
);
8587

86-
return Promise.all(
87-
files
88-
.filter(entry =>
89-
filterPatterns.some(pattern => entry.entryName.match(pattern))
90-
)
91-
.map(async entry => ({
92-
path: entry.entryName.replace(new RegExp(`^${rootDir}`), ''),
93-
content: entry.getData().toString()
94-
}))
95-
);
88+
return files.map(entry => ({
89+
path: entry.entryName.replace(new RegExp(`^${rootDir}`), ''),
90+
content: entry.getData().toString()
91+
}));
9692
};

0 commit comments

Comments
 (0)