FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use spread filter and forEach instead of doing it old-school longhand :) · devhttps/frontend@9e02ee3 · GitHub

Commit 9e02ee3

Browse files
committed
Use spread filter and forEach instead of doing it old-school longhand :)
1 parent 59fdcad commit 9e02ee3

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

  • static/src/javascripts/projects/common/modules/article

‎static/src/javascripts/projects/common/modules/article/rich-links.js‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,9 @@ const hideIfPaidForAndAdFree = (el: Element): Promise<void> => {
2525
return Promise.resolve();
2626
}
2727
return fastdom.write(() => {
28-
for (let child = 0; child < el.children.length; child += 1) {
29-
if (
30-
el.children[child].classList
31-
.toString()
32-
.includes('rich-link--paidfor')
33-
) {
34-
el.classList.add('u-h');
35-
break;
36-
}
37-
}
28+
[...el.children]
29+
.filter(child => child.classList.toString().includes('rich-link--paidfor'))
30+
.forEach(child => child.classList.add('u-h'));
3831
});
3932
};
4033

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL