DEV Community

Cover image for Stop Writing Type Checks from Scratch — Try sd-is Instead
Sandeep Dara
Sandeep Dara

Posted on

Stop Writing Type Checks from Scratch — Try sd-is Instead

⚡ Introducing sd-is – A Smarter Way to Handle Type Checks in JavaScript

“Do we really need another type-checking utility?”

Probably not.

But I built one anyway — and it might just save you some sanity.


🧩 What is sd-is?

sd-is is a tiny JavaScript utility library built to simplify common type-checks in a clean, expressive, and developer-friendly way.

It helps answer those everyday questions like:

  • Is this object empty?
  • Is this value undefined?
  • Is this a plain object or something else?

No frills. Just clarity.


✅ Key Features

  • Minimal API: isEmptyObject, isEmptyArray, isPlainObject, isUndefined, isNotUndefined
  • 🔍 New: smartCheck – returns a verdict, reason, and fix suggestion
  • Lightweight and zero dependencies
  • Built by a developer, for developers

📦 Installation

npm install sd-is
Enter fullscreen mode Exit fullscreen mode

🧪 Usage

1. Simple Type Checks

const { isEmptyObject, isUndefined } = require('sd-is');

console.log(isEmptyObject({})); // true
console.log(isUndefined(undefined)); // true
Enter fullscreen mode Exit fullscreen mode

2. Smart Checks with Context

Want more than just true or false?

const { smartCheck } = require('sd-is');

const result = smartCheck.isPlainObject(new Date());

console.log(result.ok);        // false
console.log(result.verdict);   // ❌ Not a plain object
console.log(result.reason);    // It's a Date object, not a literal
console.log(result.fix());     // returns {}
Enter fullscreen mode Exit fullscreen mode

Perfect for debugging, logging, and validation logic.


🤔 Why I Built It

I was tired of writing the same verbose checks every day:

typeof x !== 'undefined' && x !== null && Object.keys(x).length === 0
Enter fullscreen mode Exit fullscreen mode

So I decided to make something that felt easier and more readable — and then added smartCheck to give context and optional fallbacks too.

This isn’t a groundbreaking package, and it’s not trying to replace Lodash — it’s just a developer-first tool I wanted to exist.


🌱 What’s Next?

I'm planning to expand the smart check library with:

  • Type-safe checks (boolean, string, number, etc.)
  • Customizable fix() functions
  • CLI helper for validating data

🔗 Links


💬 Feedback?

If you try it, I’d love your thoughts!

Feel free to open an issue or drop feedback on GitHub.


🧑‍💻 Built by Sandeep Dara

Just a developer sharing something I found useful — maybe it’ll help you too.

npm install sd-is
Enter fullscreen mode Exit fullscreen mode

One package, many checks. Clean code, happy dev.

Top comments (0)