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

localio

v0.0.0

Published

A local Cloud-like API

Readme

Expressive Validation for Objects.

An object validation library with a strong TypeScript support.

Installation

npm install xvo

Usage

import { x } from 'xvo';
// Declare
const schema = x.union(
    x.object({
        account_type: x.literal('individual'),
        first_name: x.string(),
        last_name: x.string(),
        phone_number: x.string().phone(),
        email: x.string().email(),
        nickname: x.string().optional(),
        email_verified: x.boolean().default(false)
    }),
    x.object({
        account_type: x.literal('business'),
        business_name: x.string(),
        phone_number: x.string().phone(),
        email: x.string().email(),
        alias: x.string().optional(),
        email_verified: x.boolean().default(false)
    })
);
// Parse
const result = schema.parse({
    account_type: 'individual',
    first_name: 'John',
    last_name: 'Doe',
    phone_number: '+1 (123) 456-7890',
    email_verified: '[email protected]'
});
// result: { ok: boolean }
if (!result.ok) {
    // result: { ok: false, error: XvoError }
    throw new Error(x.error_to_string(result.error));
}
// result: { ok: true, value: object }
const value = result.value;
console.log(value);
{
    "account_type": "individual",
    "first_name": "John",
    "last_name": "Doe",
    "phone_number": "+11234567890",
    "email": "[email protected]",
    "verified": false
}
if (value.account_type === 'individual') {
    console.log("Welcome back, " + value.first_name + "!");
}
"Welcome back, John!"

Custom Error-Handling

if (!result.ok) {
    // result: { ok: false, error: XvoError }
    const error = result.error;
    switch (error.type) {
        'missing_required':
            // error: { type: 'missing_required', field: string }
            break;
        default:
            // 'invalid_type' |
            // 'invalid_range' |
            // 'invalid_pattern' |
            // 'invalid_format' |
            // 'invalid_literal' |
            // 'custom', 'unknown' ...
            break;
    }
}

RFC-compliant Normalization

(Default - On) Receive RFC-compliant version of the value, as long as it is a valid phone number.

x.string().phone().parse('+1 (123) 456-7890'); 
// { ok: true, value: '+11234567890'; }

(Off) Receive value as-is, as long as it is a valid phone number.

x.string().phone(false).parse('+1 (123) 456-7890'); 
// { ok: true, value: '+1 (123) 456-7890'; }

This does not affect the validation of the fields—both are valid. It only affects the received value on the result object.

No redundant method-chaining

// 🚫 Invalid: Mixing optional and default doesn't make logical sense.
x.string().optional().default("example").optional(); // invalid
x.string().optional().default("example"); // invalid

// ✅ Valid: Choose one approach—`default()` inherently makes the field optional.
x.string().default("example"); // valid

Cleaner Type Errors for Easier Developement

Example with comparison to other validation libraries

Setting .default(null) without .nullable().

In Zod: z.string().default(null) -> Type Error.

No overload matches this call.
  Overload 1 of 2, '(def: string): ZodDefault<ZodString>', gave the following error.
    Argument of type 'null' is not assignable to parameter of type 'string'.
  Overload 2 of 2, '(def: () => string): ZodDefault<ZodString>', gave the following error.
    Argument of type 'null' is not assignable to parameter of type '() => string'.

In Xvo: x.string().default(null) -> Type Error.

Argument of type 'null' is not assignable to parameter of type 'string'.