1.3.7 • Published 5 years ago

oflc_validations v1.3.7

Weekly downloads
2
License
ISC
Repository
-
Last release
5 years ago

oflc_validations

This is a wrapper on validation.js, contains some complex validation functions used across our project both on the client side and server side.

https://validatejs.org/

import validator from oflc_validation;

Additional Validation API

let data = {
    name: "Darrell",
    email: "darrell@gmail.com",
    date1: "2019-08-09T13:14:57.517-04:00",
    date2: "2019-09-09T13:14:57.517-04:00"
}

let schema = {
    name : { presence: true },
    email: { matchRegex: { regex: "gmail" },
    date1: { presence: true },
    date2: {
        presence: true,
        dateComparer: { compareOperator: ">", DateToCompare: "date1" }
    }
}

This will give an array of object errors.

let errors = validator(data, schema);

Schema building

  • required: used for conditional presence validator ( takes when, is, and operator )

  • multipleRequired: takes or or and arrays with the conditional shape: ( takes when, is, and operator )

  • customLength: takes the same props as length from validate.js. No additional arguments? Empty strings not valuated. Optionally accepts a conditional prop ( takes when, is, and operator ). Should only use this validator if the field is optional OR conditionally required.

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago