.jshintrc, code style

master
Evgeny Poberezkin 2015-08-11 19:06:32 +01:00
parent 7772cd27fd
commit 1a1353717b
4 changed files with 15 additions and 8 deletions

7
.jshintrc Normal file
View File

@ -0,0 +1,7 @@
{
"laxcomma": true,
"laxbreak": true,
"curly": false,
"-W058": true,
"eqeqeq": false
}

View File

@ -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));

View File

@ -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);
}
}

View File

@ -3,7 +3,7 @@
var Cache = module.exports = function Cache() {
this._cache = {};
}
};
Cache.prototype.put = function Cache_put(key, value) {