0.1.0 • Published 8 years ago

valid-type v0.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

valid-type

Type checking, regex testing and property exist for Javascript.

Usage

var schema = [
    { property: "id", type: Number },
    { property: "date", type: String, regex: /^\d{4}-\d{2}-\d{2}$/ },
    { property: "text", type: String }
];

if(validator(schema, objectToTest)) {
    console.log("validation ok");
} else {
    console.log("validation failed");
}

See test.js in package for more information