Nodejs Utililty Methods Array Reorder

List of utility methods to do Array Reorder

Description

The list of methods to do Array Reorder are organized into topic(s).

Method

reorder(a)
Array.prototype.reorder = function (a){
  var o = [], _ = this, i = 0;
  _.forEach(function(){
    o.push(_[a[i]] ? _[a[i]] : _[i]);
  i++;
  });
  return o;
  };
reorder(a)
var myArray = ['one', 'two', 'three','four', 'five'];
Array.prototype.reorder = function (a){
  var o = [], _ = this, i = 0;
  _.forEach(function(){
    o.push(_[a[i]] ? _[a[i]] : _[i]);
  i++;
  });
  return o;
};
...
reorder(mapping)
Array.prototype.reorder = function (mapping) {
  return mapping.map(index => this[index])