npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

phane-js-utils

v1.0.21

Published

Pure JavaScript utility functions

Readme

Kotipalli Phaneendra - Data Type Checking

A lightweight, dependency-free JavaScript utility library for data type checking and input validation.
It provides simple helper functions to reliably determine JavaScript data types and safely work with objects and arrays.

Designed to be minimal, predictable, and well-tested, phane-js-utils works seamlessly in both Node.js and browser environments.


✨ Highlights

  • 🔍 Simple and reliable type-checking helpers
  • 📦 Object & array utility functions
  • 🧪 Fully unit-tested with edge cases
  • ⚡ Zero dependencies
  • 🌐 Works in Node.js and modern browsers

📦 Installation

npm install phane-js-utils

🚀 Quick Example

import {
  isNumber,
  isString,
  isBoolean,
  isAnArray
} from "phane-js-utils";

isNumber(42);        // true
isString("hello");  // true
isBoolean(false);   // true
isAnArray([1, 2, 3]); // true

📚 API Reference

All functions are pure, dependency-free, and follow native JavaScript behavior.


isNumber(value)

Checks whether the given value is a JavaScript number.

isNumber(42);        // true
isNumber(NaN);       // true
isNumber(Infinity);  // true
isNumber("42");      // false

isString(value)

Checks whether the given value is a string.

isString("hello"); // true
isString("");      // true
isString(42);       // false

isBoolean(value)

Checks whether the given value is a boolean.

isBoolean(true);   // true
isBoolean(false);  // true
isBoolean(1);      // false

isBigint(value)

Checks whether the given value is a bigint.

isBigint(123n); // true
isBigint(123);  // false

isFunction(value)

Checks whether the given value is a function.

isFunction(() => {});        // true
isFunction(function () {});  // true
isFunction(class Test {});   // true
isFunction(42);              // false

isObject(value)

Checks whether the given value is a plain object (not an array, function, or null).

isObject({});        // true
isObject({ a: 1 }); // true
isObject([]);        // false
isObject(null);      // false

isAnArray(value)

Checks whether the given value is an array.

isAnArray([]);        // true
isAnArray([1, 2, 3]); // true
isAnArray({});        // false

🧪 Testing

All utilities are covered with unit tests, including edge cases such as:

  • NaN and Infinity
  • Sparse arrays
  • null and undefined
  • Functions, classes, and arrow functions

🎯 Use Cases

  • Input validation
  • Form data checks
  • Frontend and backend utility helpers
  • Safer JavaScript type handling

📄 License

MIT


🔗 Links

  • GitHub Repository: https://github.com/phane-tech/js-data-type-check
  • Demo / Documentation: https://phane-tech.github.io/js-data-type-check/module-DataTypeCheck.html
  • Unit Test Cases Reports: https://phane-tech.github.io/js-data-type-check/unit-test-report.html

FOR RUNKIT

const { isString, isAnArray } = require("phane-js-utils");

console.log(isString("Hi"));       // true
console.log(isAnArray([1,2,3]));  // true