-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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(gatsby-source-contentful): drop last usages of lodash #28441
Conversation
@@ -178,11 +176,8 @@ const resolveFixed = (image, options) => { | |||
) | |||
}) | |||
|
|||
// Sort sizes for prettiness. | |||
const sortedSizes = _.sortBy(filteredSizes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The array is initialized ordered. It is only pruned, not shuffled / added. So this sort should be a noop in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warrants a comment that fixedSizes
is expected to be sorted in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
} | ||
|
||
// Sort sizes for prettiness. | ||
const sortedSizes = _.sortBy(filteredSizes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sort is similar to above except the condition before it does not exist in the other case.
The condition will only add the current width if it doesn't already exist here. And the loop before will cull any widths that are greater than this width. So either way, the width should be the last element in the list. This means the .sortBy
is equally useless here and is safe to drop.
Co-authored-by: Vladimir Razuvaev <[email protected]>
Ok. This branch switching is a little funky :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
P.S. Love the branch name 😄
…#28441) * chore(gatsby-source-contentful): drop last usages of lodash * Update packages/gatsby-source-contentful/src/extend-node-type.js Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: Vladimir Razuvaev <[email protected]>
Drops the last remaining cases of lodash from this file.
See inline comments for clarification