import { Operator } from './Operator' ; export class DeviceVintage { constructor ( public readonly year , public readonly operator = Operator . EqualsTo ) { } public matches ( deviceVintage ) { const { year , operator } = deviceVintage ; switch ( operator ) { case Operator . EqualsTo : return this . year === year ; case Operator . GreaterThanOrEqualsTo : return this . year >= year ; case Operator . LessThanOrEqualsTo : return this . year <= year ; default : return false ; } } }