I noticed that Lo-Dash has a special Underscore-compatible build, ostensibly to address differences in function arguments/operations (since Lo-Dash is a superset of Underscore, I assume there are no Underscore functions missing from Lo-Dash).
I've also noticed that BackboneJS can be used with either Underscore or Lo-Dash.
My question: would it be unwise to use a "normal" build of Lo-Dash with BackboneJS? I can't find any indication of whether or not people are doing this in the wild, but it seems like a bad idea, especially if BackboneJS relies on functions that may be different in these builds. At the same time, it would be nice to use some of the newer functions in Lo-Dash, so I'd hate to miss out on those if it isn't necessary.
It is designed for developing single-page web applications, and for keeping various parts of web applications (e.g. multiple clients and the server) synchronized. Backbone was created by Jeremy Ashkenas, who is also known for CoffeeScript and Underscore. js.
Because Lodash is updated more frequently than Underscore. js, a lodash underscore build is provided to ensure compatibility with the latest stable version of Underscore.
Backbone. js is a model view controller (MVC) Web application framework that provides structure to JavaScript-heavy applications. This is done by supplying models with custom events and key-value binding, views using declarative event handling and collections with a rich application programming interface (API).
I usually recommend trying Lo-Dash as is first. If you have issues you can drop back to the Underscore compat build. This goes for new projects or those already using Underscore and wanting to change.
You can also leverage the build utility and say create a version of Lo-Dash that uses the Underscore chaining style with something like lodash -d plus=chain
.
[edit] From personal experience after using lodash for quite a while, I find that the differences are not too big a deal. I would suggest you DO use the normal build, but if you don't want to take any risk, go with the compat build.
To know the answer, see this wiki page, which summarizes the differences between the underscore Lo-Dash build and plain Lo-Dash:
https://github.com/lodash/lodash/wiki/build-differences
_.chain
method is still there if you want to use it._.each
method does not exit early if the callback returns false_.defaults
and _.extend
method iterate over inherited properties of source objects_.contains
, _.omit
, _.pick
, and _.template
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With