UNPKG

@freshlysqueezedgames/hermes

Version:
34 lines (23 loc) 1 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _pathToRegexp = require('path-to-regexp'); var _pathToRegexp2 = _interopRequireDefault(_pathToRegexp); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Route * @description Defines a point of communication across a network, where it should communicate with, * and how the request should behave in general. */ var Route = function Route(path) { _classCallCheck(this, Route); var t = this; t.originalPath = path; path = path + '(/?.*)'; // Generalise to always match the beginning, and allow for any number of characters after t.ToPath = _pathToRegexp2.default.compile(path); t.re = (0, _pathToRegexp2.default)(path); }; exports.default = Route; //# sourceMappingURL=Route.js.map