sorting/mergesort/merge

Devides and sort merges two subarrays of given array
Source:
Parameters:
Name Type Description
array Array The array which subarrays should be sorted.
start Number The start of the first subarray. This subarray is with end middle - 1.
middle Number The start of the second array.
end Number end - 1 is the end of the second array.
Returns:
Type:
Array
The array with sorted subarray.
Example
var array = [1, 2, 3, 1, 4, 5, 6];
var merge =
   require('path-to-algorithms/src/sorting/mergesort').merge;
merge(array, function (a, b) {  // [1, 1, 2, 3, 4, 5, 6]
 return a - b;
}, 0, 4, 7);