Description
I noticed a small code smell in
apps/generator/lib/conditionalGeneration.js.
There is an object literal being spread inside another object literal unnecessarily.
Location
File: apps/generator/lib/conditionalGeneration.js
Lines: ~113–116
Current Code
const source = jmespath.search({
...asyncapiDocument.json(),
...{
server: server ? server.json() : undefined,
},
}, subject);
Proposed Change
We can directly define the property instead of creating a temporary object and spreading it.
const source = jmespath.search({
...asyncapiDocument.json(),
server: server ? server.json() : undefined,
}, subject);
Benefits
- Improves code readability
- Removes a redundant operation