array.sort_mapped [method]
array.sort_mapped( array map[, bool reverse ] );
sorts the array by sorting the passed array and applying the index map to the first one, returns the array for chaining
- both arrays must have the same size, otherwise a warning is emitted
- all variables in the mapping array are interpreted as 'real' values
- if
reverse
is true, array is sorted in the reverse order
a = [ 5, 6, 7, 8 ]; b = [ 3, 1, 4, 2 ]; a.sort_mapped( b ); // a = [6,8,5,7]