Using NPM Packages
Writing repetitive code is easily the bane of every coder’s existence. No one wants to continue copying and pasting code all throughout their project. Rather than writing long chunks of code, having a concise, readable structure is key for good code.
Enter NPM Packages.
Node.js applications use the over million open-source packages that are present in the NPM package library. These are used from the smallest, everyday projects to the larger, more complex ones. Currently, it is estimated that 97% of code in modern web apps comes from NPM modules.
Installing and using them is as easy as opening a terminal window and writing the command npm i [name of package]. Using them is also critical to getting any web application to function properly.
Here are some of the most useful and widely used packages.
Lodash => makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc.
Underscore =>useful functional programming helpers without extending any built-in objects. Underscore provides over 100 functions that support both your favorite workaday functional helpers: map, filter, invoke — as well as more specialized goodies: function binding, javascript templating, creating quick indexes, deep equality testing, and so on.
Date-fns => provides the most comprehensive, yet simple, and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
Bcrypt => A library to help you hash passwords.
Debug => A debugging utility modelled after Node.js core’s debugging technique. Works in Node.js and web browsers.
ESLint => statically analyzes your code to quickly find problems.
Nodemon => a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development.