Skip to content
Subhajit Sahu edited this page Jun 19, 2020 · 1 revision

Merge values from two sorted arrays.

Similar: merge, [mergeAll], [rangedMerge].


function merge(x, y, fc, fm)
// x:  an array
// y:  another array
// fc: compare function (a, b)
// fm: map function (v, i, x)

const xsortedArray = require('extra-sorted-array');

var x = [10, 20, 20, 40, 40, 80];
var y = [20, 50, 70];
xsortedArray.merge(x, y);
// → [ 10, 20, 20, 20, 40, 40, 50, 70, 80 ]


References

Clone this wiki locally