MCPcopy
hub / github.com/lodash/lodash / reorder

Function reorder

lodash.js:6684–6694  ·  view source on GitHub ↗

* Reorder `array` according to the specified indexes where the element at * the first index is assigned as the first element, the element at * the second index is assigned as the second element, and so on. * * @private * @param {Array} array The array to reorder. * @par

(array, indexes)

Source from the content-addressed store, hash-verified

6682 * @returns {Array} Returns `array`.
6683 */
6684 function reorder(array, indexes) {
6685 var arrLength = array.length,
6686 length = nativeMin(indexes.length, arrLength),
6687 oldArray = copyArray(array);
6688
6689 while (length--) {
6690 var index = indexes[length];
6691 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
6692 }
6693 return array;
6694 }
6695
6696 /**
6697 * Gets the value at `key`, unless `key` is "__proto__" or "constructor".

Callers 1

wrapperFunction · 0.85

Calls 2

copyArrayFunction · 0.85
isIndexFunction · 0.85

Tested by

no test coverage detected