export default function moveItemInObject(originalObj, from, to, prefix) {
  const originalArray = Object.values(originalObj);
  const movedItem = originalArray.find((_item, index) => index === from);
  const remainingItems = originalArray.filter((_item, index) => index !== from);
  const reorderedItems = [
    ...remainingItems.slice(0, to),
    movedItem,
    ...remainingItems.slice(to),
  ];
  let output = {};
  for (let i = 0; i < reorderedItems.length; i++) {
    output[`${prefix ? prefix : ""}${i}`] = reorderedItems[i];
  }
  return output;
}
