Use forof loop instead of foreach for clearing pruning custom networks

This commit is contained in:
HenryNguyen5 2018-02-05 09:48:15 -05:00
parent 44244e907a
commit 8048157448
1 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import { SagaIterator } from 'redux-saga';
import { AppState } from 'reducers'; import { AppState } from 'reducers';
// If there are any orphaned custom networks, purge them // 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( const customNodes: AppState['config']['nodes']['customNodes'] = yield select(
getCustomNodeConfigs getCustomNodeConfigs
); );
@ -13,11 +13,11 @@ export function* cleanCustomNetworks(): SagaIterator {
getCustomNetworkConfigs getCustomNetworkConfigs
); );
Object.values(customNodes).forEach(function*(n) { for (const n of Object.values(customNodes)) {
if (!customNetworks[n.network]) { if (!customNetworks[n.network]) {
yield put(removeCustomNetwork({ id: 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)];