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

chore: clean up code

This commit is contained in:
Juan Picado 2023-03-03 21:40:52 +01:00
parent e50d4d92a2
commit d78561a3fd

View file

@ -1,20 +1,12 @@
import assert from 'assert';
import _ from 'lodash';
import { PackageList, UpLinksConfList } from '@verdaccio/types';
import { PackageList } from '@verdaccio/types';
import { getMatchedPackagesSpec } from '@verdaccio/utils';
import { LegacyPackageList, MatchedPackage } from '../types';
import { ErrorCode } from './utils';
const BLACKLIST = {
all: true,
anonymous: true,
undefined: true,
owner: true,
none: true,
};
/**
* Normalize user list.
* @return {Array}
@ -42,22 +34,6 @@ export function normalizeUserList(oldFormat: any, newFormat: any): any {
return _.flatten(result);
}
export function sanityCheckNames(item: string, users: any): any {
assert(
item !== 'all' &&
item !== 'owner' &&
item !== 'anonymous' &&
item !== 'undefined' &&
item !== 'none',
'CONFIG: reserved uplink name: ' + item
);
assert(!item.match(/\s/), 'CONFIG: invalid uplink name: ' + item);
assert(_.isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);
users[item] = true;
return users;
}
/**
* Check whether an uplink can proxy
*/