How to use the addFormat function from tv4

Find comprehensive JavaScript tv4.addFormat code examples handpicked from public code repositorys.

145
146
147
148
149
150
151
152
153
154
exports.getPrettySpecs = function () {
    return specs.bundled;
};

exports.addFormat = function (format, validationFunction) {
    tv4.addFormat(format, validationFunction);
};

/**
 * Validate an arbitrary object against a model definition in a given specification
fork icon25
star icon140
watch icon38

+ 5 other calls in file

5
6
7
8
9
10
11
12
13
14
    validateRequest: validate
};

function validate(req) {
    var res = {valid: true};
    tv4.addFormat(formats);
    var schemaKey = req.route ? req.route.path.toString().replace('/', '') : '';
    var actionKey = req.route.name;
    if (schemas[schemaKey]) {
        var mySchema = schemas[schemaKey][actionKey];
fork icon0
star icon0
watch icon0