UNPKG

@coorpacademy/progression-engine

Version:

20 lines (16 loc) 600 B
// @flow import {concat, includes} from 'lodash/fp'; import type {Action, AskClueAction, Config} from '../types'; export default function requestedClues(config: Config): (Array<string>, Action) => Array<string> { return (array: Array<string> = [], action: Action): Array<string> => { switch (action.type) { case 'clue': { const requestedClueAction = (action: AskClueAction); const slideRef = requestedClueAction.payload.content.ref; return includes(slideRef, array) ? array : concat(array, [slideRef]); } default: return array; } }; }