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

Obtain values present in any sorted array.

Similar: union, [intersection], [difference], [symmetricDifference].


function union(x, y, fc, fm)
// x:  a sorted array
// y:  another sorted 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.union(x, y);
// → [ 10, 20, 20, 40, 40, 50, 70, 80 ]


References