mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-24 22:48:06 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
26 lines
666 B
TypeScript
26 lines
666 B
TypeScript
import { isUndefined } from '@sindresorhus/is';
|
|
import type {
|
|
PackageRule,
|
|
PackageRuleInputConfig,
|
|
} from '../../config/types.ts';
|
|
import { getRegexOrGlobPredicate } from '../string-match.ts';
|
|
import { Matcher } from './base.ts';
|
|
|
|
export class CurrentValueMatcher extends Matcher {
|
|
override matches(
|
|
{ currentValue }: PackageRuleInputConfig,
|
|
{ matchCurrentValue }: PackageRule,
|
|
): boolean | null {
|
|
if (isUndefined(matchCurrentValue)) {
|
|
return null;
|
|
}
|
|
const matchCurrentValuePred = getRegexOrGlobPredicate(matchCurrentValue);
|
|
|
|
if (!currentValue) {
|
|
return false;
|
|
}
|
|
|
|
return matchCurrentValuePred(currentValue);
|
|
}
|
|
}
|