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

Replaced lodash pullAllWith with Array.filter() #7861

Merged
merged 5 commits into from Jun 26, 2020

Conversation

calganaygun
Copy link
Contributor

Adresses #7747

_.pullAllWith replaced with Array.filter()

@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2020

Codecov Report

Merging #7861 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7861      +/-   ##
==========================================
- Coverage   88.41%   88.41%   -0.01%     
==========================================
  Files         244      244              
  Lines        9047     9046       -1     
==========================================
- Hits         7999     7998       -1     
  Misses       1048     1048              
Impacted Files Coverage Δ
lib/plugins/aws/deploy/lib/cleanupS3Bucket.js 100.00% <100.00%> (ø)

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 f2e1942...69134ca. Read the comment docs.

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@calganaygun great thanks for giving that a spin. Still please see my minor suggestion

@@ -25,7 +25,7 @@ module.exports = {
.then(response => {
const stacks = findAndGroupDeployments(response, prefix, service, stage);
const stacksToKeep = stacks.slice(-stacksToKeepCount || Infinity);
const stacksToRemove = _.pullAllWith(stacks, stacksToKeep, _.isEqual);
const stacksToRemove = stacks.filter(i => !stacksToKeep.includes(i));
Copy link
Contributor

Choose a reason for hiding this comment

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

From what I see logic above is about splitting stacks into two slices stacksToKeep and stacksToRemove, and In that case I think stacksToRemove can also be constructed with slice same as stacksToKeep:

stacksToRemove = stacks.slice(0, -stacksToKeepCount || Infinity);

I think above notation will be more accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I focused replacing lodash functions #7747 from this issue. So, I did not see this point. Thanks

@calganaygun calganaygun requested a review from medikoo June 25, 2020 10:35
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@calganaygun looks good! Can you just ensure branch is up to date with master (so new CI/CD jumps in)

@calganaygun calganaygun requested a review from medikoo June 25, 2020 16:30
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @calganaygun !

That way by replacing lodash, we replaced some unnecessary convoluted part with something simple and straightforward achieved just by native means :)

@medikoo medikoo merged commit f6743e9 into serverless:master Jun 26, 2020
@exoego exoego mentioned this pull request Jun 26, 2020
54 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants