@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function move

    • Move item in an array, change the original array.

      移动数组中的项,此方法会改变原数组。

      Type Parameters

      • T

      Parameters

      • arr: T[]

        the array

      • from: number

        the index of the item to move. 要移动的项的索引

      • to: number

        the index to move to. 要移动到的索引

      Returns T[]

      the array with the item moved. 返回移动后的数组

      move([1, 2, 3], 0, 2) // => [3, 1, 2]