[scraper] checks for torrent contents when updating existing torrent

This commit is contained in:
TheBeastLT
2020-05-06 11:59:53 +02:00
parent 0ad7324a6a
commit 9ce3f72e5d
12 changed files with 125 additions and 35 deletions

View File

@@ -33,4 +33,11 @@ async function delay(duration) {
return new Promise((resolve) => setTimeout(resolve, duration));
}
module.exports = { sequence, first, delay };
/**
* Return most common value from given array.
*/
function mostCommonValue(array) {
return array.sort((a, b) => array.filter(v => v === a).length - array.filter(v => v === b).length).pop();
}
module.exports = { sequence, first, delay, mostCommonValue };