import memoizeOne from "memoize-one";
import { values } from "../native-with-fallback";

export const toDroppableMap = memoizeOne((droppables) =>
  droppables.reduce((previous, current) => {
    previous[current.descriptor.id] = current;
    return previous;
  }, {})
);
export const toDraggableMap = memoizeOne((draggables) =>
  draggables.reduce((previous, current) => {
    previous[current.descriptor.id] = current;
    return previous;
  }, {})
);
export const toDroppableList = memoizeOne((droppables) => values(droppables));
export const toDraggableList = memoizeOne((draggables) => values(draggables));
