[MediaWiki-commits] [Gerrit] marvin[master]: Chore: restructure Router.ParsedRoute construction

2017-09-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/380674 )

Change subject: Chore: restructure Router.ParsedRoute construction
..


Chore: restructure Router.ParsedRoute construction

Focus on the unit instead of the whole by refactoring parseRoutes() to
parseRoute().

Change-Id: I0f42bb1fd47bdda2a8e87047a2d35224802d5b2b
---
M src/common/routers/router.ts
1 file changed, 9 insertions(+), 10 deletions(-)

Approvals:
  Jhernandez: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/common/routers/router.ts b/src/common/routers/router.ts
index f4382e7..28d624f 100644
--- a/src/common/routers/router.ts
+++ b/src/common/routers/router.ts
@@ -18,15 +18,14 @@
   regularExpression: RegExp;
 }
 
-const parseRoutes = (routes: AnyRoute[]) =>
-  routes.map((route: AnyRoute): ParsedRoute => {
-const paramNames: pathToRegExp.Key[] = [];
-return {
-  ...route,
-  paramNames,
-  regularExpression: pathToRegExp(route.path, paramNames)
-};
-  });
+const parseRoute = (route: AnyRoute): ParsedRoute => {
+  const paramNames: pathToRegExp.Key[] = [];
+  return {
+...route,
+paramNames,
+regularExpression: pathToRegExp(route.path, paramNames)
+  };
+};
 
 // This method is tightly coupled with Route.path and the parameters supplied 
to
 // PageModule.getInitialProps. Route.path must use names that match the typing
@@ -68,7 +67,7 @@
 }
 
 export const newRouter = (routes: AnyRoute[]): Router => {
-  const parsedRoutes: ParsedRoute[] = parseRoutes(routes);
+  const parsedRoutes: ParsedRoute[] = routes.map(route => parseRoute(route));
 
   return {
 route(url) {

-- 
To view, visit https://gerrit.wikimedia.org/r/380674
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0f42bb1fd47bdda2a8e87047a2d35224802d5b2b
Gerrit-PatchSet: 2
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski 
Gerrit-Reviewer: Jhernandez 
Gerrit-Reviewer: Sniedzielski 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] marvin[master]: Chore: restructure Router.ParsedRoute construction

2017-09-25 Thread Niedzielski (Code Review)
Niedzielski has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380674 )

Change subject: Chore: restructure Router.ParsedRoute construction
..

Chore: restructure Router.ParsedRoute construction

Focus on the unit instead of the whole by refactoring parseRoutes() to
parseRoute().

Change-Id: I0f42bb1fd47bdda2a8e87047a2d35224802d5b2b
---
M src/common/routers/router.ts
1 file changed, 9 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/74/380674/1

diff --git a/src/common/routers/router.ts b/src/common/routers/router.ts
index 308e1de..5d07135 100644
--- a/src/common/routers/router.ts
+++ b/src/common/routers/router.ts
@@ -18,15 +18,14 @@
   regularExpression: RegExp;
 }
 
-const parseRoutes = (routes: AnyRoute[]) =>
-  routes.map((route: AnyRoute): ParsedRoute => {
-const paramNames: pathToRegExp.Key[] = [];
-return {
-  ...route,
-  paramNames,
-  regularExpression: pathToRegExp(route.path, paramNames)
-};
-  });
+const parseRoute = (route: AnyRoute): ParsedRoute => {
+  const paramNames: pathToRegExp.Key[] = [];
+  return {
+...route,
+paramNames,
+regularExpression: pathToRegExp(route.path, paramNames)
+  };
+};
 
 // This method is tightly coupled with Route.path and the parameters supplied 
to
 // PageModule.requestProps. Route.path must use names that match the typing for
@@ -69,7 +68,7 @@
 }
 
 export const newRouter = (routes: AnyRoute[]): Router => {
-  const parsedRoutes: ParsedRoute[] = parseRoutes(routes);
+  const parsedRoutes: ParsedRoute[] = routes.map(route => parseRoute(route));
 
   return {
 route(url) {

-- 
To view, visit https://gerrit.wikimedia.org/r/380674
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f42bb1fd47bdda2a8e87047a2d35224802d5b2b
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski 
Gerrit-Reviewer: Sniedzielski 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits