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

[code quality] Using repeated push() instead of map() #1252

Open
ilyash-b opened this issue Jan 16, 2025 · 1 comment
Open

[code quality] Using repeated push() instead of map() #1252

ilyash-b opened this issue Jan 16, 2025 · 1 comment

Comments

@ilyash-b
Copy link

for (const managedSessionPolicy of managedSessionPoliciesInput) {
managedSessionPolicies.push({ arn: managedSessionPolicy });
}

Should be something like (untested):

const managedSessionPolicies: { arn: string }[] = managedSessionPoliciesInput.map((arn) => ({ arn }));

( and remove const managedSessionPolicies... earlier in the original code)

@ilyash-b
Copy link
Author

ilyash-b commented Jan 16, 2025

Can also be

const managedSessionPolicies = managedSessionPoliciesInput.map((arn) => ({ arn }));

( without typing )

or if you find it more readable:

const managedSessionPolicies = managedSessionPoliciesInput.map((policy) => ({ arn: policy }));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant