| 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 = {};
}
}
|