Issues returning unique values

we tried it with this reduce already:

function(keys, values, rereduce) {
return values.filter(function (e, i, arr) {
return arr.lastIndexOf(e) === i;
});
}

The problem here is that we find the error “reduction too large” in the error.log, and t keeps indexing forever.