Now with Partition Management

    validatit
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.17 • Public • Published

    Welcome to validatit 👋

    Version Documentation Maintenance License: MIT

    Validatit helps you to validate JSON objects.

    🏠 Homepage

    Install

    npm i validatit@latest

    Usage

    import {validatit} from 'validatit'

    Call validatit function

    let json = {
        first_name:"jamie",
        phone:"+18889203388",
        address:{
            street:""
        }
    };
    let params=[
        {name:"*first_name:STRING"},
        {name:"*phone:PHONE"} ,
        {
        name:"address",
        params:[
          {name:"*street"}
        ]
        }
    
    ];
    let res = await validatit(json,params);

    Params

    Parameter name description example notes
    name name of the parameter to ve validated name:"first_name"
    required indicates that the parameter is mandatory {name:"first_name" ,required:true} you can use {name:"*first_name"} instead to have smaller validators
    type parameter type. Current types are :ARRAY, OBJECT, BOOLEAN, STRING, NUMBER, FUNCTION, DATE, CREDIT_CARD, EMAIL, PHONE, ANY {name:"first_name" ,type:"STRING"} you can use {name:"first_name:STRING"} instead to have smaller validators
    pattern custom regular expression {name:"first_name",pattern:/^[A-Z][a-z]+(?:[A-Z][a-z]+)*$/}
    dynamicValidation used for custom runtime validations {name:"first_name",dynamicValidation:asyc(body)=>return {success:true,error_message:""}}

    Run tests

    npm run test

    Author

    👤 Bahram Ghahari

    🤝 Contributing

    Contributions, issues and feature requests are welcome!
    Feel free to check issues page. You can also take a look at the contributing guide.

    Show your support

    Give a ⭐️ if this project helped you!

    📝 License

    Copyright © 2021 Bahram Ghahari.
    This project is MIT licensed.


    This README was generated with ❤️ by readme-md-generator

    Install

    npm i validatit

    DownloadsWeekly Downloads

    68

    Version

    1.0.17

    License

    MIT

    Unpacked Size

    1.8 MB

    Total Files

    114

    Last publish

    Collaborators

    • xbg13