How to use the freshApi function from tv4
Find comprehensive JavaScript tv4.freshApi code examples handpicked from public code repositorys.
GitHub: geraintluff/tv4

200 201 202 203 204 205 206 207 208
##### freshApi() Return a new tv4 instance with no shared state. ```` var otherTV4 = tv4.freshApi(); ```` ##### reset()
+ 3 other calls in file
GitHub: ikr/tv4-formats

15 16 17 18 19 20 21 22 23 24
```javascript var tv4 = require('tv4'), formats = require('tv4-formats'), assert = require('assert'), validator = tv4.freshApi(), schema = {type: 'string', format: 'date'}; validator.addFormat(formats); assert(validator.validate('2014-02-11', schema)); // Valid ISO 8601 date
+ 3 other calls in file
GitHub: timbeadle/grunt-tv4

34 35 36 37 38 39 40 41 42 43
}))); const objects = []; context.tv4 = context.options.fresh ? taskTv4.freshApi() : taskTv4; grunt.util._.each(context.options.schemas, (schema, uri) => { context.tv4.addSchema(uri, schema);
10 11 12 13 14 15 16 17 18
function Validator(opts) { if (!(this instanceof Validator)) return new Validator(opts); var self = this; this.tv4 = tv4.freshApi(); this._opts = util.copy(opts); var _schemas = this._opts.schemas = this._opts.schemas || {}; var _formats = this._opts.formats || {};
GitHub: limianwang/osmos-lite

101 102 103 104 105 106 107 108 109 110
Schema.prototype.loadSchemas = function () { Schema.validateSchema(this.__raw__); var self = this; this.validator = tv.freshApi(); this.validator.addSchema(this.schemaUri, this.__raw__); Object.keys(formats).forEach(function(key) { self.validator.addFormat(key, formats[key]);
+ 3 other calls in file
15 16 17 18 19 20 21 22 23 24
* @param {Object} [options={}] options * @param {Object} [options.customFormats] custom format validators * @param {boolean} [options.banUnknownProperties=false] disallow extra properties in validated objects */ constructor(spec, {customFormats, banUnknownProperties} = {}) { this.validator = tv4.freshApi() this.banUnknowns = banUnknownProperties this.validator.addFormat(formats) if (customFormats) {
+ 3 other calls in file
GitHub: OptimusLime/win-api

23 24 25 26 27 28 29 30 31
//this creates "internalAddSchema" to handle the weighty add logic //need to thoroughly test and modify incoming schema to align with //logical schema setup for WIN addSchemaSupport(self, localConfiguration.metaProperties); self.validator = tv4.freshApi(); //config setups self.multipleErrors = (localConfiguration.multipleErrors == true || localConfiguration.multipleErrors == "true");
tv4.validate is the most popular function in tv4 (982 examples)