From 80481574482edfbd5fc636d5a3022403ffa6d21e Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Mon, 5 Feb 2018 09:48:15 -0500 Subject: [PATCH] Use forof loop instead of foreach for clearing pruning custom networks --- common/sagas/config/network.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/sagas/config/network.ts b/common/sagas/config/network.ts index 2f11a833..b6a3f106 100644 --- a/common/sagas/config/network.ts +++ b/common/sagas/config/network.ts @@ -5,7 +5,7 @@ import { SagaIterator } from 'redux-saga'; import { AppState } from 'reducers'; // If there are any orphaned custom networks, purge them -export function* cleanCustomNetworks(): SagaIterator { +export function* pruneCustomNetworks(): SagaIterator { const customNodes: AppState['config']['nodes']['customNodes'] = yield select( getCustomNodeConfigs ); @@ -13,11 +13,11 @@ export function* cleanCustomNetworks(): SagaIterator { getCustomNetworkConfigs ); - Object.values(customNodes).forEach(function*(n) { + for (const n of Object.values(customNodes)) { if (!customNetworks[n.network]) { yield put(removeCustomNetwork({ id: n.network })); } - }); + } } -export const network = [takeEvery(TypeKeys.CONFIG_REMOVE_CUSTOM_NODE, cleanCustomNetworks)]; +export const network = [takeEvery(TypeKeys.CONFIG_REMOVE_CUSTOM_NODE, pruneCustomNetworks)];