GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - typeofweb-org/schema: @typeofweb/schema: Lightweight validator with 100% TypeScript support and sane coercion rules.

BranchesTags
Open more actions menu

Latest commit

 

History

142 Commits
142 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.husky
.husky
 
 
.vscode
.vscode
 
 
__tests__
__tests__
 
 
docs
docs
 
 
src
src
 
 
.all-contributorsrc
.all-contributorsrc
 
 
.eslintignore
.eslintignore
 
 
.eslintrc
.eslintrc
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.nvmrc
.nvmrc
 
 
.prettierrc
.prettierrc
 
 
.versionrc
.versionrc
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
jest-setup-after-env.ts
jest-setup-after-env.ts
 
 
jest-setup.ts
jest-setup.ts
 
 
jest.config.js
jest.config.js
 
 
package.json
package.json
 
 
rollup.config.js
rollup.config.js
 
 
tsconfig.eslint.json
tsconfig.eslint.json
 
 
tsconfig.json
tsconfig.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

@typeofweb/schema

@typeofweb/schema is a lightweight and extensible library for data validation with full TypeScript support!

All Contributors

codecov npm npm bundle size (minified + gzip) no external dependencies tree-shakeable

Docs

👉 schema.typeofweb.com 👈

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Michał Miszczyszyn

💻 🚧 📆 👀

Bartłomiej Wiśniewski

💻 👀 🐛 📖

Adam Siekierski

👀

Anthony Sottile

🛡️

Marek

📖

Olzhas Alexandrov

🐛

Bartek Słysz

🐛

Mateusz Stepaniuk

🤔

Dariusz Rzepka

🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Example

import { number, object, optional, string, validate } from '@typeofweb/schema';

const personSchema = object({
  name: string(),
  age: number(),
  email: optional(string()),
})();

const mark = {
  name: 'Mark',
  age: 29,
};

const personValidator = validate(personSchema);

// If validation is successful returns data with correct type, throws ValidationError otherwise
const validatedPerson = personValidator(mark);

Early benchmarks

Early benchmarks show some really promising performance of @typeofweb/schema when compared to other industry-leading solutions:

Platform info:
==============
   Darwin 20.3.0 x64
   Node.JS: 14.16.0
   V8: 8.4.371.19-node.18
   Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz × 8
library relative speed operations per second avg. operation time
@typeofweb/schema ref (1,934,098 rps) (avg: 0.517μs)
[email protected] -7.21% (1,794,594 rps) (avg: 0.557μs)
[email protected] -69.8% (584,151 rps) (avg: 1μs)
[email protected] -76.16% (461,088 rps) (avg: 2μs)
[email protected] -89.02% (212,408 rps) (avg: 4μs)
[email protected] -92.2% (150,791 rps) (avg: 6μs)
[email protected] -93.25% (130,541 rps) (avg: 7μs)
[email protected] -96.99% (58,197 rps) (avg: 17μs)
[email protected] -97.09% (56,243 rps) (avg: 17μs)
[email protected] -98.99% (19,492 rps) (avg: 51μs)
[email protected] -99.03% (18,827 rps) (avg: 53μs)

👉 schema.typeofweb.com 👈

About

@typeofweb/schema: Lightweight validator with 100% TypeScript support and sane coercion rules.

schema.typeofweb.com

Topics

functional-programminghacktoberfestjsonschemaschematstypescriptvalidationvalidation-libraryvalidations

Resources

Readme
MIT license

Code of conduct

Code of conduct
Activity
Custom properties

Stars

137 stars

Watchers

0 watching

Forks

7 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.