.jshintrc, code style
parent
7772cd27fd
commit
1a1353717b
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"laxcomma": true,
|
||||
"laxbreak": true,
|
||||
"curly": false,
|
||||
"-W058": true,
|
||||
"eqeqeq": false
|
||||
}
|
|
@ -9,7 +9,7 @@ var glob = require('glob')
|
|||
var defs = fs.readFileSync(path.join(__dirname, '../lib/dot/definitions.def'));
|
||||
var files = glob.sync('../lib/dot/*.jst', { cwd: __dirname });
|
||||
|
||||
console.log('\n\nCompiling:')
|
||||
console.log('\n\nCompiling:');
|
||||
|
||||
files.forEach(function (f) {
|
||||
var template = fs.readFileSync(path.join(__dirname, f));
|
||||
|
|
12
lib/ajv.js
12
lib/ajv.js
|
@ -4,8 +4,7 @@ var compileSchema = require('./compile')
|
|||
, resolve = require('./compile/resolve')
|
||||
, Cache = require('./cache')
|
||||
, stableStringify = require('json-stable-stringify')
|
||||
, formats = require('./compile/formats')
|
||||
, util = require('./compile/util');
|
||||
, formats = require('./compile/formats');
|
||||
|
||||
module.exports = Ajv;
|
||||
|
||||
|
@ -88,7 +87,7 @@ function Ajv(opts) {
|
|||
return;
|
||||
}
|
||||
// can key/id have # inside?
|
||||
var key = resolve.normalizeId(key || schema.id);
|
||||
key = resolve.normalizeId(key || schema.id);
|
||||
checkUnique(key);
|
||||
self._schemas[key] = _addSchema(schema, _skipValidation);
|
||||
}
|
||||
|
@ -103,7 +102,7 @@ function Ajv(opts) {
|
|||
function addMetaSchema(schema, key, _skipValidation) {
|
||||
var currentRemoveAdditional = self.opts.removeAdditional;
|
||||
self.opts.removeAdditional = false;
|
||||
var validate = addSchema(schema, META_SCHEMA_ID, _skipValidation);
|
||||
addSchema(schema, META_SCHEMA_ID, _skipValidation);
|
||||
self.opts.removeAdditional = currentRemoveAdditional;
|
||||
}
|
||||
|
||||
|
@ -142,15 +141,16 @@ function Ajv(opts) {
|
|||
* @param {String|Object} schemaKeyRef key, ref or schema object
|
||||
*/
|
||||
function removeSchema(schemaKeyRef) {
|
||||
var str;
|
||||
if (typeof schemaKeyRef == 'string') {
|
||||
schemaKeyRef = resolve.normalizeId(schemaKeyRef);
|
||||
var v = self._schemas[schemaKeyRef] || self._refs[schemaKeyRef];
|
||||
delete self._schemas[schemaKeyRef];
|
||||
delete self._refs[schemaKeyRef];
|
||||
var str = stableStringify(v.schema);
|
||||
str = stableStringify(v.schema);
|
||||
self._cache.put(str);
|
||||
} else {
|
||||
var str = stableStringify(schemaKeyRef);
|
||||
str = stableStringify(schemaKeyRef);
|
||||
self._cache.put(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
var Cache = module.exports = function Cache() {
|
||||
this._cache = {};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.put = function Cache_put(key, value) {
|
||||
|
|
Loading…
Reference in New Issue