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

escss-estest

v2.6.2

Published

Non-intrusive JavaScript runtime validator

Readme

logo

Why ESCSS-ESTest?

Just for a guy who wants to survive in a massive, legacy JavaScript/TypeScript codebase.

Features

  • 💪 JavaScript version of TypeScript + Zod: Ditch any & complexity.
  • 💣 No vender lock-in.
  • 🐛 Find bug quickly.
  • ❤️‍🔥 DX first, DX first, DX first and security!
  • 🪶 ~4 kB (minified + gzipped), 0 dependencies.
  • ✅ Autocompletion support.
  • ⚡ (Optional) The definitive choice for high-performance.

Installation

  npm add escss-estest

Table of Contents

Core Concept

  • ESTest: console.error --> decoupling / isESTestDisabled = true for high-performance
  • unSafeESTest: throw new Error
  • ESTestForLibrary: The default message is separated from ESTest & unSafeESTest

Core API

ESTest(input: unknown, type: string, message: string)

Validate Type (TypeScript Part)

import { ESTest } from "escss-estest";

function sum(a, b) {
  {
    // validate type
    ESTest(a, "number");
    ESTest(b, "number");
  }

  // do something
}

Validate Schema (Zod Part)

import { ESTest } from "escss-estest";

async function getApi() {
  const apiData = await fetch("https://jsonplaceholder.typicode.com/users/1");
  const data = await apiData.json();

  // const data = {
  //   id: 1,
  //   name: "Leanne Graham",
  //   username: "Bret",
  //   email: "[email protected]",
  //   address: {
  //     street: "Kulas Light",
  //     suite: "Apt. 556",
  //     city: "Gwenborough",
  //     zipcode: "92998-3874",
  //     geo: {
  //       lat: "-37.3159",
  //       lng: "81.1496"
  //     }
  //   },
  //   phone: "1-770-736-8031 x56442",
  //   website: "hildegard.org",
  //   company: {
  //     name: "Romaguera-Crona",
  //     catchPhrase: "Multi-layered client-server neural-net",
  //     bs: "harness real-time e-markets"
  //   }
  // }

  {
    // API validate from the backend failed -> console.error('your text')
    // pass
    ESTest(data, "object", "schema do not match").schema({
      id: "number",
      name: "string",
      username: "string",
      email: "string",
      address: {
        street: "string",
        suite: "string",
        city: "string",
        zipcode: "string",
        geo: {
          lat: "string",
          lng: "string",
        },
      },
      phone: "string",
      website: "string",
      company: {
        name: "string",
        catchPhrase: "string",
        bs: "string",
      },
    });
  }

  // do something
}

getApi();

unSafeESTest(input: unknown, type: string, message: string)

Usage is exactly the same as ESTest

import { unSafeESTest } from "escss-estest";
import express from "express";

const app = express();
const port = 3000;

app.use(express.json());

app.post("/api/login", (req, res) => {
  try {
    const data = req.body;

    // const data = {
    //   username: 'abcd',
    //   password: '1234',
    //   confirmPassword: '1234'
    // }

    {
      // Schema or password validation failed -> throw new Error('your text')
      // pass
      unSafeESTest(data, "object", "schema do not match")
        .schema({
          username: "string",
          password: "string",
          confirmPassword: "string",
        })
        .refine(
          (val) => val.password === val.confirmPassword,
          "passwords do not match",
        );
    }

    // do something
    res.json({ message: "ok" });
  } catch (err) {
    res.status(400).json({ message: err.message });
  }
});

app.listen(port, () => {
  console.log(`http://localhost:${port}`);
});

ESTestForLibrary(input: unknown, type: string, message: string)

Library's own default message

import { ESTestForLibrary } from "escss-estest";

function ESTest(
  input,
  type,
  message = "[LibraryName] default message for others to help debugging",
) {
  return ESTestForLibrary(input, type, message);
}

Helper API

globalThis.__ESCSS_ESTEST__.message

  • Set default message for your project.
globalThis.__ESCSS_ESTEST__.message = "Please report this issue to ...";

globalThis.__ESCSS_ESTEST__.isESTestDisabled

  • true: Disable to get high-performance. (for production)
  • false: Show Bug detail.

Note: unSafeESTest will not be affected (for security reasons)

globalThis.__ESCSS_ESTEST__.isESTestDisabled = true;

function sum(a, b) {
  {
    ESTest(a, "number");
    ESTest(b, "number");
  }

  return a + b;
}

// same as
function sum(a, b) {
  return a + b;
}

globalThis.__ESCSS_ESTEST__.analysis

  • Show usage reports

Thanks