@theredhead — Frontend Library - v1.0.0
    Preparing search index...
    • Moves an item within array from fromIndex to toIndex, shifting other elements to accommodate. The array is mutated in place.

      Type Parameters

      • T

        The item type.

      Parameters

      • array: T[]

        The array to mutate.

      • fromIndex: number

        Current zero-based index of the item to move.

      • toIndex: number

        Desired zero-based index for the item.

      Returns void

      const items = ['a', 'b', 'c', 'd'];
      moveItemInArray(items, 0, 2);
      // items → ['b', 'c', 'a', 'd']