5 Underrated NPM Packages You’re Not Using (But Should Be)
Balraj Singh

Balraj Singh @balrajola

About: Software engineer with 10 years experience developing simple & anti-fragile software for high-volume businesses. Improved Mobile App's stability and responsiveness by incorporating patterns & practice

Joined:
Jan 24, 2023

5 Underrated NPM Packages You’re Not Using (But Should Be)

Publish Date: Dec 10 '24
85 10

The world of NPM is vast. With over 2 million packages available, it’s easy to gravitate towards the big names—React, Lodash, Express—and miss out on some truly underrated gems that could make your life as a developer so much easier.

1. date-fns-tz
Solve Time Zone Headaches Without the Overhead

Time zones are the worst. Parsing and formatting dates across time zones can quickly turn into a nightmare. While libraries like moment-timezone are popular, they’re often bloated and outdated. Enter date-fns-tz.

Why it’s underrated:

  • Lightweight and built on top of date-fns.
  • Focused on time zone management, not everything under the sun.
  • Modern, tree-shakable, and perfect for modular projects.

Use case:
You’re building an app that schedules events for users in different time zones.

Example:
`import { formatInTimeZone } from 'date-fns-tz';

const timeZone = 'America/New_York';
const date = new Date();

const formattedDate = formatInTimeZone(date, timeZone, 'yyyy-MM-dd HH:mm:ssXXX');
console.log(formattedDate); // 2024-11-25 10:00:00-05:00`

2. clsx
The Smarter Way to Manage Dynamic Class Names

If you’ve ever had to write complex className logic in React, you know how messy it can get. clsx is a tiny utility that simplifies conditional class names into clean, readable code.

Why it’s underrated:

  • Combines conditional logic, arrays, and objects into a single utility.
  • Handles falsy values automatically—no more undefined or null in your class strings.
  • Perfect for dynamic UIs.

Use case:
Managing multiple class conditions for buttons, modals, or forms in React.

Example:
`import clsx from 'clsx';

const isActive = true;
const isDisabled = false;

const buttonClass = clsx('btn', { 'btn-active': isActive, 'btn-disabled': isDisabled });
console.log(buttonClass); // "btn btn-active"`

3. ow
Run Stronger, More Readable Input Validation

Input validation often feels like boilerplate code—necessary, but repetitive and tedious. ow by Sindre Sorhus (the creator of many great NPM tools) makes input validation declarative and readable.

Why it’s underrated:

  • TypeScript-friendly with detailed error messages.
  • Expressive syntax for cleaner code.
  • Handles complex validations without external dependencies.

Use case:
Validating API responses, CLI inputs, or function arguments.

Example:
`import ow from 'ow';

const validateUser = (user) => {
ow(user, ow.object.exactShape({
name: ow.string.minLength(3),
age: ow.number.integer.positive,
email: ow.string.url,
}));
};

validateUser({ name: 'John', age: 25, email: 'example@example.com' }); // Passes`

4. npm-check
Keep Your Dependencies in Check

Ever wondered if your project’s dependencies are out of date or if there’s something you can remove? npm-check is like Marie Kondo for your node_modules.

Why it’s underrated:

  • Checks for outdated, unused, or missing dependencies.
  • Interactive CLI lets you update or uninstall packages directly.
  • Works with global and local packages.

Use case:
Keeping your project dependencies clean and up to date without manual inspection.

Example:
npx npm-check

Run this command, and it will give you an interactive list of dependencies with options to update or remove them.

5. log-symbols
Better CLI Feedback with Minimal Effort

Building a CLI tool or a script? Make your logs more intuitive with log-symbols. It adds platform-friendly icons (checkmarks, crosses, warnings) to your terminal output.

Why it’s underrated:

  • Makes terminal outputs visually engaging and easier to understand.
  • Lightweight and customizable. = Works on any platform—macOS, Linux, Windows.

Use case:
Adding visual feedback to custom CLI tools or deployment scripts.

Example:
`import logSymbols from 'log-symbols';

console.log(logSymbols.success, 'Build completed successfully!');
console.log(logSymbols.error, 'Failed to connect to the database.');
console.log(logSymbols.warning, 'Using default configuration.');`

There’s more to NPM than the usual suspects.

The next time you find yourself stuck on a repetitive task or looking for a smarter way to handle something, dive into the lesser-known corners of the NPM ecosystem.

What are your favorite underrated NPM packages?

Comments 10 total

  • Friday candour
    Friday candourDec 12, 2024

    Good picks and ai written. I like the article.

  • Danish
    DanishDec 12, 2024

    This one is so good. And great picks btw.

  • Govind Vyas
    Govind VyasDec 12, 2024

    I am a fan of date - fns - tz. It really pull down the hours managing time zones 😯

    • Balraj Singh
      Balraj SinghDec 12, 2024

      It really does take the headache out of timezone management. Makes everything so much smoother!

  • Quizify
    QuizifyDec 13, 2024

    Nice!

  • Aziz Kaukawala
    Aziz KaukawalaDec 16, 2024

    Thanks buddy!

    Also, one underrated feature you're not using of dev.to is code highlighting. 😅😅😅

    // Example
    
    Enter fullscreen mode Exit fullscreen mode
Add comment