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

refactor: getPackage method

This commit is contained in:
Juan Picado @jotadeveloper 2018-02-03 22:33:14 +01:00
parent bee4d1cf4f
commit 67414a5ed5
No known key found for this signature in database
GPG key ID: 18AC54485952D158
5 changed files with 6 additions and 6 deletions

View file

@ -49,7 +49,7 @@ module.exports = function(route, auth, storage) {
});
route.get('/-/package/:package/dist-tags', can('access'), function(req, res, next) {
storage.get_package({
storage.getPackage({
name: req.params.package,
req,
callback: function(err, info) {

View file

@ -37,7 +37,7 @@ module.exports = function(route, auth, storage, config) {
return next( createError[404]('version not found: ' + req.params.version) );
};
storage.get_package({
storage.getPackage({
name: req.params.package,
req,
callback: getPackageMetaCallback,

View file

@ -43,7 +43,7 @@ function addPackageWebApi(route, storage, auth) {
route.get('/package/readme/(@:scope/)?:package/:version?', can('access'), function(req, res, next) {
const packageName = req.params.scope ? addScope(req.params.scope, req.params.package) : req.params.package;
storage.get_package({
storage.getPackage({
name: packageName,
req,
callback: function(err, info) {
@ -60,7 +60,7 @@ function addPackageWebApi(route, storage, auth) {
route.get('/sidebar/(@:scope/)?:package', function(req, res, next) {
const packageName = req.params.scope ? addScope(req.params.scope, req.params.package) : req.params.package;
storage.get_package({
storage.getPackage({
name: packageName,
keepUpLinkData: true,
req,

View file

@ -7,7 +7,7 @@ function addSearchWebApi(route, storage, auth) {
const packages = [];
const getPackageInfo = function(i) {
storage.get_package({
storage.getPackage({
name: results[i].ref,
callback: (err, entry) => {
if (!err && entry) {

View file

@ -366,7 +366,7 @@ class Storage {
* @property {boolean} options.keepUpLinkData keep up link info in package meta, last update, etc.
* @property {function} options.callback Callback for receive data
*/
get_package(options) {
getPackage(options) {
this.localStorage.getPackageMetadata(options.name, (err, data) => {
if (err && (!err.status || err.status >= 500)) {
// report internal errors right away