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:
parent
e50d4d92a2
commit
d78561a3fd
1 changed files with 1 additions and 25 deletions
|
@ -1,20 +1,12 @@
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { PackageList, UpLinksConfList } from '@verdaccio/types';
|
import { PackageList } from '@verdaccio/types';
|
||||||
import { getMatchedPackagesSpec } from '@verdaccio/utils';
|
import { getMatchedPackagesSpec } from '@verdaccio/utils';
|
||||||
|
|
||||||
import { LegacyPackageList, MatchedPackage } from '../types';
|
import { LegacyPackageList, MatchedPackage } from '../types';
|
||||||
import { ErrorCode } from './utils';
|
import { ErrorCode } from './utils';
|
||||||
|
|
||||||
const BLACKLIST = {
|
|
||||||
all: true,
|
|
||||||
anonymous: true,
|
|
||||||
undefined: true,
|
|
||||||
owner: true,
|
|
||||||
none: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize user list.
|
* Normalize user list.
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
@ -42,22 +34,6 @@ export function normalizeUserList(oldFormat: any, newFormat: any): any {
|
||||||
return _.flatten(result);
|
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
|
* Check whether an uplink can proxy
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue