Skip to content

Commit 93c02fe

Browse files
committed
Use Array.fromAsync
1 parent 506e38a commit 93c02fe

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/sdk.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,18 @@ export const listValItems = memoize(async (
175175
branchId: string,
176176
version: number,
177177
): Promise<ValTown.Vals.FileRetrieveResponse[]> => {
178-
const files: ValTown.Vals.FileRetrieveResponse[] = [];
179-
180178
branchId = branchId ||
181179
(await branchNameToBranch(valId, DEFAULT_BRANCH_NAME)
182-
.then((resp) => resp.id))!;
180+
.then((resp) => resp.id));
183181

184-
for await (
185-
const file of sdk.vals.files.retrieve(valId, {
182+
const files = await Array.fromAsync(
183+
sdk.vals.files.retrieve(valId, {
186184
path: "",
187185
branch_id: branchId,
188186
version,
189187
recursive: true,
190-
})
191-
) files.push(file);
188+
}),
189+
);
192190

193191
return files;
194192
});

0 commit comments

Comments
 (0)