MCPcopy Create free account
hub / github.com/breck7/scroll / arrayMove

Function arrayMove

external/.datatables.js:17148–17154  ·  view source on GitHub ↗

* Mutate an array, moving a set of elements into a new index position * * @param arr Array to modify * @param from Start move index * @param count Number of elements to move * @param to Index where the start element will move to

(arr, from, count, to)

Source from the content-addressed store, hash-verified

17146 * @param to Index where the start element will move to
17147 */
17148 function arrayMove(arr, from, count, to) {
17149 var movers = arr.splice(from, count)
17150 // Add delete and start to the array, so we can use it for the `apply`
17151 movers.unshift(0) // splice delete param
17152 movers.unshift(to < from ? to : to - count + 1) // splice start param
17153 arr.splice.apply(arr, movers)
17154 }
17155 /**
17156 * Run finishing activities after one or more columns have been reordered.
17157 *

Callers 4

headerUpdateFunction · 0.85
moveFunction · 0.85
setOrderFunction · 0.85
validateStructureMoveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected