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

Reduce dependency on lodash functions: includes, uniq, repeat, isinteger #11790

Merged
merged 13 commits into from Jul 6, 2020
Merged

Reduce dependency on lodash functions: includes, uniq, repeat, isinteger #11790

merged 13 commits into from Jul 6, 2020

Conversation

jayaddison
Copy link
Contributor

@jayaddison jayaddison commented Jul 4, 2020

Q                       A
Fixed Issues? Relates to #11789
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? No
Any Dependency Changes? No
License MIT

This change incorporates feedback from #11789 - in particular, the following lodash functions are replaced with JavaScript built-in functions:

  • lodash/includes is replaced by Array.prototype.includes
  • lodash/values is replaced by Object.values Object.values is fully-supported from Node 7.x
  • lodash/uniq is replaced by Array.from(new Set(...))
  • lodash.repeat is replaced by String.prototype.repeat
  • lodash.isinteger is replaced by Number.isInteger

@jayaddison jayaddison changed the title Dependencies/reduce lodash usage Reduce dependency on lodash functions: includes, values, uniq Jul 4, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 4, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ad95ab8:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented Jul 4, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25373/

@jayaddison jayaddison changed the title Reduce dependency on lodash functions: includes, values, uniq Reduce dependency on lodash functions: includes, uniq Jul 4, 2020
@jayaddison jayaddison changed the title Reduce dependency on lodash functions: includes, uniq Reduce dependency on lodash functions: includes, uniq, repeat, isinteger Jul 4, 2020
@existentialism existentialism added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jul 5, 2020
@nicolo-ribaudo
Copy link
Member

lodash/values is replaced by Object.values Object.values is fully-supported from Node 7.x

After that this PR and the other one are merged to main, I will also merge them to the next-8-dev branch: Babel 8 will require Node.js 8+, so we can then remove other lodash modules.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! 🎉

@hzoo
Copy link
Member

hzoo commented Jul 6, 2020

Awesome!

I think for Object.values we can just do this instead? 9fd3679#diff-11a6b6c946b2660882f17e01aa180067L548

- const args = values(outsideRefs).map(id => t.cloneNode(id));
+ const args = Object.keys(outsideRefs).map((ref) => t.cloneNode(outsideRefs[ref]));

@jayaddison jayaddison deleted the dependencies/reduce-lodash-usage branch July 6, 2020 17:49
@jayaddison
Copy link
Contributor Author

Yep, thanks - good idea! See follow-up #11798 for a replacement of lodash.values.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants