mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
897066123f
Co-authored-by: Rhys Arkins <rhys@arkins.net> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
22 lines
606 B
TypeScript
22 lines
606 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type { PackageRule, PackageRuleInputConfig } from '../../config/types';
|
|
import { satisfiesDateRange } from '../pretty-time';
|
|
import { Matcher } from './base';
|
|
|
|
export class CurrentAgeMatcher extends Matcher {
|
|
override matches(
|
|
{ currentVersionTimestamp }: PackageRuleInputConfig,
|
|
{ matchCurrentAge }: PackageRule,
|
|
): boolean | null {
|
|
if (!is.string(matchCurrentAge)) {
|
|
return null;
|
|
}
|
|
|
|
if (!is.string(currentVersionTimestamp)) {
|
|
return false;
|
|
}
|
|
|
|
return satisfiesDateRange(currentVersionTimestamp, matchCurrentAge);
|
|
}
|
|
}
|