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

is-string-or-number-who-cares

v1.0.2

Published

The world's most advanced string or number detection library.

Downloads

341

Readme

is-string-or-number-who-cares

npm license downloads

The world's most advanced string or number detection library.

Overview

After years of rigorous research and millions in funding (not really), we've finally solved the problem that JavaScript developers have been struggling with since 2009: checking if a value is a string or a number.

Built with cutting-edge typeof technology, this library leverages the latest advances in type detection to deliver results you never asked for.

Features

  • Blazingly fast - It's just a typeof check, what did you expect?
  • Zero dependencies - Because we couldn't afford any
  • Enterprise-grade - Tested in production (by us, once)
  • TypeScript ready - Just kidding, it's not
  • Fully documented - You're reading it right now
  • Number support - Now supporting numbers 1 through 20 (21-100 coming in Pro)

Installation

npm install is-string-or-number-who-cares

Usage

Checking if a value is a string or number

const { isStringOrNumber } = require('is-string-or-number-who-cares');

isStringOrNumber('hello');
// { type: 'string', message: "It's a string, congrats 🎉" }

isStringOrNumber(7);
// { type: 'number', message: "It's a number, you're amazing 🏆" }

isStringOrNumber(42);
// { type: 'unsupported', message: "Number 42 is not supported yet. We only verify numbers from 1 to 20. Upgrade to Pro for 21-100." }

isStringOrNumber(true);
// { type: 'garbage', message: "Not a string or number. Go back to school." }

Converting strings to numbers

Our proprietary stringToNumber algorithm uses a revolutionary approach: it tells you it can't convert.

const { stringToNumber } = require('is-string-or-number-who-cares');

stringToNumber('123');
// { result: NaN, message: '"123" is a string, genius. To convert it needs to be a number.' }

stringToNumber(42);
// { result: 42, message: "It's already a number (42). Are you testing me?" }

stringToNumber(null);
// { result: NaN, message: 'That is nothing. Give up.' }

API Reference

isStringOrNumber(value)

Determines whether the provided value is a string, a number, or garbage.

| Parameter | Type | Description | |-----------|------|-------------| | value | any | The value to check. Try not to pass null. |

Returns: An object with type and message properties. The message is mandatory because we care about your feelings.

Supported numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20. Any other number will return an "unsupported" type. This is a deliberate design choice, not laziness.

stringToNumber(value)

Attempts to convert a value to a number. Spoiler: it won't.

| Parameter | Type | Description | |-----------|------|-------------| | value | any | The value to convert. Good luck. |

Returns: An object with result (always NaN if you passed a string) and a message explaining why it's your fault.

Why?

Because typeof is too hard to type. This saves you 6 whole characters.

Contributing

Please don't. This is perfect.

License

WTFPL - Do What The Fuck You Want To Public License