-
Notifications
You must be signed in to change notification settings - Fork 142
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
π· Removing lodash dependencies #396
Conversation
1bf09fd
to
10defdd
Compare
10defdd
to
58e4aaa
Compare
) | ||
} | ||
if (isContext(value1) && isContext(value2)) { | ||
return Object.keys(value2).reduce( |
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.
A for/in loop or a (polyfilled) usage of Object.fromEntries
would be easier to understand and faster here.
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.
It's not really clear what's polyfilled and what is not π
And I'm not sure ObjectEntries
would be faster as it'll be doing an extra map
on the array
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.
It's not polyfilled. It would have a lower complexity, since you recreate the whole object for each key. Anyway, a for/in could do the trick :)
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.
LGTM.
Just one question.
Motivation
The SDK code being quite large β as you can see on bundlephobia β I wanted to remove lodash as it's quite big and can easily be replaced with something smaller.
Changes
Two dependencies got replaced:
lodash.merge
got replaced with a function that does the same thing, just without the ability to merge objects with circular referenceslodash.assign
got replaced with simple loop re-assigning keysTesting
Everything should work exactly the same, but happy to write more tests if needed.
I have gone over the contributing documentation.