initial commit, completed 40% of first milestone

This commit is contained in:
Amruth Pillai
2020-03-25 02:52:24 +05:30
parent dfeb67cda9
commit 25a6740c24
36 changed files with 55170 additions and 154 deletions

11
src/utils/index.js Normal file
View File

@ -0,0 +1,11 @@
/* eslint-disable import/prefer-default-export */
const move = (array, element, delta) => {
const index = array.indexOf(element);
const newIndex = index + delta;
if (newIndex < 0 || newIndex === array.length) return;
const indexes = [index, newIndex].sort((a, b) => a - b);
array.splice(indexes[0], 2, array[indexes[1]], array[indexes[0]]);
};
export { move };