0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00
verdaccio/packages/config/src/agent.ts
Juan Picado 45c03819e2
refactor: html render middleware improvements (#3603)
* refactor: render middleware

* refactor: render middleware
2023-02-12 20:26:18 +01:00

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}`;
}