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 🙏

© 2025 – Pkg Stats / Ryan Hefner

reliable-type

v2.2.0

Published

Reliable runtime type information.

Downloads

11

Readme

Reliable Type

Reliable runtime type information.

Install

pnpm install reliable-type

Example

The provided type method is more reliable than some combination of typeof and instanceof. While the .constructor Object property is strong —and recommended, in absence of a dependency like this—it can technically be reassigned. It will always return the correct type as an informative, specific Type or tag String. Extra types are also available to import:

import assert from "node:assert/strict"
import { type, types, tag, tags } from "reliable-type"
import { GeneratorFunction } from "reliable-type/types"

function* generator() { yield * [1, 2, 3] }

const Type = type(generator)
const Tag  =  tag(generator)

assert.equal(Type, GeneratorFunction)
assert.equal(Tag, "GeneratorFunction")

assert.equal(Type, types.GeneratorFunction)
assert.equal(Tag,   tags.GeneratorFunction)

| Expression | type | tag | |:-------------------------------------------|:---------------------------|:---------------------------| | undefined | undefined | "undefined" | | null | null | "null" | | true/false | Boolean | "Boolean" | | "string" | String | "String" | | -0/1_000/0.1 | Number | "Number" | | 0xAf/0o1/0b1 | Number | "Number" | | 3.1415e+1/Math.PI | Number | "Number" | | 1_000_000n | BigInt | "BigInt" | | [-]Infinity | Infinity | "Infinity" | | NaN | NaN | "NaN" | | Math | Math | "Math" | | Symbol("*") | Symbol | "Symbol" | | new Intl.Segmenter() | Segmenter | "Segmenter" | | new Date() | Date | "Date" | | /.*/g/new RegExp(".*") | RegExp | "RegExp" | | new URL("https://github.com") | URL | "URL" | | const buffer = Buffer.from("data") | Buffer | "Buffer" | | fs.createReadStream(buffer) | ReadStream | "ReadStream" | | fs.createWriteStream("/dev/null") | WriteStream | "WriteStream" | | new Uint8Array([0, 255]) | Uint8Array | "Uint8Array" | | [1 ,2 ,3]/Array.from("abc") | Array | "Array" | | new Set([1, 2, 3]) | Set | "Set" | | new WeakSet() | WeakSet | "WeakSet" | | new WeakMap() | WeakMap | "WeakMap" | | const map = new Map().set("a", 1) | Map | "Map" | | map.entries() | Iterator | "Iterator" | | const object = { a: 1, b: 2 } | Object | "Object" | | new Proxy(object, {}) | Proxy | "Proxy" | | Proxy.revocable(object, {}) | Proxy | "Proxy" | | { [Symbol.toStringTag]: "tag" } | "tag" | "tag" | | JSON | JSON | "JSON" | | function() { return arguments }(1, 2) | Arguments | "Arguments" | | [].reduce/() => {} | Function | "Function" | | async () => Promise.resolve(true) | AsyncFunction | "AsyncFunction" | | Promise.resolve(true) | Promise | "Promise" | | function* generator() { yield * [1, 2] } | GeneratorFunction | "GeneratorFunction" | | generator() | Generator | "Generator" | | async function* gen() { yield * [1, 2] } | AsyncGeneratorFunction | "AsyncGeneratorFunction" | | gen() | AsyncGenerator | "AsyncGenerator" | | new (class Class {})() | Class | "Class" | | new (class Extended extends Class {})() | ExtendedClass | "ExtendedClass" | | fs.opendir(dir) | Dir | "Dir" | | fs.readdir(dir, { withFileTypes: true }) | Dirent | "Dirent" |

Aliases

import { typeOf, toStringTag } from "reliable-type"

License

MIT © Daniel Bayley