# runval

> A typescript first runtime schema validation library

Latest version **1.0.2** (published 2020-12-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install runval
pnpm add runval
yarn add runval
bun add runval
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-12-16 |
| First published | 2020-12-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guillaume Rame |
| Maintainers | guigzz |

## Links

- npm: https://www.npmjs.com/package/runval
- npm.io page: https://npm.io/package/runval

## Recent versions

- 1.0.2 (latest) — 2020-12-16
- 1.0.1 — 2020-12-16
- 1.0.0 — 2020-12-16

## README

# runval
A typescript first runtime schema validation library.

This library is currently very unstable. It's probably not wise to use it (unless you want to test!)

## Usage

```ts
import { boolean, number, object, string, Infer } from '../src';

const schema = object({
    string: string(),
    number: number(),
    nestedObject: object({
        anotherNumber: number(),
        boolean: boolean(),
    }),
});

type SchemaType = Infer<typeof schema>;

const data: any = { ... };

// type guard
if (schema.is(data)) {
    // data is typeof schema
}

// validate
const output = schema.validate(data);
if (output.success) {
    const validated = output.data;
}
else {
    throw output.error;
}
```

---
_Source: https://npm.io/package/runval · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
