Skip to content

Commit

Permalink
Update packages/spacecat-shared-rum-api-client/src/functions/404-inte…
Browse files Browse the repository at this point in the history
…rnal-links.js


Replaced reduce with map function, which is more appropriate here

Co-authored-by: Ekrem Doğan <ekremney@users.noreply.github.com>
  • Loading branch information
nitinja and ekremney authored Dec 13, 2024
1 parent 85ed1f0 commit 35f430a
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,15 @@ function handler(bundles) {
// counts pageviews per each group
dataChunks.addSeries('views', series.pageViews);

const brokenInternalLinksViews = dataChunks.facets.uniqueUrlCombinations
.reduce((acc, facet) => {
const urlCombination = facet.value;

acc[urlCombination] = acc[urlCombination] || {};

acc[urlCombination].views = facet.metrics.views.sum;
return dataChunks.facets.uniqueUrlCombinations.map((facet) => {
const [urlTo, urlFrom] = facet.value.split(DELIMITER);

Check failure on line 49 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 4 spaces but found 6
acc[urlCombination].url_to = urlTo;
acc[urlCombination].url_from = urlFrom;

return acc;
}, {});

return Object.values(brokenInternalLinksViews);

Check failure on line 50 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Trailing spaces not allowed
return {

Check failure on line 51 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 4 spaces but found 6
views: facet.metrics.views.sum,

Check failure on line 52 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 6 spaces but found 9
url_to: urlTo,

Check failure on line 53 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 6 spaces but found 9
url_from: urlFrom,

Check failure on line 54 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 6 spaces but found 9
}

Check failure on line 55 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 4 spaces but found 6

Check failure on line 55 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Missing semicolon
});

Check failure on line 56 in packages/spacecat-shared-rum-api-client/src/functions/404-internal-links.js

View workflow job for this annotation

GitHub Actions / Test

Expected indentation of 2 spaces but found 4
}

export default {
Expand Down

0 comments on commit 35f430a

Please sign in to comment.