mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
45c03819e2
* refactor: render middleware * refactor: render middleware
17 lines
421 B
TypeScript
17 lines
421 B
TypeScript
import _ from 'lodash';
|
|
|
|
export function getUserAgent(
|
|
customUserAgent?: boolean | string,
|
|
version?: string,
|
|
name?: string
|
|
): string {
|
|
if (customUserAgent === true) {
|
|
return `${name}/${version}`;
|
|
} else if (_.isString(customUserAgent) && _.isEmpty(customUserAgent) === false) {
|
|
return customUserAgent;
|
|
} else if (customUserAgent === false) {
|
|
return 'hidden';
|
|
}
|
|
|
|
return `${name}/${version}`;
|
|
}
|