2.0.0 • Published 7 years ago

@playerony/validator v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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);