Skip to content

Commit 7715d6b

Browse files
committed
make progress function (nested within createArchive function) more compact (index.ts)
1 parent 8b1a13a commit 7715d6b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/index.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,9 @@ export const createArchive =
7272
* pass it to an array. Finally returns this array.
7373
*/
7474
function onprogress(data: string) {
75-
let entries: string[] = [];
76-
data.split('\n').forEach(function (line) {
77-
if (line.substr(0, 1) === '+') {
78-
entries.push(
79-
ReplaceNativeSeparator(
80-
line.substr(2, line.length)
81-
)
82-
);
83-
}
84-
});
85-
return entries;
75+
return data.split('\n')
76+
.filter((line) => line.startsWith('+'))
77+
.map((line) => ReplaceNativeSeparator(line.slice(2)));
8678
}
8779

8880
// Convert array of files into a string if needed.

0 commit comments

Comments
 (0)