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

@tusent.io/schema

v1.6.1

Published

## Contents

Readme

@tusent.io/schema

Contents

Types

string

Matches any string value.

Example:

{ "type": "string" }

number

Matches any number value except positive and negative Infinity. By default, the number is not allowed to be NaN. To allow infinities or NaN values, set the finite option to false or the allowNaN option to true respectively.

  • allowNaN?: boolean - Whether to allow NaN values. Defaults to false.
  • finite?: boolean - Whether to disallow positive and negative Infinity values. Defaults to true.

Example:

{
    "type": "number",
    "allowNaN": true
}

integer

Matches any integer value. By default, the number is not allowed to be NaN. To allow NaN values, set the allowNaN option to true.

  • allowNaN?: boolean - Whether to allow NaN values. Defaults to false.

Example:

{ "type": "integer" }

boolean

Matches strictly true or false.

Example:

{ "type": "boolean" }

null

Matches either null or undefined.

Example:

{ "type": "null" }

object

Matches an object with specific properties. By default, all properties are required and the object is not allowed to have any additional properties. To allow additional properties, set the strict option to false.

  • fields: Record<string, Schema> - An object of schemas to match against the object's properties.
    • [key: string]: Schema - The key is the name of the property and the value is the schema to match against the property.
      • .required?: boolean - Whether the property is required. Defaults to true.
  • strict?: boolean - Whether to disallow additional properties. Defaults to true.

Example:

{
    "type": "object",
    "fields": {
        "name": { "type": "string" },
        "age": { "type": "number" }
    }
}

array

Matches an array with items matching a specific schema. By default, its length is not checked. To check its length, either use the length or minLength/maxLength options.

  • item: Schema - The schema to match against all of the array's items.
  • length?: number - Makes sure the array's length is equal to this specific value.
  • minLength?: number - Makes sure the array's length is greater than or equal to this specific value. This option cannot be used together with the length option.
  • maxLength?: number - Makes sure the array's length is less than or equal to this specific value. This option cannot be used together with the length option.

tuple

Matches an array with a specific length and specific items.

  • items: Schema[] - An array of schemas to match against the array's items.

Example: The following schema will match an array with two items, the first being a string and the second being a number.

{
    "type": "tuple",
    "items": [{ "type": "string" }, { "type": "number" }]
}

const

Matches a specific value. Supports deep equality checks for objects and arrays.

  • value: any - The value to match.

Example:

{
    "type": "const",
    "value": 42
}

enum

Matches a specific set of values.

  • variants: unknown[] - An array of values to match against. Each variant is matched like a const schema. (Must have at least one item.)

union

Matches any of the given schemas.

  • variants: Schema[] - An array of schemas to match against. (Must have at least one item.)

Example:

{
    "type": "union",
    "variants": [{ "type": "string" }, { "type": "number" }]
}

any

Matches any value including undefined and null.

Example:

{ "type": "any" }