Skip to content

Commit e0959a9

Browse files
committed
perf(util-endpoints): replace conditional spreads with direct assignment in evaluateEndpointRule
1 parent f1e339c commit e0959a9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

.changeset/nasty-beers-invite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@smithy/util-endpoints": patch
33
---
44

5-
Reduce allocations in evaluateCondition(s)
5+
Reduce temporary object allocations

packages/util-endpoints/src/utils/evaluateEndpointRule.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ export const evaluateEndpointRule = (
2727

2828
options.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`);
2929

30-
return {
31-
...(headers != undefined && {
32-
headers: getEndpointHeaders(headers, endpointRuleOptions),
33-
}),
34-
...(properties != undefined && {
35-
properties: getEndpointProperties(properties, endpointRuleOptions),
36-
}),
37-
url: getEndpointUrl(url, endpointRuleOptions),
38-
};
30+
const endpointToReturn: EndpointV2 = { url: getEndpointUrl(url, endpointRuleOptions) };
31+
if (headers != undefined) {
32+
endpointToReturn.headers = getEndpointHeaders(headers, endpointRuleOptions);
33+
}
34+
if (properties != undefined) {
35+
endpointToReturn.properties = getEndpointProperties(properties, endpointRuleOptions);
36+
}
37+
38+
return endpointToReturn;
3939
};

0 commit comments

Comments
 (0)