Popular NPM Packages
As a follow up to my blog from last week on how to make your own npm package, I wanted to share some of the most popular npm packages with you and go over what they do.
Before I start going into individual packages let’s go through the overall numbers of npm packages:
- Right now their are over 1.6 million npm packages available for download.
- Right now npm has over 25 billion, yes billion, weekly downloads of their packages.
- Right now npm has around 120 billion monthly downloads!
As you can see from the numbers, npm packages are very popular and are used by all different types of developers and companies around the world.
Now that we have gone over the overall numbers lets go over some of the most popular npm packages right now.
react
Weekly downloads: 9,092,242
Homepage: https://reactjs.org/
Repository: https://github.com/facebook/react
Install: npm i react
React is a JavaScript library for building user interfaces. Right now it is one of (if not the most) popular JavaScript frontend framework.
React is:
- Declarative
React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable and easier to debug.
2. Component-Based
Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
3. Learn Once, Write Anywhere
React doesn’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using React Native.
lodash
Weekly downloads: 36,970,633
Homepage: https://lodash.com/
Repository: https://github.com/lodash/lodash
Install: npm i lodash
Lodash is a JavaScript library that helps programmers write more concise and maintainable JavaScript.
It can be broken down into several main areas:
- Utilities: for simplifying common programming tasks such as determining type as well as simplifying math operations.
- Function: simplifying binding, decorating, constraining, throttling, debouncing, currying, and changing the pointer.
- String: conversion functions for performing basic string operations, such as trimming, converting to uppercase, camel case, etc.
- Array: creating, splitting, combining, modifying, and compressing.
- Collection: iterating, sorting, filtering, splitting, and building.
- Object: accessing, extending, merging, defaults, and transforming.
- Seq: chaining, wrapping, filtering, and testing.
chalk
Weekly downloads: 79,105,438
Homepage: https://github.com/chalk/chalk#readme
Repository: https://github.com/chalk/chalk
Install: npm i chalk
Chalk allows user who install it to customize how text gets printed to the console when working with node.
Chalk Highlights:
- Expressive API
- Highly performant
- Ability to nest styles
- 256/Truecolor color support
- Auto-detects color support
- Doesn’t extend
String.prototype
- Clean and focused
- Actively maintained
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
Here is a list of the current styles chalk uses:
Modifiers
reset
- Resets the current color chain.bold
- Make text bold.dim
- Emitting only a small amount of light.italic
- Make text italic. (Not widely supported)underline
- Make text underline. (Not widely supported)inverse
- Inverse background and foreground colors.hidden
- Prints the text, but makes it invisible.strikethrough
- Puts a horizontal line through the center of the text. (Not widely supported)visible
- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
Colors
black
red
green
yellow
blue
magenta
cyan
white
blackBright
(alias:gray
,grey
)redBright
greenBright
yellowBright
blueBright
magentaBright
cyanBright
whiteBright
Background colors
bgBlack
bgRed
bgGreen
bgYellow
bgBlue
bgMagenta
bgCyan
bgWhite
bgBlackBright
(alias:bgGray
,bgGrey
)bgRedBright
bgGreenBright
bgYellowBright
bgBlueBright
bgMagentaBright
bgCyanBright
bgWhiteBright
tslib
Weekly downloads: 46,480,601
Homepage: https://www.typescriptlang.org/
Repository: https://github.com/Microsoft/tslib
Install: npm i tslib
Tslib is a runtime library for TypeScript that contains all of the TypeScript helper functions.
This library is primarily used by the --importHelpers
flag in TypeScript. When using --importHelpers
, a module that uses helper functions like __extends
and __assign
in the following emitted file:
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
exports.x = {};
exports.y = __assign({}, exports.x);
will instead be emitted as something like the following:
var tslib_1 = require("tslib");
exports.x = {};
exports.y = tslib_1.__assign({}, exports.x);
Because this can avoid duplicate declarations of things like __extends
, __assign
, etc., this means delivering users smaller files on average, as well as less runtime overhead. For optimized bundles with TypeScript, you should absolutely consider using tslib
and --importHelpers
.
axios
Weekly downloads: 15,546,143
Homepage: https://github.com/axios/axios
Repository: https://github.com/axios/axios
Install: npm i axios
Axios is a promise-based HTTP Client for node.js
and the browser. It is isomorphic ( it can run in the browser and nodejs with the same codebase). On the server-side it uses the native node.js http
module, while on the client (browser) it uses XMLHttpRequests.
Features:
- Make XMLHttpRequests from the browser.
- Make http requests from node.js.
- Supports the Promise API.
- Intercept request and response.
- Transform request and response data.
- Cancel requests.
- Automatic transforms for JSON data.
- Client side support for protecting against XSRF.
Axios is heavily inspired by the http service provided in Angular. Ultimately axios is an effort to provide a standalone http
-like service for use outside of Angular.
express
Weekly downloads: 14,352,772
Homepage: http://expressjs.com/
Repository: https://github.com/expressjs/express
Install: npm i express
Express is a fast, un-opinionated, minimalist web framework for node.
Express is used for:
Web Applications
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
APIs
With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy.
Performance
Express provides a thin layer of fundamental web application features, without obscuring Node.js features that you know and love.
Frameworks
Many popular frameworks are based on Express.
Express is the back-end component of popular development stacks like the MEAN, MERN or MEVN stack, together with the MongoDB database software and a JavaScript front-end framework or library.
These are just a few of the many popular npm packages out there. You can check out other popular libraries and discover new ones based on your own criteria on the npm homepage. Have fun exploring and utilizing all that npm has to offer!