Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did Underscore.js remove support for AMD?

1.3.0 — Jan. 11, 2012 Removed AMD (RequireJS) support from Underscore. If you'd like to use Underscore with RequireJS, you can load it as a normal script, wrap or patch your copy, or download a forked version.

Why have they done it? Does anyone know? Because they added it only few month ago (in October), and AMD (Asynchronous Module Definition) is said to be far superior to CommonJS modules.

Update: As of December 2013, this has been supported again.

like image 955
c69 Avatar asked Jan 25 '12 20:01

c69


People also ask

What is the point of underscore JS?

Underscore. JS is a popular javascript based library which provides 100+ functions to facilitate web development. It provides helper functions like map, filter, invoke as well as function binding, javascript templating, deep equality checks, creating indexes and so on.

Do you need underscore JS?

Underscore ( _ ) is just a plain valid character for variable/function name, it does not bring any additional feature. However, it is a good convention to use underscore to mark variable/function as private. You can check Underscore prefix for property and method names in JavaScript for some previous discussion.

Why is JavaScript underscore better?

It provides utility functions for a variety of use cases in our day-to-day common programming tasks. Underscore. js provides a lot of features that make our task easy to work with objects. It can be used directly inside a browser and also with Node.


2 Answers

Jeremy gave his reasoning in the comments of the commit:

Yep. Not supporting a particular script loader will definitely make it easier for all of them to work properly.

I apologize for merging the support in the first place.

He also tweeted a bit more on the change (link from a later comment):

… because AMD support is breaking regular Underscore embeds on pages that also happen to use Require.js …

like image 127
Jonathan Lonowski Avatar answered Sep 22 '22 23:09

Jonathan Lonowski


The developers of Underscore thought that having AMD support would break support on non-AMD enabled scripts. This is actually not the case, as you can have a script that is both AMD-enabled but also works as-is on a non-AMD deployment.

There is now a drop-in replacement for Underscore: Lo-Dash. Which, along with other features not in Underscore, includes AMD/non-AMD duality.

like image 38
Angelos Pikoulas Avatar answered Sep 19 '22 23:09

Angelos Pikoulas