gioahnn/frontend-project-lvl1

View on GitHub
src/games/even.js

Summary

Maintainability
A
0 mins
Test Coverage
import flow from '../index';
import getRandomNumber from '../utils';

const isEven = (number) => (number % 2 === 0);

const getDataGame = () => {
  const question = getRandomNumber();
  const answer = (isEven(question) ? 'yes' : 'no');
  return [question, answer];
};

const description = 'Answer \'yes\' if the number is even, otherwise answer \'no\'.';

// game
export default () => flow(getDataGame, description);