Underscore.js | Introduction

Underscore.js is a lightweight JavaScript library and not a complete framework that was written by Jeremy Ashkenas that provides utility functions for a variety of use cases in our day to day common programming tasks.

With just under six kilobytes in size, this library basically provides us with a whole bunch of useful JavaScript functions for making our life easier, there are literally hundreds of different functions available that support both our workaday functional helpers such as the map and filter functions, as well as more specialized ones such as JavaScript templating, function binding, deep equality testing, creating quick indexes, and many more.

Underscore functions basically falls under four major categories which are functions that can be used for manipulating arrays, functions that can be used for manipulating objects, functions that can be used for manipulating both arrays as well as objects and functions that can be used for manipulating other functions itself.

Features of Underscore:

  • Perform common operations of data like arrays, objects, JSON files etc.
  • Compatible with other JS libraries like jQuery to perform DOM operation.
  • Conatains fucntion for data manipulation.

Kinds of Data Operation:

  • Fetch Data from Collection.
  • Transform Data in various formats.
  • Sort, Filter and Group Data.
  • Convert Data into Required result by performing specifc operation on them.
  • Templates can be used to perform data operations.

Installation:

  • Node.js:
    npm install underscore
  • Meteor.js:
    meteor add underscore
  • Require.js:
    require(["underscore"], ...
  • Bower:
    bower install underscore
  • ExtendScript:
    #include "underscore.js"

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.