mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
879f7cc212
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
21 lines
608 B
TypeScript
21 lines
608 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 PackageNameMatcher extends Matcher {
|
|
override matches(
|
|
{ packageName }: PackageRuleInputConfig,
|
|
packageRule: PackageRule,
|
|
): boolean | null {
|
|
const { matchPackageNames } = packageRule;
|
|
if (is.undefined(matchPackageNames)) {
|
|
return null;
|
|
}
|
|
if (!packageName) {
|
|
return false;
|
|
}
|
|
return matchRegexOrGlobList(packageName, matchPackageNames);
|
|
}
|
|
}
|