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

@fieldtest/validation-lib

v1.0.2

Published

Reusable TypeScript validation library using Zod schemas

Readme

@fieldtest/validation-lib

A TypeScript validation library that works with both Astro and Next.js applications, building on top of Zod and integrated with @docs-score/core.

Features

  • Framework Agnostic: Works with both Astro and Next.js
  • Zod Integration: Built on top of Zod for powerful schema validation
  • @docs-score/core Integration: Leverages existing validation from @docs-score/core
  • CLI Interface: Command-line tools for validation
  • Common Schemas: Pre-built schemas for common validation needs
  • Type Safety: Full TypeScript support with inferred types

Installation

# If you're in the monorepo
pnpm add @fieldtest/validation-lib

# If you're outside the monorepo
npm install @fieldtest/validation-lib

Usage

Basic Validation

import { validate, z } from '@fieldtest/validation-lib';

const schema = z.object({
  name: z.string().min(2),
  email: z.string().email(),
  age: z.number().min(18)
});

const userData = {
  name: "Alice",
  email: "[email protected]",
  age: 25
};

const [isValid, result] = validate(schema, userData);

if (isValid) {
  console.log("Valid data:", result);
} else {
  console.error("Invalid data:", result.errors);
}

Using Pre-defined Schemas

import { validate, DocumentSchema } from '@fieldtest/validation-lib';

const document = {
  title: "Getting Started",
  url: "https://example.com/docs/getting-started",
  headings: [
    { level: 1, text: "Getting Started" },
    { level: 2, text: "Installation" }
  ]
};

const [isValid, result] = validate(DocumentSchema, document);

if (!isValid) {
  console.error("Invalid document structure");
}

Integration with @docs-score/core

import { scanSite } from '@docs-score/core';
import { validate, ScanOptionsSchema } from '@fieldtest/validation-lib';

const options = {
  entry: "https://example.com",
  maxDepth: 3,
  concurrency: 5
};

const [isValid, validatedOptions] = validate(ScanOptionsSchema, options);

if (isValid) {
  const results = await scanSite(validatedOptions);
  console.log(`Scanned ${results.pages.length} pages`);
}

CLI Usage

# Validate a URL
npx validate url https://example.com --depth 3 --concurrency 5 --output results.json

# Validate a configuration file
npx validate config ./config.json --schema ValidationConfig

API Reference

Core Functions

  • validate<T>(schema: z.ZodType<T>, input: unknown): [boolean, T | z.ZodError]
  • validateAsync<T>(schema: z.ZodType<T>, input: unknown): Promise<[boolean, T | z.ZodError]>
  • formatZodError(error: z.ZodError): string

Pre-defined Schemas

  • URLSchema: Validates URLs
  • EmailSchema: Validates email addresses
  • DocumentSchema: Validates document structure
  • ValidationConfigSchema: Validates configuration files
  • ScanOptionsSchema: Validates @docs-score/core scan options

License

MIT