mirror of https://github.com/renovatebot/renovate
20 lines
556 B
TypeScript
20 lines
556 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 DepNameMatcher extends Matcher {
|
|
override matches(
|
|
{ depName }: PackageRuleInputConfig,
|
|
{ matchDepNames }: PackageRule,
|
|
): boolean | null {
|
|
if (is.undefined(matchDepNames)) {
|
|
return null;
|
|
}
|
|
if (is.undefined(depName)) {
|
|
return false;
|
|
}
|
|
return matchRegexOrGlobList(depName, matchDepNames);
|
|
}
|
|
}
|