Skip to content

Commit

Permalink
chore(clients): replace triple-equals undefined+null check with doubl…
Browse files Browse the repository at this point in the history
…e-equals (#3793)
  • Loading branch information
trivikr authored Jul 11, 2022
1 parent f311cab commit c20e037
Show file tree
Hide file tree
Showing 296 changed files with 77,229 additions and 114,860 deletions.
543 changes: 178 additions & 365 deletions clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

23 changes: 10 additions & 13 deletions clients/client-account/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ export const serializeAws_restJson1DeleteAlternateContactCommand = async (
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteAlternateContact";
let body: any;
body = JSON.stringify({
...(input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId }),
...(input.AlternateContactType !== undefined &&
input.AlternateContactType !== null && { AlternateContactType: input.AlternateContactType }),
...(input.AccountId != null && { AccountId: input.AccountId }),
...(input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType }),
});
return new __HttpRequest({
protocol,
Expand All @@ -72,9 +71,8 @@ export const serializeAws_restJson1GetAlternateContactCommand = async (
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getAlternateContact";
let body: any;
body = JSON.stringify({
...(input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId }),
...(input.AlternateContactType !== undefined &&
input.AlternateContactType !== null && { AlternateContactType: input.AlternateContactType }),
...(input.AccountId != null && { AccountId: input.AccountId }),
...(input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType }),
});
return new __HttpRequest({
protocol,
Expand All @@ -98,13 +96,12 @@ export const serializeAws_restJson1PutAlternateContactCommand = async (
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/putAlternateContact";
let body: any;
body = JSON.stringify({
...(input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId }),
...(input.AlternateContactType !== undefined &&
input.AlternateContactType !== null && { AlternateContactType: input.AlternateContactType }),
...(input.EmailAddress !== undefined && input.EmailAddress !== null && { EmailAddress: input.EmailAddress }),
...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
...(input.PhoneNumber !== undefined && input.PhoneNumber !== null && { PhoneNumber: input.PhoneNumber }),
...(input.Title !== undefined && input.Title !== null && { Title: input.Title }),
...(input.AccountId != null && { AccountId: input.AccountId }),
...(input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType }),
...(input.EmailAddress != null && { EmailAddress: input.EmailAddress }),
...(input.Name != null && { Name: input.Name }),
...(input.PhoneNumber != null && { PhoneNumber: input.PhoneNumber }),
...(input.Title != null && { Title: input.Title }),
});
return new __HttpRequest({
protocol,
Expand Down
519 changes: 205 additions & 314 deletions clients/client-acm-pca/src/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

219 changes: 77 additions & 142 deletions clients/client-acm/src/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

1,091 changes: 450 additions & 641 deletions clients/client-alexa-for-business/src/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

98 changes: 29 additions & 69 deletions clients/client-amp/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const serializeAws_restJson1CreateAlertManagerDefinitionCommand = async (
let body: any;
body = JSON.stringify({
clientToken: input.clientToken ?? generateIdempotencyToken(),
...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
...(input.data != null && { data: context.base64Encoder(input.data) }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -146,9 +146,9 @@ export const serializeAws_restJson1CreateRuleGroupsNamespaceCommand = async (
let body: any;
body = JSON.stringify({
clientToken: input.clientToken ?? generateIdempotencyToken(),
...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
...(input.name !== undefined && input.name !== null && { name: input.name }),
...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
...(input.data != null && { data: context.base64Encoder(input.data) }),
...(input.name != null && { name: input.name }),
...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
});
return new __HttpRequest({
protocol,
Expand All @@ -172,9 +172,9 @@ export const serializeAws_restJson1CreateWorkspaceCommand = async (
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces";
let body: any;
body = JSON.stringify({
...(input.alias !== undefined && input.alias !== null && { alias: input.alias }),
...(input.alias != null && { alias: input.alias }),
clientToken: input.clientToken ?? generateIdempotencyToken(),
...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -507,7 +507,7 @@ export const serializeAws_restJson1PutAlertManagerDefinitionCommand = async (
let body: any;
body = JSON.stringify({
clientToken: input.clientToken ?? generateIdempotencyToken(),
...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
...(input.data != null && { data: context.base64Encoder(input.data) }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -552,7 +552,7 @@ export const serializeAws_restJson1PutRuleGroupsNamespaceCommand = async (
let body: any;
body = JSON.stringify({
clientToken: input.clientToken ?? generateIdempotencyToken(),
...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
...(input.data != null && { data: context.base64Encoder(input.data) }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -585,7 +585,7 @@ export const serializeAws_restJson1TagResourceCommand = async (
}
let body: any;
body = JSON.stringify({
...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -651,7 +651,7 @@ export const serializeAws_restJson1UpdateWorkspaceAliasCommand = async (
}
let body: any;
body = JSON.stringify({
...(input.alias !== undefined && input.alias !== null && { alias: input.alias }),
...(input.alias != null && { alias: input.alias }),
clientToken: input.clientToken ?? generateIdempotencyToken(),
});
return new __HttpRequest({
Expand Down Expand Up @@ -1874,18 +1874,12 @@ const deserializeAws_restJson1AlertManagerDefinitionDescription = (
): AlertManagerDefinitionDescription => {
return {
createdAt:
output.createdAt !== undefined && output.createdAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
: undefined,
data: output.data !== undefined && output.data !== null ? context.base64Decoder(output.data) : undefined,
output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
data: output.data != null ? context.base64Decoder(output.data) : undefined,
modifiedAt:
output.modifiedAt !== undefined && output.modifiedAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt)))
: undefined,
output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
status:
output.status !== undefined && output.status !== null
? deserializeAws_restJson1AlertManagerDefinitionStatus(output.status, context)
: undefined,
output.status != null ? deserializeAws_restJson1AlertManagerDefinitionStatus(output.status, context) : undefined,
} as any;
};

Expand All @@ -1906,23 +1900,14 @@ const deserializeAws_restJson1RuleGroupsNamespaceDescription = (
return {
arn: __expectString(output.arn),
createdAt:
output.createdAt !== undefined && output.createdAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
: undefined,
data: output.data !== undefined && output.data !== null ? context.base64Decoder(output.data) : undefined,
output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
data: output.data != null ? context.base64Decoder(output.data) : undefined,
modifiedAt:
output.modifiedAt !== undefined && output.modifiedAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt)))
: undefined,
output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
name: __expectString(output.name),
status:
output.status !== undefined && output.status !== null
? deserializeAws_restJson1RuleGroupsNamespaceStatus(output.status, context)
: undefined,
tags:
output.tags !== undefined && output.tags !== null
? deserializeAws_restJson1TagMap(output.tags, context)
: undefined,
output.status != null ? deserializeAws_restJson1RuleGroupsNamespaceStatus(output.status, context) : undefined,
tags: output.tags != null ? deserializeAws_restJson1TagMap(output.tags, context) : undefined,
} as any;
};

Expand All @@ -1943,22 +1928,13 @@ const deserializeAws_restJson1RuleGroupsNamespaceSummary = (
return {
arn: __expectString(output.arn),
createdAt:
output.createdAt !== undefined && output.createdAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
: undefined,
output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
modifiedAt:
output.modifiedAt !== undefined && output.modifiedAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt)))
: undefined,
output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
name: __expectString(output.name),
status:
output.status !== undefined && output.status !== null
? deserializeAws_restJson1RuleGroupsNamespaceStatus(output.status, context)
: undefined,
tags:
output.tags !== undefined && output.tags !== null
? deserializeAws_restJson1TagMap(output.tags, context)
: undefined,
output.status != null ? deserializeAws_restJson1RuleGroupsNamespaceStatus(output.status, context) : undefined,
tags: output.tags != null ? deserializeAws_restJson1TagMap(output.tags, context) : undefined,
} as any;
};

Expand Down Expand Up @@ -2019,18 +1995,10 @@ const deserializeAws_restJson1WorkspaceDescription = (output: any, context: __Se
alias: __expectString(output.alias),
arn: __expectString(output.arn),
createdAt:
output.createdAt !== undefined && output.createdAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
: undefined,
output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
prometheusEndpoint: __expectString(output.prometheusEndpoint),
status:
output.status !== undefined && output.status !== null
? deserializeAws_restJson1WorkspaceStatus(output.status, context)
: undefined,
tags:
output.tags !== undefined && output.tags !== null
? deserializeAws_restJson1TagMap(output.tags, context)
: undefined,
status: output.status != null ? deserializeAws_restJson1WorkspaceStatus(output.status, context) : undefined,
tags: output.tags != null ? deserializeAws_restJson1TagMap(output.tags, context) : undefined,
workspaceId: __expectString(output.workspaceId),
} as any;
};
Expand All @@ -2046,17 +2014,9 @@ const deserializeAws_restJson1WorkspaceSummary = (output: any, context: __SerdeC
alias: __expectString(output.alias),
arn: __expectString(output.arn),
createdAt:
output.createdAt !== undefined && output.createdAt !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
: undefined,
status:
output.status !== undefined && output.status !== null
? deserializeAws_restJson1WorkspaceStatus(output.status, context)
: undefined,
tags:
output.tags !== undefined && output.tags !== null
? deserializeAws_restJson1TagMap(output.tags, context)
: undefined,
output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
status: output.status != null ? deserializeAws_restJson1WorkspaceStatus(output.status, context) : undefined,
tags: output.tags != null ? deserializeAws_restJson1TagMap(output.tags, context) : undefined,
workspaceId: __expectString(output.workspaceId),
} as any;
};
Expand Down
Loading

0 comments on commit c20e037

Please sign in to comment.