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

@chriscodesthings/is

v0.3.0

Published

Type checking utilities

Downloads

204

Readme

is Test workflow status NPM Version License: MIT

Type checking utilities

Description

A collection of lightweight type checking and validation functions.

See...


Install from NPM

npm install --save @chriscodesthings/is

Usage

Node / CDN

// Node
import * as is from '@chriscodesthings/is';

// ... or ... //

// jsDelivr
import * as is from 'https://cdn.jsdelivr.net/npm/@chriscodesthings/is';

// ... or ... //

// Unpkg
import * as is from 'https://unpkg.com/@chriscodesthings/is';


is.isStr("hello world!"); // true

Reference

Numbers

| Function | Description | | :--- | :--- | | is.isNum(x) | Checks if a value is a finite number. | | is.isInt(x) | Checks if a value is an integer. | | is.isPct(x) | Checks if a string is a percentage. |

Strings

| Function | Description | | :--- | :--- | | is.isStr(x) | Checks if a value is a string. | | is.isWord(str, [options]) | Checks if a string is a "word" consisting of allowed characters. | | is.isBalancedChr(str,c1,c2) | Checks if a string is balanced, e.g. ( and ) are properly matched. Single character version. |

Arrays

| Function | Description | | :--- | :--- | | is.isArr(x) | Checks if a value is an array. |

Functions

Number Functions

is.isNum

Checks if a variable is a finite number.

is.isNum(42);  // true
is.isNum(NaN); // false

Back to Reference


is.isInt

Checks if a variable is a mathematical integer.

is.isInt(42);  // true
is.isInt(42.5); // false

Back to Reference


is.isPct

Checks if a string is a percentage.

is.isPct("25%");  // true
is.isPct("15"); // false
is.isPct(7); // false

Back to Reference


String Functions

is.isStr

Checks if a variable is a string or a String object.

is.isStr('hello'); // true
is.isStr(123);     // false

Back to Reference


is.isWord

Checks if a string consists only of alphabetical characters by default. Use options to permit hyphens, underscores, or numbers.

is.isWord('hello');               // true
is.isWord('hello-world');         // false
is.isWord('hello-world', { hyphen: true }); // true
is.isWord('user_123', { underscore: true, numbers: true }); // true

Back to Reference


is.isBalancedChr

Checks if a string has balanced characters (e.g., brackets). This function uses a depth counter to ensure every opening character has a corresponding closing character in the correct order.

isBalancedChr("(a + b)", "(", ")");        // true
isBalancedChr(")a + b)", "(", ")");        // false (close bracket first)
isBalancedChr("((a + b)", "(", ")");       // false (unclosed bracket)
isBalancedChr("<div></div>", "<", ">");    // true

Note: chr1 and chr2 must be single characters. For validating balanced multi-character sequences, use isBalancedStr.


Array Functions

is.isArr

Determines if a variable is an Array.

is.isArr([1, 2, 3]); // true
is.isArr({});        // false

Back to Reference


See Also...

License

MIT © ChrisCodesThings