All files route.js

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24          3x         3x         3x         3x      
import pathToRegexp from "path-to-regexp";
 
export default class Route {
  constructor(pattern, callback) {
 
    this.patternKeys = [];
 
    /**
     * @type {RegExp}
     */
    this.pattern = pathToRegexp(pattern, this.patternKeys);
 
    /**
     * @type {Function}
     */
    this.callback = callback;
 
    /**
     * @type {{}} Positional variables parsed from matched pattern.
     */
    this.variables = {};
  }
}