Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function*(action) {
const piece = action.payload.piece;
// if evolution is locked, wait for it to be unlocked
if (sagaState.evolutionLocked) {
yield take(UNLOCK_EVOLUTIONS);
yield delay(500);
}
const { bench, board }: TState = yield select(s => ({ bench: s.bench, board: s.board }));
const { stages } = definitionProvider.get(piece.definitionId);
const nextStageIndex = piece.stage + 1;
const nextStage = stages[nextStageIndex];
if (!nextStage) {
return;
}
const pieceIsMatching = (p: Piece) => p.definitionId === piece.definitionId && p.stage === piece.stage;
const getMatchingPieces = (pieces: Piece[]) => pieces.filter(p => p.id !== piece.id && pieceIsMatching(p));
yield takeLatest(BANNER_UPDATED, function*() {
yield delay(1000);
yield put(bannerUpdatedAction(null));
});
};