vipulrawat / jc-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Steps


  1. yarn or npm install
  2. yarn start or npm run start

Tests


yarn test

Design Desicion


I started with creating the generator function first as it contains the core business logic of the task. However, Initially I wrote less tests for these functions as they are pure mathematical functions the are infinite generators (expect partialSum).

Backend

In Backend, the pure generators are kept in -sequencers and it is imported in index.js. The main function in index.js is function generator(gen, ...args), gen is the string which is selected by switch statement and initialized to the proper sequencer. Default is taken as prime.

Frontend

Frontend, includes the dropdown menu which lets to select the sequencer, to use is one has to click Activate and then the Next will generate the values. If the sequencer requires any argument then it enables the input tags where one can add arguments to the sequencer. After, changing the arguments one has to click Set and Activate to use Next. The error will be handled if any sequence throw error.

Current user flow is:

If sequencer is among prime, factorial, fibonacci. Select => Activate => Next

For range and partialSum. Select => Activate => (Change arguments) => Set => Activate => Next

Limitations


  • factorial() cannot generate large factorials as memory constraint of number.
  • Didn't implemented the accumulator().
  • User flow is difficult.

About


Languages

Language:JavaScript 87.9%Language:HTML 8.3%Language:CSS 3.7%