From cf2a85d01fe210691f9e59ac65d817d0a658e4a4 Mon Sep 17 00:00:00 2001 From: testless <39350336+testless@users.noreply.github.com> Date: Tue, 21 Aug 2018 08:28:04 +0200 Subject: [PATCH 1/4] Rearraging arguments At the moment, is it only possible to use a service once. But there might be situations, where you want the same services being stored in different variables. At the moment, the code assume serviceName => variableName, thus providing a way of renaming the serviceName only. My proposal here is to variableName => serviceName, which would allow something like. myUser -> users currentlySelectedUser -> users myBoss -> users --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index cbad816..78d9128 100755 --- a/src/index.js +++ b/src/index.js @@ -391,8 +391,8 @@ export default (app, routeNameMap, options) => { routeNames = routeNameMap; } - Object.keys(routeNames).forEach(route => { - services[routeNames[route]] = reduxifyService(app, route, routeNames[route], options); + Object.keys(routeNames).forEach(name => { + services[name] = reduxifyService(app, routeNames[name], name, options); }); return services; From 6cabedb59dcaadfbe3944327130e338ca859a94b Mon Sep 17 00:00:00 2001 From: testless <39350336+testless@users.noreply.github.com> Date: Tue, 21 Aug 2018 08:51:16 +0200 Subject: [PATCH 2/4] Update index.js --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 78d9128..78d7b6b 100755 --- a/src/index.js +++ b/src/index.js @@ -391,8 +391,9 @@ export default (app, routeNameMap, options) => { routeNames = routeNameMap; } - Object.keys(routeNames).forEach(name => { - services[name] = reduxifyService(app, routeNames[name], name, options); + Object.keys(routeNames).forEach(route => { + const names = Array.isArray(routeNames[route]) ? routeNames[route] : [routeNames[route]] + names.forEach(name => services[name] = reduxifyService(app, route, name, options)); }); return services; From 3c56560f938602a1b8d4454eb8e45cdf4d2a58e2 Mon Sep 17 00:00:00 2001 From: testless <39350336+testless@users.noreply.github.com> Date: Tue, 21 Aug 2018 08:55:06 +0200 Subject: [PATCH 3/4] Update index.js --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 78d7b6b..9282671 100755 --- a/src/index.js +++ b/src/index.js @@ -392,7 +392,7 @@ export default (app, routeNameMap, options) => { } Object.keys(routeNames).forEach(route => { - const names = Array.isArray(routeNames[route]) ? routeNames[route] : [routeNames[route]] + const names = Array.isArray(routeNames[route]) ? routeNames[route] : [routeNames[route]]; names.forEach(name => services[name] = reduxifyService(app, route, name, options)); }); From 2b5c15c24973a94b1bba1fd4309e9047612fcbf7 Mon Sep 17 00:00:00 2001 From: testless <39350336+testless@users.noreply.github.com> Date: Tue, 21 Aug 2018 08:58:15 +0200 Subject: [PATCH 4/4] Fix linting --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 9282671..f7e3b4e 100755 --- a/src/index.js +++ b/src/index.js @@ -393,7 +393,9 @@ export default (app, routeNameMap, options) => { Object.keys(routeNames).forEach(route => { const names = Array.isArray(routeNames[route]) ? routeNames[route] : [routeNames[route]]; - names.forEach(name => services[name] = reduxifyService(app, route, name, options)); + names.forEach(name => { + services[name] = reduxifyService(app, route, name, options); + }); }); return services;