diff --git a/src/api/endpoint/api/dist-tags.js b/src/api/endpoint/api/dist-tags.js index a363ee2c7..363cbeba6 100644 --- a/src/api/endpoint/api/dist-tags.js +++ b/src/api/endpoint/api/dist-tags.js @@ -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); } diff --git a/src/api/endpoint/api/publish.js b/src/api/endpoint/api/publish.js index 7103c8a21..c4ed89bc2 100644 --- a/src/api/endpoint/api/publish.js +++ b/src/api/endpoint/api/publish.js @@ -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); } diff --git a/src/lib/storage.js b/src/lib/storage.js index 4456adeb9..72d33b25c 100644 --- a/src/lib/storage.js +++ b/src/lib/storage.js @@ -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) { diff --git a/test/unit/st_merge.spec.js b/test/unit/st_merge.spec.js index 22d48aa6d..7f1a8465d 100644 --- a/test/unit/st_merge.spec.js +++ b/test/unit/st_merge.spec.js @@ -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: {},