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

@osmium/is

v0.2.0

Published

Osmium project - Type detector

Readme

is

A comprehensive JavaScript/TypeScript utility library for type and value checking. It provides a wide range of functions to check types, structures, and properties of values in a consistent and reliable way.

Features

  • Type Checks: null, undefined, array, object, string, boolean, number, symbol, function, async function, etc.
  • Structure Checks: empty, iterable, plain object, native object, etc.
  • Special Checks: JSON, GUID, RegExp, Map, Set, WeakMap, WeakSet, Date, Error, Promise, TypedArray, etc.
  • Works in both JavaScript and TypeScript projects.
  • Well-tested and fast.

Installation

npm install @osmium/is

or

yarn add @osmium/is

API Reference

isNull(value)

Checks if value is null.

import { isNull } from '@osmium/is';

isNull(null); // true
isNull(undefined); // false

isUndefined(value)

Checks if value is undefined.

import { isUndefined } from '@osmium/is';

isUndefined(undefined); // true
isUndefined(null); // false

isFunction(value)

Checks if value is a function (including async functions).

import { isFunction } from '@osmium/is';

isFunction(() => {}); // true
isFunction(async () => {}); // true

isAsyncFunction(value, [pattern])

Checks if value is an async function. Optionally accepts a RegExp or string pattern for custom detection (e.g., for transpiled async functions).

import { isAsyncFunction } from '@osmium/is';

isAsyncFunction(async () => {}); // true
isAsyncFunction(() => {}); // false

isArray(value)

Checks if value is an array.

import { isArray } from '@osmium/is';

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

isArrayEmpty(value)

Checks if value is an empty array.

import { isArrayEmpty } from '@osmium/is';

isArrayEmpty([]); // true
isArrayEmpty([1]); // false

isObject(value)

Checks if value is a plain object.

import { isObject } from '@osmium/is';

isObject({ a: 1 }); // true
isObject(new Date()); // false

isObjectEmpty(value)

Checks if value is an empty object.

import { isObjectEmpty } from '@osmium/is';

isObjectEmpty({}); // true
isObjectEmpty({ a: 1 }); // false

isString(value)

Checks if value is a string.

import { isString } from '@osmium/is';

isString('hello'); // true
isString(123); // false

isBoolean(value)

Checks if value is a boolean.

import { isBoolean } from '@osmium/is';

isBoolean(true); // true
isBoolean(0); // false

isNumber(value)

Checks if value is a finite number (not NaN, not Infinity).

import { isNumber } from '@osmium/is';

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

isNumeric(value)

Checks if value is a number (including Infinity, -Infinity).

import { isNumeric } from '@osmium/is';

isNumeric(42); // true
isNumeric(Infinity); // true

isInteger(value)

Checks if value is a safe integer.

import { isInteger } from '@osmium/is';

isInteger(10); // true
isInteger(10.5); // false

isFloat(value)

Checks if value is a float (not an integer).

import { isFloat } from '@osmium/is';

isFloat(3.14); // true
isFloat(10); // false

isPositiveInteger(value)

Checks if value is a positive integer (>= 0).

import { isPositiveInteger } from '@osmium/is';

isPositiveInteger(5); // true
isPositiveInteger(-5); // false

isPositiveNumber(value)

Checks if value is a positive number (>= 0).

import { isPositiveNumber } from '@osmium/is';

isPositiveNumber(0.1); // true
isPositiveNumber(-1); // false

isSymbol(value, [description])

Checks if value is a symbol, optionally with a specific description.

import { isSymbol } from '@osmium/is';

isSymbol(Symbol('x')); // true
isSymbol(Symbol('x'), 'x'); // true

isRegExp(value)

Checks if value is a regular expression.

import { isRegExp } from '@osmium/is';

isRegExp(/abc/); // true
isRegExp('/abc/'); // false

isMap(value)

Checks if value is a Map.

import { isMap } from '@osmium/is';

isMap(new Map()); // true

isSet(value)

Checks if value is a Set.

import { isSet } from '@osmium/is';

isSet(new Set()); // true

isWeakMap(value)

Checks if value is a WeakMap.

import { isWeakMap } from '@osmium/is';

isWeakMap(new WeakMap()); // true

isWeakSet(value)

Checks if value is a WeakSet.

import { isWeakSet } from '@osmium/is';

isWeakSet(new WeakSet()); // true

isPromise(value)

Checks if value is a Promise.

import { isPromise } from '@osmium/is';

isPromise(Promise.resolve()); // true

isDate(value)

Checks if value is a valid Date object.

import { isDate } from '@osmium/is';

isDate(new Date()); // true

isError(value)

Checks if value is an Error object.

import { isError } from '@osmium/is';

isError(new Error('fail')); // true

isPlainObject(value)

Checks if value is a plain object (its prototype is Object or null).

import { isPlainObject } from '@osmium/is';

isPlainObject({}); // true
isPlainObject(Object.create(null)); // true

isTypedArray(value)

Checks if value is a TypedArray.

import { isTypedArray } from '@osmium/is';

isTypedArray(new Uint8Array()); // true

isNilOrEmpty(value)

Checks if value is null, undefined, or an empty string.

import { isNilOrEmpty } from '@osmium/is';

isNilOrEmpty(null); // true
isNilOrEmpty(''); // true

isEmpty(value)

Checks if value is empty (array, string, object, Map, or Set).

import { isEmpty } from '@osmium/is';

isEmpty([]); // true
isEmpty({}); // true
isEmpty(''); // true

isIterable(value)

Checks if value is iterable (a non-empty array, Map, Set, or an object with keys).

import { isIterable } from '@osmium/is';

isIterable([1, 2, 3]); // true
isIterable([]); // false

isAsyncIterable(value)

Checks if value is async iterable.

import { isAsyncIterable } from '@osmium/is';

isAsyncIterable({ async *[Symbol.asyncIterator]() {} }); // true

isJSON(value)

Checks if value is a valid JSON string.

import { isJSON } from '@osmium/is';

isJSON('{"a":1}'); // true
isJSON('not json'); // false

isGUID(value)

Checks if value is a valid GUID.

import { isGUID } from '@osmium/is';

isGUID('123e4567-e89b-12d3-a456-426614174000'); // true

isGUIDv4(value)

Checks if value is a valid GUID v4.

import { isGUIDv4 } from '@osmium/is';

isGUIDv4('123e4567-e89b-42d3-a456-426614174000'); // true

isNativeObject(value)

Checks if value is a native object (not an array, function, or other special objects).

import { isNativeObject } from '@osmium/is';

isNativeObject({}); // true
isNativeObject([]); // false

Testing

To run all tests, use your favorite package manager:

npm test

or

yarn test

Contributing

Pull requests and issues are welcome! Please write tests for new features and bug fixes.

License

MIT

Author

Maintained by Vasiliy Isaichkin.