mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 18:19:51 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
25 lines
628 B
TypeScript
25 lines
628 B
TypeScript
import { isString } from '@sindresorhus/is';
|
|
import type {
|
|
PackageRule,
|
|
PackageRuleInputConfig,
|
|
} from '../../config/types.ts';
|
|
import { satisfiesDateRange } from '../pretty-time.ts';
|
|
import { Matcher } from './base.ts';
|
|
|
|
export class CurrentAgeMatcher extends Matcher {
|
|
override matches(
|
|
{ currentVersionTimestamp }: PackageRuleInputConfig,
|
|
{ matchCurrentAge }: PackageRule,
|
|
): boolean | null {
|
|
if (!isString(matchCurrentAge)) {
|
|
return null;
|
|
}
|
|
|
|
if (!isString(currentVersionTimestamp)) {
|
|
return false;
|
|
}
|
|
|
|
return satisfiesDateRange(currentVersionTimestamp, matchCurrentAge);
|
|
}
|
|
}
|