* Switch the key value pairing of an index array to be value key (i.e. the old value is now the * key). For example consider [ 2, 0, 1 ] this would be returned as [ 1, 2, 0 ]. * * @param array arr Array to switch around
(arr)
| 17239 | * @param array arr Array to switch around |
| 17240 | */ |
| 17241 | function invertKeyValues(arr) { |
| 17242 | var result = [] |
| 17243 | for (var i = 0; i < arr.length; i++) { |
| 17244 | result[arr[i]] = i |
| 17245 | } |
| 17246 | return result |
| 17247 | } |
| 17248 | /** |
| 17249 | * Move one or more columns from one index to another. |
| 17250 | * |