Top NPM Packages You May Have Missed
By: John Au-Yeung
Tags: Technology, Programming, Software Development, Web Development, JavaScript

Photo by jesse ramirez on Unsplash

NPM packages are used by both browser and Node.js apps alike. NPM is the biggest repository of JavaScript libraries.

In this article, we’ll look at the top JavaScript packages on NPM.

Lodash is the most popular utility library used in JavaScript programs.

It lets us do math operations, manipulate objects, and work with arrays easily.

Some of them have plain JavaScript equivalents, but there’re many that still have no equivalent in the JavaScript standard library.

Therefore, it’s still a useful library for many JavaScript projects.

React is one most of the most popular JavaScript libraries for building browser web apps.

It has its own unique JSX syntax which lets us manipulate the DOM in an easy way.

Therefore it’s one library that we should learn how to use if we want to be a front end developer.

Chalk is a library for Node.js command-line apps to let us style text the way we want them to be displayed on the screen.

We can set colors, and compose styles easily with it.

Request is an HTTP client that can be used in Node.js apps.

We can make HTTP and HTTPS requests with it. Headers, bodies, and responses can all be processed with this library.

However, it’s deprecated so we may want to find another library like Axios for making HTTP requests.

Commander lets us run shell command automatically within a Node.js program.

It allows us a lot more flexibility than running with commands with spawn or other built-in Node.js programs for running child processes within a Node program.

Since the JavaScript Date constructor is deficient in features, many JavaScript date manipulation libraries have been made to address the issues with it.

One of them is the moment.js library. We can use it to parse date strings, add and subtract dates, get elapsed time, and do many other things that are hard with the native Date contructor.

Express is a micro-framework for building back end web apps.

It works by chaining together a bunch of middleware that are bound together by the Express framework.

It’s very basic. All it has is routing and abilities to listen to HTTP requests out of the box.

Anything else has to be done with its own middleware, 3rd party middleware, or we can write our own.

React DOM is a core library that goes with React. It lets React manipulate the DOM so that we can mount our app into a web page so that the React app can be run.

Prop-types is the library for validation prop types of React components.

We can watch the value of the props and validate them as they’re being passed in from parent components.

By default, we can pass in any values as props, which isn’t good since it’s error-prone as there’s no validation for data types or formats.

This library lets us do the required validation so that we can deal with props easier.

The debug library is used for making debugging Node apps easier.

We can just include this library and use it to add debug messages in the places that we wish to find out what’s going on with our app.

Photo by Daily Nouri on Unsplash

fs-extra has file manipulation methods that aren’t present in the Node’s built-in fs module.

It includes methods for copying files, making directories, checking for empty directories, reading JSON, and more.

Both synchronous and promise-based versions of the methods are available.

Axios is a popular HTTP client that can be used by browser and Node apps.

We can make any kind of HTTP request with it with various HTTP headers, and bodies.

Also, it can handle different kinds of responses with ease, including text and JSON, binary responses.

It also has HTTP interceptors to let us configure requests before they’re made, thereby eliminating repetition.

The async library has methods for doing various operations asynchronously, including iteration, filtering, concatenation, mapping values, and much more.

It has many other methods for control for and error handling, all done asynchronously.

Conclusion

We can do a lot with the top libraries.

They can be used to make full-featured front end and back end apps when we incorporate them with other supporting libraries.

We can make simple apps just with these libraries alone.

A note from the Plain English team

Did you know that we have four publications? Show some love by giving them a follow: JavaScript in Plain English, AI in Plain English, UX in Plain English, Python in Plain English — thank you and keep learning!

Also, we’re always interested in helping to promote good content. If you have an article that you would like to submit to any of our publications, send an email to submissions@plainenglish.io with your Medium username and what you are interested in writing about and we will get back to you!