Skip to main content
This release is 3 versions behind 0.4.4 — the latest version of @oridune/validator. Jump to latest

Oridune validator is a TypeScript-first schema declaration and validation library like Zod.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
41%
Published
a week ago (0.4.1)

Oridune Validator

A powerful typescript compatible/zod alternative schema validator.

Introduction

Oridune validator is a TypeScript-first schema declaration and validation library like Zod.

Validator is designed to be as developer-friendly as possible. The goal is to eliminate duplicative type declarations. With Validator, you declare a validator schema once and it will automatically infer the static TypeScript type. It's easy to compose simpler types into complex data structures.

  • Zero dependencies
  • Works in Deno/Node and all modern browsers
  • Reusable schema that leverages the validation context to save the memory
  • Concise, chainable interface
  • Works with plain JavaScript too! You don't need to use TypeScript.
import e from "validator"; // validator maps to https://jsr.io/@oridune/validator

// Define a string validator
const Str = e.string();

// Validation
await Str.validate("foo"); // returns "foo"
await Str.validate(123); // throws ValidationException

// Safe Validation (doesn't throw an error if validation fails)
await Str.try("foo"); // returns { output: "foo", error: null }
await Str.try(123); // returns { output: null, error: ValidationException }

// Boolean Validation
await Str.test("foo"); // returns true
await Str.test(123); // returns false

See the detailed docs for implementation details.

Add Package

deno add jsr:@oridune/validator

Import symbol

import * as validator from "@oridune/validator";

---- OR ----

Import directly with a jsr specifier

import * as validator from "jsr:@oridune/validator";

Add Package

npx jsr add @oridune/validator

Import symbol

import * as validator from "@oridune/validator";

Add Package

yarn dlx jsr add @oridune/validator

Import symbol

import * as validator from "@oridune/validator";

Add Package

pnpm dlx jsr add @oridune/validator

Import symbol

import * as validator from "@oridune/validator";

Add Package

bunx jsr add @oridune/validator

Import symbol

import * as validator from "@oridune/validator";