0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

Merge pull request #1417 from jamesgeorge007/feat/minor-refactor

chore: minor refactor to eliminate code redundancy
This commit is contained in:
Juan Picado @jotadeveloper 2019-07-31 22:25:44 +02:00 committed by GitHub
commit 6aa3bdc514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,10 +70,8 @@ export function validateName(name: string): boolean {
*/
return !(
!normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) ||
normalizedName.charAt(0) === '.' || // ".bin", etc.
normalizedName === 'node_modules' ||
normalizedName === '__proto__' ||
normalizedName === 'favicon.ico'
normalizedName.startsWith('.') || // ".bin", etc.
['node_modules', '__proto__', 'favicon.ico'].indexOf(normalizedName) !== -1
);
}