Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/router / dist / react-router-config / matchRoutes.js
Size: Mime:
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const matchPath_1 = __importDefault(require("react-router/matchPath"));
const Router_1 = __importDefault(require("react-router/Router"));
// ensure we're using the exact code for default root match
const { computeMatch } = Router_1.default.prototype;
const matchRoutes = (routes, pathname, /* not public API*/ branch = []) => {
    routes.some(route => {
        const match = route.path
            ? matchPath_1.default(pathname, route)
            : branch.length
                // use parent match
                ? branch[branch.length - 1].match
                // use default "root" match
                : computeMatch(pathname);
        if (match) {
            branch.push({ route, match });
            if (route.routes) {
                matchRoutes(route.routes, pathname, branch);
            }
        }
        return match;
    });
    return branch;
};
exports.default = matchRoutes;
//# sourceMappingURL=matchRoutes.js.map