@theredhead — Frontend Library - v1.0.0
    Preparing search index...
    • Returns a new array with the item at fromIndex relocated to toIndex. The original array is not modified.

      Type Parameters

      • T

        The item type.

      Parameters

      • array: readonly T[]

        The source array (not mutated).

      • fromIndex: number

        Current zero-based index of the item to move.

      • toIndex: number

        Desired zero-based index for the item.

      Returns T[]

      A new array with the item relocated.

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