Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Reconciling iteratee behaviour #1

Closed
megawac opened this issue Jun 4, 2015 · 5 comments
Closed

Reconciling iteratee behaviour #1

megawac opened this issue Jun 4, 2015 · 5 comments
Labels

Comments

@megawac
Copy link
Contributor

megawac commented Jun 4, 2015

I've been mostly silent on the merge but I think this is a great step forward. I would love to see a base platform which both underscore and lodash use. For this to work, strict semver will be a must going forward.


A major difference between underscore and lodash currently is how iteratees are created. As I assume this implementation will use iteratee in the same places both libraries currently do this may prove a major incompatibility.

For instance, lodash's iteratee has deep string support. Personally, I think this should be removed in v4 in favour of making the user explicitly request deep (e.g. _.map(obj, _.propertyDeep('a.b.c'))).

@jashkenas
Copy link
Contributor

I would love to see a base platform which both underscore and lodash use.

To be clear, I'm hoping that instead of fragmentation, "Underdash 1.0" would be both "Lodash 4.0" and "Underscore 2.0". Otherwise, there's much less of a point.

Explicitly requesting deep path support seems wise.

@jridgewell
Copy link
Contributor

I think deep support can be pretty easily integrated. Consider _.iteratee's "special" types:

  • null and undefined returns _.identity
  • function returns a bound (if necessary) function
  • object returns a _.matcher function
  • string returns a _.property function

Why not add array support for deep properties?

_.map(obj, ['a', 'b', 'c'])

@megawac
Copy link
Contributor Author

megawac commented Jun 4, 2015

I'm just not a big fan of how its currently handled in lodash (I'd prefer something more explicit like what you mentioned). I do not want to see us parsing strings (theres like 40 related issues in underscore).

@megawac
Copy link
Contributor Author

megawac commented Jun 5, 2015

"Underdash 1.0" would be both "Lodash 4.0" and "Underscore 2.0"

I think this is a good long term goal, but I expect for the merge to succeed we should start smaller. Both underscore and lodash have prominent identities in the JS community and currently have some ideological differences.

I see the starting point for this as making underdash the place to implement a core API for both libraries to share, and then have both libraries import (whether CJS/compilation/etc) the implementation herein this repo. Anyway, this conversation should probably moved to another thread (it was on gitter earlier https://gitter.im/jashkenas/underscore).

@jdalton
Copy link
Contributor

jdalton commented Feb 13, 2016

Closed by #14.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants