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

Function orderingIndexes

external/.datatables.js:17350–17369  ·  view source on GitHub ↗

* Update the indexing for ordering arrays * * @param map Reverse index map * @param order Array to update

(map, order)

Source from the content-addressed store, hash-verified

17348 * @param order Array to update
17349 */
17350 function orderingIndexes(map, order) {
17351 // Can happen if the order was deleted from a saved state
17352 if (!order) {
17353 return
17354 }
17355 for (var i = 0; i < order.length; i++) {
17356 var el = order[i]
17357 if (typeof el === "number") {
17358 // Just a number
17359 order[i] = map[el]
17360 } else if ($.isPlainObject(el) && el.idx !== undefined) {
17361 // New index in an object style
17362 el.idx = map[el.idx]
17363 } else if (Array.isArray(el) && typeof el[0] === "number") {
17364 // The good old fixes length array
17365 el[0] = map[el[0]]
17366 }
17367 // No need to update if in object + .name style
17368 }
17369 }
17370 /**
17371 * Take an index array for the current positioned, reordered to what you want
17372 * them to be.

Callers 2

moveFunction · 0.85
.datatables.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected