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

@zokugun/is-it-type

v0.4.0

Published

Zero-dependency TypeScript predicates for confidently checking any value.

Readme

@zokugun/is-it-type

MIT licensed NPM Version Donation Donation Donation

Why @zokugun/is-it-type?

  • Zero dependencies.
  • Predictable naming across primitives, boxed types, iterables, errors, promises, and constructors.
  • First-class TypeScript support: every helper is a ready-to-use predicate.
  • typeOf/isType go beyond native typeof, normalizing async vs. sync functions, arrays vs. records, Node.js errors, and more.

Getting Started

With node previously installed:

npm install @zokugun/is-it-type

Import only the predicates you need (tree-shaking friendly) and use them as runtime guards:

import { isNonEmptyArray, isString } from '@zokugun/is-it-type';

function normalizeTags(input: unknown): string[] {
    if(!isNonEmptyArray(input)) {
        return [];
    }

    return input.filter(isString);
}

Usage Examples

Narrowing unknown data

import { isRecord, isBooleanLike, isNonNull, toBoolean } from '@zokugun/is-it-type';

function readFeatureFlag(payload: unknown): boolean {
    if(isRecord(payload) && isBooleanLike(payload.enabled)) {
        return toBoolean(payload.enabled);
    }

    return false;
}

Classifying values with typeOf and isType

import {typeOf, isType} from '@zokugun/is-it-type';

const kind = typeOf(value);

switch(kind) {
    case 'array':
        // Guaranteed array here
        break;
    case 'async-function':
        await value();
        break;
    default:
        // Handle primitives, records, promises, etc.
}

if(isType(value, 'date')) {
    console.log('Timestamp:', value.getTime());
}

typeOf returns normalized descriptors beyond the native typeof, including: array, record, date, error, node-error, promise, regexp, async-function, sync-function, constructor, and generator, plus the standard primitives (undefined, null, boolean, number, bigint, string, symbol). Combine it with isType for expressive guards without duplicating comparison logic.

Quick Reference

| Predicate | What it checks | | ------------------------- | --------------------------------------------------------------------------------------------------- | | isActualFunction | Raw typeof value === 'function' check (constructors/classes pass). | | isActualObject | Non-null values whose typeof is 'object' (arrays included). | | isArray | Array.isArray plus an optional per-element predicate. | | isAsyncGenerator | Functions whose constructor name is AsyncGeneratorFunction. | | isAsyncIterable | Objects implementing Symbol.asyncIterator. | | isAsyncFunction | Functions whose constructor name is AsyncFunction. | | isBigInt | Primitive bigint values. | | isBigIntLike | Primitive bigint or boxed BigInt objects. | | isBlankString | Strings that become empty after trim(). | | isBoolean | Primitive booleans. | | isBooleanLike | Primitive booleans or boxed Boolean objects. | | isBoxedBigInt | Boxed BigInt objects. | | isBoxedBoolean | Boxed Boolean objects. | | isBoxedNumber | Boxed Number objects. | | isBoxedPrimitive | Boxed BigInt, Boolean, Number, or String objects. | | isBoxedString | Boxed String objects. | | isConstructor | Functions whose prototype indicates they should be called with new. | | isDate | instanceof Date. | | isEmptyArray | Arrays whose length is 0. | | isEmptyRecord | Plain objects with no own enumerable keys. | | isEmptyString | Strings of length 0. | | isError | instanceof Error. | | isFinite | Number-like inputs that are neither NaN nor ±Infinity. | | isFunction | Callables that are not constructors/classes. | | isGenerator | Functions whose constructor name is GeneratorFunction or AsyncGeneratorFunction. | | isInteger | Values where Number.isInteger(value) succeeds. | | isIntegerGreaterOrEqual | Integers greater than or equal to the provided threshold. | | isIntegerGreaterThan | Integers strictly greater than the provided threshold. | | isIntegerLessOrEqual | Integers less than or equal to the provided threshold. | | isIntegerLessThan | Integers strictly less than the provided threshold. | | isNaN | Number-like inputs whose numeric value is NaN. | | isIterable | Objects implementing Symbol.iterator or Symbol.asyncIterator. | | isNegativeInteger | Integers strictly below zero. | | isNegativeIntegerOrZero | Integers that are zero or below. | | isNodeError | Objects matching NodeJS.ErrnoException shape (they expose code). | | isNonBlankString | Strings containing non-whitespace characters. | | isNonEmptyArray | Arrays with at least one element. | | isNonEmptyRecord | Plain objects that own at least one key. | | isNonEmptyString | Strings whose length is greater than 0. | | isNonNull | Values that are not strictly null. | | isNonNullable | Values excluding both null and undefined. | | isNonUndefined | Values that are not undefined. | | isNull | Strict null checks. | | isNullable | Values that are either null or undefined. | | isNumber | Primitive numbers (including NaN/Infinity). | | isNumberLike | Number or bigint primitives plus boxed Number/BigInt objects. | | isObject | Non-null objects that are not arrays. | | isObjectLike | Non-null objects or functions. | | isPositiveInteger | Integers strictly above zero. | | isPositiveIntegerOrZero | Integers that are zero or above. | | isPrimitive | String, number, boolean, or bigint primitives. | | isPromiseLike | Objects exposing a callable then method. | | isPromise | Objects whose constructor is Promise. | | isRecord | Plain objects (default Object constructor, not arrays/arguments). | | isRegExp | instanceof RegExp. | | isString | Primitive strings. | | isStringLike | Primitive strings or boxed String objects. | | isSyncGenerator | Functions whose constructor name is GeneratorFunction. | | isSyncIterable | Objects implementing Symbol.iterator. | | isSymbol | Primitive symbols. | | isSyncFunction | Functions that are neither constructors, async, nor generator functions. | | isType | Wrapper that compares typeOf(value) to a TypesLiteral. | | isUndefined | Strict undefined checks. | | typeOf | Normalized typeof replacement (array, record, async-function, constructor, etc.). | | toBigInt | Returns the primitive bigint value from either a primitive or BigInt wrapper. | | toBoolean | Returns the primitive boolean value from either a primitive or Boolean wrapper. | | toNumber | Returns the primitive number value from either a primitive or Number wrapper. | | toPrimitive | Unboxes any boxed primitive (Boolean, Number, String, BigInt) to its primitive counterpart. | | toString | Returns the primitive string value from either a primitive or String wrapper. |

Need a normalized descriptor instead of a boolean? Reach for typeOf helper function and the Types/TypesLiteral TypeScript helpers.

Donations

Support this project by becoming a financial contributor.

License

Copyright © 2025-present Baptiste Augrain

Licensed under the MIT license.