mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
69dab293f5
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
21 lines
559 B
TypeScript
21 lines
559 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type { PackageRule, PackageRuleInputConfig } from '../../config/types';
|
|
import { matchRegexOrGlobList } from '../string-match';
|
|
import { Matcher } from './base';
|
|
|
|
export class SourceUrlsMatcher extends Matcher {
|
|
override matches(
|
|
{ sourceUrl }: PackageRuleInputConfig,
|
|
{ matchSourceUrls }: PackageRule,
|
|
): boolean | null {
|
|
if (is.undefined(matchSourceUrls)) {
|
|
return null;
|
|
}
|
|
if (!sourceUrl) {
|
|
return false;
|
|
}
|
|
|
|
return matchRegexOrGlobList(sourceUrl, matchSourceUrls);
|
|
}
|
|
}
|