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

showwhat

v2.1.0

Published

A schema-based resolution engine for configuration and feature flags

Readme

showwhat

Schema and rule engine for feature flags and config resolution Inspired by OpenAPI and Swagger

Features

  • Define flags and config as definitions and declare which variation is served based on conditions.
  • TypeScript-first with Zod validation.
  • Supports booleans, strings, numbers, arrays and objects as resolved variation values.
  • Supports both yaml or json.
  • Runtime evaluation against user defined context.
  • Supports annotations for condition chaining and cross-dependency.
  • Ability to define presets for condition reuse.
  • Extensible with custom conditions.
  • Store definitions in files and manage them in version control or serve them from an API.

A browser based schema configurator is also provided / available.

Installation

npm install showwhat
pnpm add showwhat
yarn add showwhat

# Other runtimes
bun add showwhat
deno install npm:showwhat

Quick start

1. Define your flags

Definitions can be YAML files or plain objects. Each definition has variations evaluated top-to-bottom — the first match wins.

# flags.yaml
definitions:
  checkout_v2:
    variations:
      - value: true
        conditions:
          - type: env
            value: prod
      - value: false # default — no conditions means always matches

  max_upload_size:
    variations:
      - value: 100
        conditions:
          - type: number
            key: tier_level
            op: gte
            value: 2
      - value: 25

2. Load definitions

Use MemoryData to load definitions from YAML strings or plain objects:

import { MemoryData } from "showwhat";

// From a YAML string
const data = await MemoryData.fromYaml(fs.readFileSync("flags.yaml", "utf8"));

// Or from a plain object
const data = await MemoryData.fromObject({
  definitions: {
    checkout_v2: {
      variations: [{ value: true, conditions: [{ type: "env", value: "prod" }] }, { value: false }],
    },
  },
});

3. Resolve flags

Pass a runtime context and the keys you want to resolve:

import { showwhat } from "showwhat";

const results = await showwhat({
  keys: ["checkout_v2", "max_upload_size"],
  context: { env: "prod", tier_level: 3 },
  options: { data },
});

Omit keys to resolve all definitions at once.

4. Use the results

Every result entry is either { success: true, value } or { success: false, error }:

const flag = results["checkout_v2"];
if (flag.success) {
  console.log(flag.value); // true
}

const upload = results["max_upload_size"];
if (upload.success) {
  console.log(upload.value); // 100
}

Built-in condition types

| Type | Description | Example | | ---------- | ------------------------------------ | -------------------------------------------------------------------- | | env | Shorthand for matching context.env | { type: env, value: prod } | | string | Compare any string key | { type: string, key: tier, op: eq, value: pro } | | number | Compare any numeric key | { type: number, key: level, op: gte, value: 2 } | | bool | Compare any boolean key | { type: bool, key: mobile, value: true } | | datetime | Compare any datetime key | { type: datetime, key: at, op: gt, value: "2025-01-01T00:00:00Z" } | | startAt | Passes when context.at >= value | { type: startAt, value: "2025-06-01T00:00:00Z" } | | endAt | Passes when context.at < value | { type: endAt, value: "2025-07-01T00:00:00Z" } | | and | All child conditions must pass | { type: and, conditions: [...] } | | or | Any child condition must pass | { type: or, conditions: [...] } |

Presets

Presets define reusable condition shorthands to keep definitions DRY:

definitions:
  premium_feature:
    variations:
      - value: true
        conditions:
          - type: tier
            op: in
            value: [pro, enterprise]
      - value: false

presets:
  tier:
    type: string
    key: tier

Custom conditions

Register your own evaluators to extend the built-in condition types:

import { showwhat, registerEvaluators, MemoryData } from "showwhat";

const evaluators = registerEvaluators({
  percentage: async ({ condition, context }) => {
    const hash = someHash(context.userId);
    return hash % 100 < condition.value;
  },
});

const results = await showwhat({
  keys: ["gradual_rollout"],
  context: { userId: "user-123" },
  options: { data, evaluators },
});

Documentation