From 2675196672bb2ff906858bcd9975d77691a34f30 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Tue, 1 Oct 2013 22:02:23 +0400 Subject: [PATCH] jshinting --- lib/config.js | 38 +++++++++++++++++++------------------- lib/storage.js | 2 +- lib/up-storage.js | 4 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/config.js b/lib/config.js index 9e68dea01..61f069107 100644 --- a/lib/config.js +++ b/lib/config.js @@ -61,28 +61,28 @@ function Config(config) { , 'CONFIG: wrong url format for uplink: ' + i); this.uplinks[i].url = this.uplinks[i].url.replace(/\/$/, ''); } - - for (var i in this.packages) { - var check_userlist = function(i, hash, action) { - if (hash[action] == null) hash[action] = []; + + function check_userlist(i, hash, action) { + if (hash[action] == null) hash[action] = []; - // if it's a string, split it to array - if (typeof(hash[action]) === 'string') { - hash[action] = hash[action].split(/\s+/); - } - - assert( - typeof(hash[action]) === 'object' && - Array.isArray(hash[action]) - , 'CONFIG: bad "'+i+'" package '+action+' description (array or string expected)'); - hash[action] = flatten(hash[action]); - hash[action].forEach(function(user) { - assert( - users[user] != null - , 'CONFIG: "'+i+'" package: user "'+user+'" doesn\'t exist'); - }); + // if it's a string, split it to array + if (typeof(hash[action]) === 'string') { + hash[action] = hash[action].split(/\s+/); } + assert( + typeof(hash[action]) === 'object' && + Array.isArray(hash[action]) + , 'CONFIG: bad "'+i+'" package '+action+' description (array or string expected)'); + hash[action] = flatten(hash[action]); + hash[action].forEach(function(user) { + assert( + users[user] != null + , 'CONFIG: "'+i+'" package: user "'+user+'" doesn\'t exist'); + }); + } + + for (var i in this.packages) { assert( typeof(this.packages[i]) === 'object' && !Array.isArray(this.packages[i]) diff --git a/lib/storage.js b/lib/storage.js index 307f4dfba..aa3edb68a 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -184,7 +184,7 @@ Storage.prototype.add_tarball = function(name, filename) { upstream._sinopia_success = true; if (upstreams.filter(function(upstream) { return !upstream._sinopia_success; - }).length == 0) { + }).length === 0) { stream.emit('success'); } }); diff --git a/lib/up-storage.js b/lib/up-storage.js index 365f78591..bb39250ea 100644 --- a/lib/up-storage.js +++ b/lib/up-storage.js @@ -12,11 +12,11 @@ function Storage(config, mainconfig) { this.config = config; this.is_alive = false; this.userAgent = mainconfig.user_agent; - this.ca; + this.ca = config.ca; this.url = URL.parse(this.config.url); if (this.url.hostname === 'registry.npmjs.org') { - this.ca = require('./npmsslkeys'); + this.ca = this.ca || require('./npmsslkeys'); // npm registry is too slow working with ssl :( /*if (this.config._autogenerated) {