mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 13:48:55 +00:00
19 lines
522 B
TypeScript
19 lines
522 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type { Repository } from './types';
|
|
|
|
export function isOCIRegistry(
|
|
repository: Repository | string | null | undefined,
|
|
): boolean {
|
|
if (is.nullOrUndefined(repository)) {
|
|
return false;
|
|
}
|
|
const repo = is.string(repository) ? repository : repository.repository;
|
|
return repo.startsWith('oci://');
|
|
}
|
|
|
|
export function removeOCIPrefix(repository: string): string {
|
|
if (isOCIRegistry(repository)) {
|
|
return repository.replace('oci://', '');
|
|
}
|
|
return repository;
|
|
}
|