0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/modules/versioning/common.ts
2023-11-07 15:50:29 +00:00

25 lines
704 B
TypeScript

import { regEx } from '../../util/regex';
import type { VersioningApi, VersioningApiConstructor } from './types';
export function isVersioningApiConstructor(
obj: VersioningApi | VersioningApiConstructor,
): obj is VersioningApiConstructor {
return typeof obj === 'function';
}
export function getExcludedVersions(range: string): string[] {
return range
.split(',')
.map((v) => v.trim())
.filter((version) => regEx(/^!=/).test(version))
.map((version) => version.replace('!=', '').trim());
}
export function getFilteredRange(range: string): string {
return range
.split(',')
.map((v) => v.trim())
.filter((version) => !regEx(/^!=/).test(version))
.join(',');
}