JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "move-item-in-new-array.ts"

Full Path: /home/markqprx/iniasli.pro/client/utils/array/move-item-in-new-array.ts
File size: 250 bytes
MIME-type: text/plain
Charset: utf-8

export function moveItemInNewArray<T>(
  array: T[],
  from: number,
  to: number
): T[] {
  const newArray = array.slice();
  newArray.splice(
    to < 0 ? newArray.length + to : to,
    0,
    newArray.splice(from, 1)[0]
  );

  return newArray;
}