lib/detect.js
function (left, right) {
    var result = [];
    var leftIndex = 0;
    var rightIndex = 0;

    while (leftIndex < left.length && rightIndex < right.length) {
        if (dependencyComparator(left[leftIndex], right[rightIndex]) < 1) {
            result.push(left[leftIndex++]);
        } else {
            result.push(right[rightIndex++]);
        }
    }

    return result.
    concat(left.slice(leftIndex)).
    concat(right.slice(rightIndex));
}
function (left, right) {
    var result = [];
    var leftIndex = 0;
    var rightIndex = 0;

    while (leftIndex < left.length && rightIndex < right.length) {
        if (dependencyComparator(left[leftIndex], right[rightIndex]) < 1) {
            result.push(left[leftIndex++]);
        } else {
            result.push(right[rightIndex++]);
        }
    }

    return result.
    concat(left.slice(leftIndex)).
    concat(right.slice(rightIndex));
}
function ( left , right ) { var result = [ ] ; var leftIndex = 0 ; var rightIndex = 0 ; while ( leftIndex < left . length && rightIndex < right . length ) { if ( dependencyComparator ( left [ leftIndex ] , right [ rightIndex ] ) < 1 ) { result . push ( left [ leftIndex ++ ] ) ; } else { result . push ( right [ rightIndex ++ ] ) ; } } return result . concat ( left . slice ( leftIndex ) ) . concat ( right . slice ( rightIndex ) ) ; }
Take two arrays, sort based on their dependency relationship, then merge them
together.

@param  {array} left
@param  {array} right
@return {array} the sorted, merged array
Take two arrays sort based on their dependency relationship then merge them together .