Closed VadimZP closed 6 years ago
If not (I have not found), maybe you can add something like this?
function commonVal(arr) { const sorted = arr.sort(); let obj = {}; let tempArray = []; sorted.forEach((val, i, arr) => { if (arr[i] != arr[i + 1]) { tempArray.push(arr[i]); obj[tempArray.length] = tempArray; tempArray = []; } else { tempArray.push(arr[i]); } }); const numsArr = Object.keys(obj).map(el => +el); const getCommon = obj[Math.max(...numsArr)][0]; return getCommon; }
Sorry, this is for Ramda, not Ramda-fantasy.
If not (I have not found), maybe you can add something like this?