Sha256: 495710ae274abce5b6e71a9879c735ef340210b3795a91059f51c55a0f9d4b27

Contents?: true

Size: 900 Bytes

Versions: 300

Compression:

Stored size: 900 Bytes

Contents

var copyArray = require('./_copyArray'),
    isIndex = require('./_isIndex');

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;

/**
 * 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.
 * @param {Array} indexes The arranged array indexes.
 * @returns {Array} Returns `array`.
 */
function reorder(array, indexes) {
  var arrLength = array.length,
      length = nativeMin(indexes.length, arrLength),
      oldArray = copyArray(array);

  while (length--) {
    var index = indexes[length];
    array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  }
  return array;
}

module.exports = reorder;

Version data entries

300 entries across 276 versions & 32 rubygems

Version Path
disco_app-0.18.2 test/dummy/node_modules/lodash/_reorder.js
sumomo-0.8.15 data/sumomo/api_modules/node_modules/lodash/_reorder.js
trusty-cms-5.0.7 node_modules/lodash/_reorder.js
appmap-0.72.2 ./node_modules/lodash/_reorder.js
trusty-cms-5.0.6 node_modules/lodash/_reorder.js
appmap-0.72.1 ./node_modules/lodash/_reorder.js
appmap-0.72.0 ./node_modules/lodash/_reorder.js
trusty-cms-5.0.5 node_modules/lodash/_reorder.js
trusty-cms-5.0.4 node_modules/lodash/_reorder.js
appmap-0.71.0 ./node_modules/lodash/_reorder.js
disco_app-0.16.1 test/dummy/node_modules/lodash/_reorder.js
appmap-0.70.2 ./node_modules/lodash/_reorder.js
sumomo-0.8.14 data/sumomo/api_modules/node_modules/lodash/_reorder.js
appmap-0.70.1 ./node_modules/lodash/_reorder.js
appmap-0.70.0 ./node_modules/lodash/_reorder.js
appmap-0.69.0 ./node_modules/lodash/_reorder.js
sumomo-0.8.13 data/sumomo/api_modules/node_modules/lodash/_reorder.js
appmap-0.68.2 ./node_modules/lodash/_reorder.js
appmap-0.68.1 ./node_modules/lodash/_reorder.js
disco_app-0.15.2 test/dummy/node_modules/lodash/_reorder.js