Open yegor-babiy opened 5 years ago
@liorheber please take a look and what do you think?
Sorry for the delay here. I'll be going over the PR tomorrow.
@talyak I've been having a hard time getting to this PR. Any chance you'd be willing to take a look?
@liorheber, @yegor-babiy - I will review it today.
@yegor-babiy - why not to change the following function like this:
export const getMinMaxIndexes = ( currentIndex, firstItemShiftSelected, maxSelectedItems ) => { const range = Math.abs(firstItemShiftSelected - currentIndex) + 1; if (range > maxSelectedItems) { return firstItemShiftSelected > currentIndex ? { minIndex: firstItemShiftSelected - maxSelectedItems + 1, maxIndex: firstItemShiftSelected } : { minIndex: firstItemShiftSelected, maxIndex: firstItemShiftSelected + maxSelectedItems - 1 }; } return firstItemShiftSelected > currentIndex ? { minIndex: currentIndex, maxIndex: firstItemShiftSelected } : { minIndex: firstItemShiftSelected, maxIndex: currentIndex }; };
@talyak first of all codeclimate will say that it's too complicated function with more than 5 operations and about logic in this case you don't count selected items that was selected outside range before
@talyak can be merged?
@liorheber @talyak guess it can be merged, I made all your recommendation
Fixes #149
Proposed Changes
-
-