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

gkeep

v1.0.4

Published

A very fast runtime type-checker

Downloads

2

Readme

Gatekeep

A runtime type-checker, with a focus on performance

Usage

Import gatekeep:

const { check, Str, ... } = require("gkeep"); // Or:
import { check, Str, ... } from "gkeep";

Use the check() function to quickly check a type

check(Str, "Hi!") // true
check(Str, true) // { e: 'IncorrectType', got: true, expected: Str }

This function returns true | GatekeepError, where every GatekeepError has an e property, which describes the error.

Here's all the types:

const myObject = { ... };
const hello = type({
  string: Str,
  number: Num,
  boolean: Bool,
  arrayOfStrings: ArrayOf(Str),
  objectWithBoolsAsValues: RecordOf(Bool),
  objectWithKeys: {
    customChecker: val => val in myObject,
    checkerButOnlyForNumbers: Num(num => !isNaN(num)),
    specificString: "Hello world",
    onlyNull: null,
    typeUnion: uni([
      "This can be a string",
      { message: "but also an object" }
    ]),
    [DefaultKey]: Str(s => s.includes("any other key"))
  },
  someOptional: WithOptional({
    required: Bool
  }, {
    optional: "string",
    [DefaultKey]: "DefaultKey is only permitted here"
  })
})

hello.check({ ... }) // An alias for `check(hello, { ... })`

All unknown symbols here are exported from gkeep.

It's worth mentioning that DefaultKey is a symbol, also exported from gkeep. When using WithOptional(required, optional), you may only put DefaultKey in the optional object.

Working with errors

The check() function returns either true, if the check was successful, or a GatekeepError, which describes what went wrong. To simplify working with errors, you may also use gkeep/errors and gkeep/parser exports.

/errors

Exports the errToJSON() function that will turn any error into an JSON-serializable object (except if there are any functions)

Also, typeToJSON() will return a { t: string } if it's a loose type (string, boolean, checker), and { v: any } if it's a concrete type (like "sth", false, 3, etc.)

/parser

Exported function parse() will turn any error into a human-readable string.