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

Need Comprehensive Review of Underscore usage #21

Closed
ifandelse opened this issue Dec 8, 2012 · 5 comments
Closed

Need Comprehensive Review of Underscore usage #21

ifandelse opened this issue Dec 8, 2012 · 5 comments

Comments

@ifandelse
Copy link
Contributor

Review code base for underscore usage. If it's feasible to use shims and keep IE8+ support, let's do it.

@webpro
Copy link
Contributor

webpro commented Dec 8, 2012

Thought this might come in handy. This what's currently in use of underscore (in /src dir):

$ grep -rhoe '_\.[^(]\+' . | sort | uniq
_.after
_.all
_.any
_.bind
_.clone
_.debounce
_.each
_.isArray
_.isEqual
_.isFunction
_.isNaN
_.isObject
_.isString
_.throttle
_.without

Btw, a custom Lo-Dash build might be an option.

@ifandelse
Copy link
Contributor Author

@webpro Thanks - you saved me a lot of trouble! :-) I've been considering a few different options going forward, since we're about to make another pass over the API and try to normalize some things between channel def and top level pub/sub calls. Among the options I'm pondering:

  • With regards to dependencies:
    • non underscore/lodash build using shims if it significantly reduces footprint.
    • custom underscore or lodash build containing only the pieces postal utilizes
    • leaving things as they are
  • With regards to modularity/build customizations
    • any shims/custom underscore/lodash builds would ideally be swappable (i.e. - why carry the extra weight of the shims if the project is already using underscore for other needs?)
    • separate some of the additional features on the SubscriptionDefinition prototype into an add-on, so that you could opt-in to the fluent calls like "withDebounce", etc. by including that add-on (or using a postal build that has it included already)
    • Whatever & however we decide to break things up - my intent is to always provide a simple "everything" build of postal, with the custom builds for more advanced/targeted situations.

Anyway - just thought I'd explain more of what I'm thinking along these lines. Sounds like you may have predicted some of that as well :)

@jbadeau
Copy link

jbadeau commented Apr 24, 2013

On a related topic, it seems that the native (ECMA-262 ), underscore and lo-dash forEach method behave different when dealing with arrays that contain elements that are undefined. IE8<= also behaves different than the other browsers.

@bitmage
Copy link

bitmage commented Sep 18, 2013

The new Lodash release gives you lots of options for trimming down the lib size. You might want to take a look at that:

http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/

@ifandelse
Copy link
Contributor Author

Closing this out. Lodash has replaced underscore since v0.9 (IIRC), and future work may explore custom builds of lodash or ES6 builds...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants