Recommended NPM Packages Q2 2016

I want to be as fast and efficient as possible when writing Node.js code. I have found the key to this is discovering and using the "right" NPM packages. When walking into new territory I have found that determining the "right" NPM package can be a very time-consuming process. Here is a list of the packages that I have found to be the most useful.

async

Async is the most popular library on NPM for dealing with writing asynchronous JavaScript. The Async library only offers Node.js style callback support and lacks support for promises. The Async library has the ability to limit parallelism when running an array of callbacks which I have found to be useful in practice. The Async library is extremely comprehensive and has methods for almost all async scenarios you will run into with Node.js.

commander

Commander is a wonderful command-line parsing tool.

moment

Moment.js is a great library for dealing with dates in javascript. Moment.js has date formatters for all the common date formats, e.g., 'DD/MM/YYYY'. Moment.js has a convenient fluent interface for adding time to a date, e.g., moment('2016-03-12 13:00:00').add(1, 'day').add(1, 'hour').format('LLL').

sequelize

Sequelize is a very good promise based ORM library for Node.js. It has support for PostgreSQL, MySQL, MariaDB, SQLite and MSSQL. You will find some nice light-weight ORM support but you can always drop down to raw sql with calls like the following:

sequelize.query('SELECT * FROM CUSTOMER', { type: sequelize.QueryTypes.SELECT }).then(function (results) {  
  // SELECT query - use then
})