Search Result


My favorite JavaScript libraries

JavaScript libraries appear on a daily basis, and I think it is almost impossible to catch up.

For this article, I'll stick to libraries and plug-ins and leave full frameworks for some other time. These are libraries that I have personally used in my developments.

moment.js

DateTime objects are always hell. Your application has one specification, the user's OS has another one, the Database another one, the user's Excel has another one, the browser reads whatever the hell it wants... back to client-side stuff.

The date object in JavaScript is incredibly robust, but hard to dominate and maybe perceived as complex, momentjs is a thin library (15.7kb minified version and 50kb with locales!) that reduces the Date object complexity, while adding incredible useful features.

The following regular constructor:

var today = new Date();  

Barely translates to this with momentjs

var today = moment();  

With momentjs, it is possible to construct a Date from a string, preferably if you know the format.

// moment ignores non-alpha numeric characters, so both constructors are valid!
moment("02-12-2016", "MM-DD-YYYY");  
moment("02/12/2016", "MM-DD-YYYY");

// It also understands the ASP.NET JSON format!
moment("/Date(1198908717056-0700)/");

// Calculating date differences is a bliss!
var firstDate = moment([2007, 0, 29]);  
var secondDate = moment([2007, 0, 28]);  
firstDate.diff(secondDate, 'days') // 1  

Be sure to read the full documentation.

c3.js

cs.js is built on top of d3.js, an incredible robust library used to generate data driven documents.

C3.js simplifies the complexity of d3.js by wrapping some of its functionality, creating a powerful charting library. C3.js has Line charts, timeline charts, donut charts, pie charts, area charts, and many more!

It is very customizable, and allows many data sources, including JSON, JavaScript arrays, and direct urls containing csv files. It also supports some basic but powerful animations.

Be sure to check it out.

DataTables.net

In most of my experience, clients always need some sort of Grid for their applications, they are excellent to represent big amounts of data.

Some years ago, what I used to do was to rely on server-side technologies, such as ASP.NET native GridView controller or Telerik's ASP.NET AJAX Grid.

Recently, other technologies have risen in popularity, like Kendo UI and many others. The problem with these technologies is well, the cost.

DataTables.net is an excellent open source jQuery plugin that allows you to visualize Datagrids, and it's actually what is used as a default option in many commercial and open source templates. It is easily customizable and is very rich in terms of features. Theming with Bootstrap, jQuery UI and Foundation is very easy. It allows both client and server-side processing.

Be sure to check it out!

FormValidation.io

JavaScript validation has certainly evolved since it first appeared. Validating a form can be easily done with vanillajs, but there are plenty of libraries that allow an easier and possibly a richer form validation.

My favorite jQuery form validation is FormValidation.io, it blends easily with many front-end view engines, such as Boostrap and Semantic UI.

It also comes with 51 out of the box validators!

Be sure to check it out.

JavaScript Cookie

I spoke about cookie management before.

JavaScript Cookie is an excellent and lightweight JavaScript library that allows easy cookie management.

Creating a cookie is as easy as this:

Cookies.set('mycookie', 'mysexyvalue');  

Be sure to check the project homepage, the library is packed with very interesting features.

reveal.js

Reveal.js is the Prezi for developers. Don't know how to code? Don't worry! You can check Slides.com for an easier approach.

Reveal.js allows you to create HTML5 presentations easily. Some great features of Reveal.js include video (including .webm!) and gif backgrounds, easy theming and many more.

Author image
Profound Jack Daniel's enthusiast. In my free time, I like to code and lift weights. Proud owner of two Siberian huskies. Professional Services Manager at Medallia.