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

nope-validator

v1.1.1

Published

Fast and simple JS validator

Readme

Nope 🙅

Version Bundle Size Gzip Size License

A lightweight, fast, and synchronous JavaScript validation library. Built for developers who need performance without the bloat.


Why Nope?

Nope is a minimal validation library that prioritizes speed and simplicity. Inspired by Yup, Nope provides a familiar API while being significantly smaller and ~17x faster than Yup by focusing exclusively on synchronous validation—which covers the vast majority of use cases.

See benchmark results for detailed performance metrics and test specifications.

Key Features

  • Fast - Optimized for performance with synchronous validation
  • 📦 Small - Minimal bundle size, maximum efficiency
  • 🎯 Simple - Clean, intuitive API that's easy to learn
  • 🔒 Type Safe - Full TypeScript support out of the box
  • 🚫 No Exceptions - Returns error objects instead of throwing errors
  • 🔌 Framework Ready - Works seamlessly with React Hook Form and Formik

How It Works

Unlike traditional validators that throw errors, Nope returns error objects. If validation passes, it returns undefined. This approach is more predictable and easier to work with in modern JavaScript applications.


Installation

npm install nope-validator
# or use your preferred package manager (pnpm, yarn, bun, etc)

Quick Start

import Nope from 'nope-validator';

// Define your validation schema
const UserSchema = Nope.object().shape({
  name: Nope.string()
    .atLeast(5, 'Please provide a longer name')
    .atMost(255, 'Name is too long!'),
  email: Nope.string().email().required(),
  confirmEmail: Nope.string()
    .oneOf([Nope.ref('email')], 'Emails must match')
    .required(),
});

// Validate data
const errors = UserSchema.validate({
  name: 'John',
  email: '[email protected]',
  confirmEmail: '[email protected]',
});
// Returns: { name: 'Please provide a longer name' }

const valid = UserSchema.validate({
  name: 'Jonathan Livingston',
  email: '[email protected]',
  confirmEmail: '[email protected]',
});
// Returns: undefined (no errors)

Framework Integration

React Hook Form

Nope works seamlessly with React Hook Form using the official resolver:

import { nopeResolver } from '@hookform/resolvers/nope';
import { useForm } from 'react-hook-form';
import * as Nope from 'nope-validator';

const schema = Nope.object().shape({
  username: Nope.string().required('Username is required'),
  password: Nope.string().required('Password is required'),
});

function LoginForm({ onSubmit }) {
  const {
    register,
    formState: { errors },
    handleSubmit,
  } = useForm({
    resolver: nopeResolver(schema),
  });

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input {...register('username')} />
      {errors.username && <div>{errors.username.message}</div>}

      <input type="password" {...register('password')} />
      {errors.password && <div>{errors.password.message}</div>}

      <button type="submit">Submit</button>
    </form>
  );
}

Formik

Use Nope with Formik by passing the validation function to the validate prop:

import { Formik, Form, Field, ErrorMessage } from 'formik';
import * as Nope from 'nope-validator';

const schema = Nope.object().shape({
  username: Nope.string().required('Username is required'),
  password: Nope.string().required('Password is required'),
});

function LoginForm() {
  return (
    <Formik
      initialValues={{ username: '', password: '' }}
      validate={(values) => schema.validate(values)}
      onSubmit={(values) => console.log('Submitted', values)}
    >
      <Form>
        <Field type="text" name="username" />
        <ErrorMessage name="username" component="div" />

        <Field type="password" name="password" />
        <ErrorMessage name="password" component="div" />

        <button type="submit">Submit</button>
      </Form>
    </Formik>
  );
}

Documentation

For complete API documentation, examples, and advanced usage, visit the documentation wiki.


Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.