Skip to content

Commit

Permalink
refactor: unroll internal to generator
Browse files Browse the repository at this point in the history
refactor: improve variable naming
  • Loading branch information
tomwwright committed Sep 27, 2023
1 parent 383a609 commit c9f2753
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,16 @@ export class LazyLookupExport implements LookupExport {
return this.exports[name];
}

for await (const exports of this.listExports()) {
for (const e of exports) {
if (!e.Name) {
throw new LookupExportError(`Unable to handle CloudFormation Export without Name! ${JSON.stringify(e)}`);
}
this.exports[e.Name] = e;
for await (const cfnExport of this.listExports()) {
if (!cfnExport.Name) {
throw new LookupExportError(`Unable to handle CloudFormation Export without Name! ${JSON.stringify(cfnExport)}`);
}
this.exports[cfnExport.Name] = cfnExport;

if (e.Name === name) {
return e;
}
if (cfnExport.Name === name) {
return cfnExport;
}

}

return undefined; // export not found
Expand All @@ -74,7 +73,9 @@ export class LazyLookupExport implements LookupExport {
NextToken: nextToken,
}).promise();

yield response.Exports ?? [];
for (const cfnExport of response.Exports ?? []) {
yield cfnExport;
}

if (!response.NextToken) {
return;
Expand Down

0 comments on commit c9f2753

Please sign in to comment.