domain-validation

domain validation

Usage no npm install needed!

<script type="module">
  import domainValidation from 'https://cdn.skypack.dev/domain-validation';
</script>

README

OBJECTIVE:

Helper Module for Object Validation

DESCRIPTION:

With this module you can create object scheme for object and validate it.

When the validation fails the module throws ArgumentError.

INSTALLATION

npm install domain-validation

USEAGE EXAMPLE

validator.validate(smsOptions, {
        phone: {
            required: 'please add phone number',
            numericString: 'this field must be numbers'
        },
        text: {
            required: 'please add text'
        }
    });

VALIDATORS

    required: ERROR_MESSAGE
    numericString: ERROR_MESSAGE
    email: ERROR_MESSAGE
    numric: ERROR_MESSAGE
    ip: ERROR_MESSAGE
    any: 
              options: ['array', 'of', 'options']
              msg: ERROR_MESSAGE