UNPKG

js-model-validation

Version:

js-model-validation is js model validation lib to validate the model property. It's allow range of property validations like 'string', 'number', 'json' etc. It's not only validate the model but also return the data from 'req.body' (if node app).

35 lines (30 loc) 1.12 kB
# js-model-valiation a [Js Model Validation v0.0.11](#) application How to use: <pre> columns [{ name: 'columns name', type: 'column type', default set to 'string' -> [string, email, number, date, json, array] validation: { required: true, -> true or false (false will ignore all the validation for the column) message: '[column] is required.', min: 0, string or number column allowed input, default 0 when required set to true max: 50, string or number column allowed input, default 'max' rangmessage: 'min 3 and max 20', only display when min, max or min and max values are provided }, nesteditems: false, default set to false, when set to true 'validationitems' need to set and for this 'name', 'type', validation and other attribute ignored. validationitems: [ name: 'column name', type: 'column type', ..... ] }] config -> config is optional showAllMessage: boolean -> default set to false { true: Display all the error messages. false: Display first found error messages. } req or validation data </pre>