nons

0.3.0 • Public • Published

nons

simple, lightweight schema validation library

Installation

npm i nons

Usage

const validate = require("nons");
const types = require("nons/types");

const scheme = {
  this: {
    can: {
      as: {
        nested: {
          as: types.string,
        },
        you: types.array,
      },
      like: types.number,
    },
    with: {
      "optional?": types.string,
    },
  },
};

validate(schema, {
  this: {
    can: {
      as: {
        nested: {
          as: "works!",
        },
        you: ["also", "works!"],
      },
      like: 1,
    },
    with: {}, // only child is optional, but parent is required
  },
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.00
0.2.10
0.2.00
0.1.10
0.1.00

Package Sidebar

Install

npm i nons

Weekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

93.6 kB

Total Files

8

Last publish

Collaborators

  • adityavm