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

Upgrade to lodash4 #50

Merged
merged 1 commit into from
Feb 4, 2016
Merged

Upgrade to lodash4 #50

merged 1 commit into from
Feb 4, 2016

Conversation

aaronjensen
Copy link
Member

Before:

98127 Jan 14 08:07 updeep-standalone.js
22064 Jan 14 08:07 updeep-standalone.min.js

After:

134138 Jan 14 08:05 updeep-standalone.js
 29916 Jan 14 08:05 updeep-standalone.min.js

@aaronjensen
Copy link
Member Author

@jdalton I'm wanting to upgrade to lodash 4, but it adds 36k (8k minified), is this to be expected? Are there webpack hacks I could be applying to help?

@aaronjensen
Copy link
Member Author

webpack stats.json after
stats.json.txt

@jdalton
Copy link

jdalton commented Jan 14, 2016

See redux/webpack.config.base.js.

You can use the webpack.NormalModuleReplacementPlugin to remove callback shorthand support by mapping 'lodash/internal/baseIteratee.js' to './toFunction.js'.

@aaronjensen
Copy link
Member Author

new webpack.NormalModuleReplacementPlugin(/\blodash\/internal\/baseIteratee\.js$/, './toFunction.js'),

That certainly helps:

91731 Jan 14 08:48 updeep-standalone.js
21118 Jan 14 08:48 updeep-standalone.min.js

But, given that I expose a wrapped version of reject, it's nice to still support the shorthand syntax.

tbh, I was hoping that lodash 4 would expose fp functions in such a way that they could be imported in a one off basis instead of having to get the whole she-bang. That would allow me to drop many of the functions in updeep and point to using lodash instead.

@jdalton
Copy link

jdalton commented Jan 14, 2016

tbh, I was hoping that lodash 4 would expose fp functions in such a way that they could be imported in a one off basis instead of having to get the whole she-bang.

Good news, that landed by way of lodash/lodash#1779. It'll be in the next release.

@aaronjensen
Copy link
Member Author

Awesome. Thanks @epeli and @jdalton!

@mark-rushakoff
Copy link

@aaronjensen lodash 4.1.0 has been released. I'm excited for lodash 4 with updeep!

@aaronjensen
Copy link
Member Author

@mark-rushakoff I don't think it has yet: https://www.npmjs.com/package/lodash

@mark-rushakoff
Copy link

My bad. Their readme was updated a couple hours ago for 4.1.0, but you're right, it hasn't been tagged or pushed to npm yet.

I was so excited for it I couldn't even be bothered to make sure the release was all finished and proper! ;)

aaronjensen added a commit that referenced this pull request Feb 4, 2016
@aaronjensen aaronjensen merged commit 50ccee2 into master Feb 4, 2016
@aaronjensen aaronjensen deleted the lodash4 branch February 4, 2016 14:20
@mark-rushakoff
Copy link

@aaronjensen When can we expect the next release of updeep that includes lodash 4?

@aaronjensen
Copy link
Member Author

@mark-rushakoff 0.13.0 is out, thanks for the reminder. I had looked into deprecating some of the functions first but ran into snags with the way lodash/fp works 😞

@jdalton
Copy link

jdalton commented Feb 11, 2016

Next lodash bump the fp behavior will be configurable :)

@aaronjensen
Copy link
Member Author

@jdalton sweet, i'm curious to see how that looks in practice

@jdalton
Copy link

jdalton commented Feb 11, 2016

It'll look like

var convert = require('lodash/fp/convert');

/*
 * @param {Object} [options] The options object.
 * @param {boolean} [options.cap=true] Specify capping iteratee arguments.
 * @param {boolean} [options.curry=true] Specify currying.
 * @param {boolean} [options.fixed=true] Specify fixed arity.
 * @param {boolean} [options.immutable=true] Specify immutable operations.
 * @param {boolean} [options.rearg=true] Specify rearranging arguments.
*/
var remove = convert('remove', _.remove, {
  'cap': false,
  'curry': false,
  'fixed': false,
  'immutable': false,
  'rearg': false
});

@aaronjensen
Copy link
Member Author

@jdalton Which argument is it in particular that would enable reject's predicate to take multiple args? is that cap? I was afraid it would look like this, but I suppose a webpack loader could help clean it up.

@jdalton
Copy link

jdalton commented Feb 11, 2016

Yep cap.

I was afraid it would look like this, but I suppose a webpack loader could help clean it up.

Feel free to make suggestions.

@aaronjensen
Copy link
Member Author

Well, my suggestion is to make cap true by default. I think it is less surprising and lets you use the full power of the lodash functions.

FWIW I think using parseInt w/o a radix is a bad idea any way 😄

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.

3 participants