- Index
- »
- axon
- »
- func:moveTo
def
func:moveTo
moveTo(list, item, toIndex)
Find the given item in a list, and move it to the given index. All the other items are shifted accordingly. Negative indexes may used to access an index from the end of the list. If the item is not found then this is a no op. Return new list.
Examples:
[10, 11, 12].moveTo(11, 0) >> [11, 10, 12] [10, 11, 12].moveTo(11, -1) >> [10, 12, 11]