@foxify/schemadeprecated

TypeScript schema validation

Usage no npm install needed!

<script type="module">
  import foxifySchema from 'https://cdn.skypack.dev/@foxify/schema';
</script>

README

schema

TypeScript ready object schema validation

NPM Version TypeScript Version Tested With Jest Pull Requests License Build Status Coverage Status Package Quality Dependencies Status NPM Total Downloads NPM Monthly Downloads Open Issues Closed Issues known vulnerabilities Github Stars Github Forks

Table of Content

Getting Started

Installation

NPM:

npm i @foxify/schema

Yarn:

yarn add @foxify/schema

Github Packages:

npm i @foxifyjs/schema

Usage

import Schema from "@foxify/schema";

const schema = {
  username: Schema.string()
    .alphanum()
    .required(),
  name: Schema.object().keys({
    first: Schema.string()
      .min(3)
      .required(),
    last: Schema.string().min(3),
  }).required(),
  datetime: Schema.date().default(Date.now),
};

try {
  const result = Schema.object().keys(schema).validate(value);
} catch (error) {
  // your error handler
}

for more details read the documents

Sponsors

Support this project by becoming a sponsor. Your logo will show up here. [Become a sponsor]

Sponsors

Authors

See also the list of contributors who participated in this project.

Versioning

We use SemVer for versioning. For the versions available, see the releases.

License

This project is licensed under the MIT License - see the LICENSE file for details