MCPcopy Create free account
hub / github.com/Lobos/react-ui / getIndexRoute

Function getIndexRoute

docs/lib/ReactRouter.js:4177–4206  ·  view source on GitHub ↗
(route, location, callback)

Source from the content-addressed store, hash-verified

4175 }
4176
4177 function getIndexRoute(route, location, callback) {
4178 if (route.indexRoute) {
4179 callback(null, route.indexRoute);
4180 } else if (route.getIndexRoute) {
4181 route.getIndexRoute(location, function (error, indexRoute) {
4182 callback(error, !error && _RouteUtils.createRoutes(indexRoute)[0]);
4183 });
4184 } else if (route.childRoutes) {
4185 (function () {
4186 var pathless = route.childRoutes.filter(function (obj) {
4187 return !obj.hasOwnProperty('path');
4188 });
4189
4190 _AsyncUtils.loopAsync(pathless.length, function (index, next, done) {
4191 getIndexRoute(pathless[index], location, function (error, indexRoute) {
4192 if (error || indexRoute) {
4193 var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
4194 done(error, routes);
4195 } else {
4196 next();
4197 }
4198 });
4199 }, function (err, routes) {
4200 callback(null, routes);
4201 });
4202 })();
4203 } else {
4204 callback();
4205 }
4206 }
4207
4208 function assignParams(params, paramNames, paramValues) {
4209 return paramNames.reduce(function (params, paramName, index) {

Callers 1

matchRouteDeepFunction · 0.85

Calls 2

nextFunction · 0.85
doneFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…