mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
e5cbbaaf09
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
22 lines
652 B
TypeScript
22 lines
652 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type { PackageRule, PackageRuleInputConfig } from '../../config/types';
|
|
import { Matcher } from './base';
|
|
|
|
export class SourceUrlPrefixesMatcher extends Matcher {
|
|
override matches(
|
|
{ sourceUrl }: PackageRuleInputConfig,
|
|
{ matchSourceUrlPrefixes }: PackageRule,
|
|
): boolean | null {
|
|
if (is.undefined(matchSourceUrlPrefixes)) {
|
|
return null;
|
|
}
|
|
if (is.undefined(sourceUrl)) {
|
|
return false;
|
|
}
|
|
const upperCaseSourceUrl = sourceUrl?.toUpperCase();
|
|
|
|
return matchSourceUrlPrefixes.some(
|
|
(prefix) => upperCaseSourceUrl?.startsWith(prefix.toUpperCase()),
|
|
);
|
|
}
|
|
}
|