Skip to content

rootDeibis/typer-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typer-js

TyperJS is a tool for validating object schemas.

This script was created for personal use, it probably has its bugs. If you want to use it then go ahead

Example

import { typerSync } from "../dist/main.js";


const Scheme = {
    name: 'string',
    years: {
        type: 'number',
        pre(value, cancel) {

            if(value < 18) {
                cancel("You must be of legal age");
                return false;
            }

        }
    }
}

typerSync(Scheme, {
    name: 'Pablo',
    years: 12
})
.then((obj) => {
    console.log(`Hello ${obj.name} !`);
})
.catch((errors) => {
    console.error("Errors", errors);
});

About

TyperJS is a tool for validating object schemas.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published