@theredhead — Frontend Library - v1.0.0
    Preparing search index...
    • Returns new copies of source and target with the item at fromIndex removed from source and inserted into target at toIndex. The original arrays are not modified.

      Type Parameters

      • T

        The item type.

      Parameters

      • source: readonly T[]

        The array to remove from (not mutated).

      • fromIndex: number

        Zero-based index of the item to remove from source.

      • target: readonly T[]

        The array to insert into (not mutated).

      • toIndex: number

        Zero-based index at which to insert into target.

      Returns [source: T[], target: T[]]

      A tuple [newSource, newTarget] with the transfer applied.

      const [src, tgt] = moveItemToArrayPure(
      ['a', 'b', 'c'], 1,
      ['x', 'y'], 1,
      );
      // src → ['a', 'c']
      // tgt → ['x', 'b', 'y']