All files / jit-router/src steps.ts

100% Statements 15/15
62.5% Branches 5/8
100% Functions 6/6
100% Lines 15/15

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 31 32 33 346x 143x     17x       6x   98x 98x       8x 8x       6x   11x 11x 11x       6x 6x 6x      
export class ExactStep {
  constructor(public readonly text: string) {}
 
  public toText() {
    return this.text;
  }
}
 
export class UntilStep {
  constructor(
    public readonly name: string,
    public readonly until: string,
  ) {}
 
  public toText() {
    const until = this.until === '\n' ? '\\n' : this.until;
    return `{${this.name}::${until}}`;
  }
}
 
export class RegexStep {
  constructor(
    public readonly name: string,
    public readonly regex: string,
    public readonly until: string,
  ) {}
 
  public toText() {
    const regex = this.regex || this.until ? ':' + this.regex : '';
    const until = this.until ? ':' + this.until : '';
    return `{${this.name}${regex}${until}}`;
  }
}