@playerony/validator

2.0.0 • Public • Published

validator-js

Usage

Simple object validation using JSON schemas - another part of my project at University

Example

const data = {
  name: "test@gmail.com",
  objects: ["13.12.1995", "13.12.1995"]
};

const schema = {
  parameters: {
    name: {
      type: "string",
      format: "email"
    },
    objects: {
      type: "array",
      items: {
        type: "string",
        format: "date"
      }
    }
  },
  required: ["name", "objects"]
};

validate(data, schema);

/@playerony/validator/

    Package Sidebar

    Install

    npm i @playerony/validator

    Weekly Downloads

    3

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    8.09 kB

    Total Files

    9

    Last publish

    Collaborators

    • playerony