Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use destructuring in xml deserializeMap #1181

Merged
merged 2 commits into from
May 14, 2020

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented May 14, 2020

Issue #, if available:
N/A

Description of changes:
use destructuring in xml deserializeMap

  • Before
const deserializeAws_queryDomainNameMap = (
  output: any,
  context: __SerdeContext
): { [key: string]: string } => {
  return output.reduce((acc: any, pair: any) => {
    acc[pair["key"]] = pair["value"];
    return acc;
  }, {});
};
  • After
const deserializeAws_queryDomainNameMap = (
  output: any,
  context: __SerdeContext
): { [key: string]: string } => {
  return output.reduce(
    (acc: any, pair: any) => ({
      ...acc,
      [pair["key"]]: pair["value"]
    }),
    {}
  );
};

Verified by running the following in browser JavaScript console:

const obj = [{ key: "one", value: "1" }];

obj.reduce((acc, pair) => {
  acc[pair["key"]] = pair["value"];
  return acc;
}, {});

obj.reduce((acc, pair) => ({ ...acc, [pair["key"]]: pair["value"] }), {});

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: da3c5ac
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@codecov-io
Copy link

Codecov Report

Merging #1181 into master will decrease coverage by 0.21%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1181      +/-   ##
==========================================
- Coverage   73.52%   73.31%   -0.22%     
==========================================
  Files         285      285              
  Lines       12497    12391     -106     
  Branches     2892     2892              
==========================================
- Hits         9189     9085     -104     
+ Misses       3308     3306       -2     
Impacted Files Coverage Δ
protocol_tests/aws-json/protocols/Aws_json1_1.ts 66.66% <0.00%> (-2.07%) ⬇️
...ol_tests/aws-restjson/protocols/Aws_restJson1_1.ts 62.15% <0.00%> (-1.33%) ⬇️
protocol_tests/aws-query/protocols/Aws_query.ts 68.60% <0.00%> (-0.31%) ⬇️
protocol_tests/aws-ec2/protocols/Aws_ec2.ts 63.56% <0.00%> (-0.26%) ⬇️
...rotocol_tests/aws-restxml/protocols/Aws_restXml.ts 67.25% <0.00%> (-0.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54ec57b...da3c5ac. Read the comment docs.

Copy link
Contributor

@alexforsyth alexforsyth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor formatting comments

@trivikr trivikr merged commit 5a92d6b into aws:master May 14, 2020
@trivikr trivikr deleted the destructuring-reduce-xml-deserializeMap branch May 14, 2020 18:05
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants