diff --git a/fetchdata.js b/fetchdata.js index a35fffe8..2fcda07a 100644 --- a/fetchdata.js +++ b/fetchdata.js @@ -326,3 +326,19 @@ function fetchQuery(query, variables, callback) { callback(data); }); } + +function deduplicateIssues(issues) { + const seen = new Set(); + const uniqueIssues = []; + + issues.forEach(issue => { + if (!issue || !issue.url) return; + + if (!seen.has(issue.url)) { + seen.add(issue.url); + uniqueIssues.push(issue); + } + }); + + return uniqueIssues; +} diff --git a/tests/jest/sum.js b/tests/jest/sum.js index 781c0b5e..4e64d50a 100644 --- a/tests/jest/sum.js +++ b/tests/jest/sum.js @@ -1,3 +1,9 @@ +function daysBetweenDates(date1, date2) { + const oneDay = 24 * 60 * 60 * 1000; + return Math.round((date2 - date1) / oneDay); +} + +module.exports = daysBetweenDates; function sum(a, b) { return a + b;