Skip to content

Remove lodash dependency #173

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

Closed
wants to merge 7 commits into from
Closed

Conversation

EdwardDrapkin
Copy link

@EdwardDrapkin EdwardDrapkin commented Aug 20, 2016

Hey there,

I noticed you had done some work recently to reduce the bundle size incurred by using lodash, so I went ahead and pulled all of it out.

Here's what I did:

  1. I created utils.js with IE8-compatible implementations of isFunction(), isArray() and isObject().
  2. I replaced calls to _.isFunction(),_.isArray() and _.isObject() with those implementations.
  3. I replaced calls to _.assign() with Object.assign() and added babel-plugin-transform-object-assign to maintain IE8 compatibility with _.assign().
  4. I replaced a call to _.isUndefined(map[key]) with (!(key in map)).
  5. I replaced a call to _.forEach(obj) with for(const key in obj).
  6. I replaced a call to _.trim() with a trim() implementation that uses str.trim() or a regex if it's not there for IE8 support.
  7. I replaced a call to _.filter() with a filterForTruthy() function.

If you don't care about IE8 support, let me know because a lot of the code here is for IE8 support.

Thanks!

@EdwardDrapkin
Copy link
Author

I went ahead and fixed the tests so that they passed the eslint check too. The build should run fine now.

Sorry for spamming the PR with commits, my IDE was setup to use my eslint file, not yours. Oops!

@gajus
Copy link
Owner

gajus commented Aug 20, 2016

I noticed you had done some work recently to reduce the bundle size incurred by using lodash, so I went ahead and pulled all of it out.

Please consider raising an issue prior to starting to work on a PR. As a very least, it is worth checking the existing issues/ PRs:

Closing. No intention to stop using lodash. Note, that we are only bundling the utility functions that we are using; not the entire lodash library.

@gajus gajus closed this Aug 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants