function merge()

in core/src/main/resources/org/apache/karaf/webconsole/core/behavior/dracula/dracula_algorithms.js [427:438]


    function merge(a, b) {
        /* result set */
        var c = [];
        /* as long as there are elements in the arrays to be merged */
        while(a.length > 0 || b.length > 0){
            /* are there elements to be merged, if yes, compare them and merge */
            var n = a.length > 0 && b.length > 0 ? a[0] < b[0] ? a.shift() : b.shift() : b.length > 0 ? b.shift() : a.length > 0 ? a.shift() : null;
            /* always push the smaller one onto the result set */
            n != null && c.push(n);
        }
        return c;
    }