Skip to content

Commit

Permalink
refactor(api-plugin): streamline transformation process
Browse files Browse the repository at this point in the history
- Introduce a variable for transformed record
- Filter out null and undefined values from transformed results

(Your variable names are so generic, they wouldn't even stand out in a crowd of variables)
  • Loading branch information
alonp99 committed Nov 14, 2024
1 parent ab97fbc commit 810b467
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ export class ApiPlugin {
}

for (const transformer of transformers) {
mutatedRecord = await this.transformByTransformer(transformer, mutatedRecord);
const transformed = await this.transformByTransformer(transformer, mutatedRecord);
mutatedRecord = Object.fromEntries(
Object.entries(transformed).filter(([_, value]) => value !== null && value !== undefined),
);
}

return mutatedRecord;
Expand Down

0 comments on commit 810b467

Please sign in to comment.