0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

refactor: methods to camel case

This commit is contained in:
Juan Picado @jotadeveloper 2018-02-03 22:36:28 +01:00
parent 67414a5ed5
commit 42f23da363
No known key found for this signature in database
GPG key ID: 18AC54485952D158
4 changed files with 13 additions and 13 deletions

View file

@ -15,7 +15,7 @@ module.exports = function(route, auth, storage) {
let tags = {};
tags[req.params.tag] = req.body;
storage.merge_tags(req.params.package, tags, function(err) {
storage.mergeTags(req.params.package, tags, function(err) {
if (err) {
return next(err);
}
@ -37,7 +37,7 @@ module.exports = function(route, auth, storage) {
route.delete('/-/package/:package/dist-tags/:tag', can('publish'), function(req, res, next) {
const tags = {};
tags[req.params.tag] = null;
storage.merge_tags(req.params.package, tags, function(err) {
storage.mergeTags(req.params.package, tags, function(err) {
if (err) {
return next(err);
}
@ -63,7 +63,7 @@ module.exports = function(route, auth, storage) {
});
route.post('/-/package/:package/dist-tags', can('publish'), function(req, res, next) {
storage.merge_tags(req.params.package, req.body, function(err) {
storage.mergeTags(req.params.package, req.body, function(err) {
if (err) {
return next(err);
}

View file

@ -35,11 +35,11 @@ module.exports = function(router, auth, storage, config) {
};
const create_version = function(version, data, cb) {
storage.add_version(name, version, data, null, cb);
storage.addVersion(name, version, data, null, cb);
};
const add_tags = function(tags, cb) {
storage.merge_tags(name, tags, cb);
storage.mergeTags(name, tags, cb);
};
const after_change = function(err, ok_message) {
@ -175,7 +175,7 @@ module.exports = function(router, auth, storage, config) {
let version = req.params.version;
let tag = req.params.tag;
storage.add_version(name, version, req.body, tag, function(err) {
storage.addVersion(name, version, req.body, tag, function(err) {
if (err) {
return next(err);
}

View file

@ -144,7 +144,7 @@ class Storage {
* @param {*} tag
* @param {*} callback
*/
add_version(name, version, metadata, tag, callback) {
addVersion(name, version, metadata, tag, callback) {
this.localStorage.addVersion(name, version, metadata, tag, callback);
}
@ -155,7 +155,7 @@ class Storage {
* @param {*} tag_hash
* @param {*} callback
*/
merge_tags(name, tag_hash, callback) {
mergeTags(name, tag_hash, callback) {
this.localStorage.mergeTags(name, tag_hash, callback);
}
@ -569,7 +569,7 @@ class Storage {
this._updateVersionsHiddenUpLink(upLinkResponse.versions, upLink);
try {
Storage._merge_versions(packageInfo, upLinkResponse, self.config);
Storage._mergeVersions(packageInfo, upLinkResponse, self.config);
} catch(err) {
self.logger.error({
sub: 'out',
@ -643,7 +643,7 @@ class Storage {
* @param {*} config
* @static
*/
static _merge_versions(local, up, config) {
static _mergeVersions(local, up, config) {
// copy new versions to a cache
// NOTE: if a certain version was updated, we can't refresh it reliably
for (let i in up.versions) {

View file

@ -14,7 +14,7 @@ describe('Storage._merge_versions versions', () => {
'dist-tags': {},
};
Storage._merge_versions(pkg, {versions: {a: 2, q: 2}});
Storage._mergeVersions(pkg, {versions: {a: 2, q: 2}});
assert.deepEqual(pkg, {
'versions': {a: 1, b: 1, c: 1, q: 2},
@ -28,7 +28,7 @@ describe('Storage._merge_versions versions', () => {
'dist-tags': {q: '1.1.1', w: '2.2.2'},
};
Storage._merge_versions(pkg, {'dist-tags': {q: '2.2.2', w: '3.3.3', t: '4.4.4'}});
Storage._mergeVersions(pkg, {'dist-tags': {q: '2.2.2', w: '3.3.3', t: '4.4.4'}});
assert.deepEqual(pkg, {
'versions': {},
@ -48,7 +48,7 @@ describe('Storage._merge_versions versions', () => {
// against our local 1.1.10, which may end up published as 1.1.3 in the
// future
Storage._merge_versions(pkg, {'dist-tags':{q:'1.1.2',w:'3.3.3',t:'4.4.4'}})
Storage._mergeVersions(pkg, {'dist-tags':{q:'1.1.2',w:'3.3.3',t:'4.4.4'}})
assert.deepEqual(pkg, {
versions: {},