diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..f8728f3 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,7 @@ +{ + "laxcomma": true, + "laxbreak": true, + "curly": false, + "-W058": true, + "eqeqeq": false +} \ No newline at end of file diff --git a/bin/compile-dots.js b/bin/compile-dots.js index d82a3e5..c6840f7 100644 --- a/bin/compile-dots.js +++ b/bin/compile-dots.js @@ -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)); diff --git a/lib/ajv.js b/lib/ajv.js index 856e48b..4beace2 100644 --- a/lib/ajv.js +++ b/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); } } diff --git a/lib/cache.js b/lib/cache.js index f774727..96f435b 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -3,7 +3,7 @@ var Cache = module.exports = function Cache() { this._cache = {}; -} +}; Cache.prototype.put = function Cache_put(key, value) {