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

Replace lodash named imports with specific imports #9787

Merged
merged 2 commits into from
Feb 7, 2020
Merged

Replace lodash named imports with specific imports #9787

merged 2 commits into from
Feb 7, 2020

Conversation

lgraziani2712
Copy link
Contributor

@lgraziani2712 lgraziani2712 commented Feb 7, 2020

fix: replace the use of isNill to the double eq comparison against null.

Issue: fix #9778

What I did

  • Replace named imports for lodash to specific imports.
  • Replace imports for lodash/isNil with non-strict null comparison. Is what isNil have btw.
  • Replace some lodash/values with Object.values (what is also being used in the rest of the codebase).

How to test

  • Is this testable with Jest or Chromatic screenshots? No
  • Does this need a new example in the kitchen sink apps? No
  • Does this need an update to the documentation? No

If your answer is yes to any of these, please make sure to include it in your PR.

Thank you!

fix: replace the use of isNill to the double eq comparison against null.
@shilman shilman added the maintenance User-facing maintenance tasks label Feb 7, 2020
@shilman shilman added this to the 6.0.0 milestone Feb 7, 2020
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

@lgraziani2712 in all the isNil cases, what about undefined values? cc @patricklafrance

@lgraziani2712
Copy link
Contributor Author

The non-strict null comparison checks if the value is nullish (null or undefined): http://adripofjavascript.com/blog/drips/equals-equals-null-in-javascript.html

BTW, is the same comparison used by lodash/isNil: https://github.com/lodash/lodash/blob/master/isNil.js#L19

@shilman
Copy link
Member

shilman commented Feb 7, 2020

@lgraziani2712 awesome. learn something new every day! 💯

@shilman shilman changed the title fix #9778: replace esModule named imports for lodash to specific imports Replace lodash named imports with specific imports Feb 7, 2020
@shilman shilman merged commit aed5276 into storybookjs:next Feb 7, 2020
@lgraziani2712 lgraziani2712 deleted the fix-9778 branch February 7, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why are lodash imports as named imports? This adds the entire lodash to the dist
2 participants