From 445df5b30e704539603c7d01c2cd96d17aa63c6b Mon Sep 17 00:00:00 2001 From: Juan Picado Date: Tue, 9 May 2017 09:56:54 +0200 Subject: [PATCH] Fix eslint, add jsdoc on storage lib --- lib/storage.js | 131 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 43 deletions(-) diff --git a/lib/storage.js b/lib/storage.js index ea2f56461..e65669bf9 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -67,24 +67,36 @@ class Storage { }); }); + /** + * Check whether a package it is already a local package + * @param {*} cb the callback method + */ function check_package_local(cb) { self.local.get_package(name, {}, function(err, results) { - if (err && err.status !== 404) return cb(err); - - if (results) return cb( Error[409]('this package is already present') ); - + if (err && err.status !== 404) { + return cb(err); + } + if (results) { + return cb( Error[409]('this package is already present') ); + } cb(); }); } + /** + * Check whether a package exist in any of the uplinks. + * @param {*} cb the callback method + */ function check_package_remote(cb) { self._sync_package_with_uplinks(name, null, {}, function(err, results, err_results) { // something weird - if (err && err.status !== 404) return cb(err); - + if (err && err.status !== 404) { + return cb(err); + } // checking package - if (results) return cb( Error[409]('this package is already present') ); - + if (results) { + return cb( Error[409]('this package is already present') ); + } for (let i=0; i