Skip to content

tsuba3/schemable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schemable

JSON Object Type Check Library

Usage

const user = T.obj({
    name: T.str.atLeast(4),
    pass: T.str.match(/[0-9a-zA-Z]{4,}/),
    age: T.int.atLeast(0),
    sex: T.oneOf(["male", "female"])
})

user.validate({
    name: "Beckey",
    pass: "P4SS",
    age: 19,
    sex: "female"
})

assert.throws(() => user.validate({
    name: "Beckey",
    pass: "P",
    age: 19,
    sex: "female"
}))

For more detail, see example.js

About

JSON Type Check Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published