All files / range/src range.ts

100% Statements 11/11
100% Branches 0/0
100% Functions 5/5
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30    5x 5x 5x 5x     17x 17x 17x         17x     39x       27x       24x      
import { Comparator } from "@benneq/comparator";
 
export abstract class Range<T> {
  #comparator;
  #from;
  #to;
 
  constructor(comparator: Comparator<T>, from: T, to: T) {
    this.#comparator = comparator;
    this.#from = from;
    this.#to = to;
  }
 
  abstract contains(value: T): boolean;
 
  readonly empty: boolean = false;
 
  get comparator(): Comparator<T> {
    return this.#comparator;
  }
 
  get from(): T {
    return this.#from;
  }
 
  get to(): T {
    return this.#to;
  }
}