From 7070d460fcd5c6570cb9579c8c50b89c75c0fce3 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 13 Nov 2018 13:04:13 -0800 Subject: [PATCH] Optimize lambdas --- src/resources/editor.html | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/resources/editor.html b/src/resources/editor.html index a5a62da..9e3e7c8 100644 --- a/src/resources/editor.html +++ b/src/resources/editor.html @@ -94,23 +94,14 @@ content += "

The following articles will be cited:

\n"; for (var i = 0; i < citationList.length; i++) { citation = citationList[i][0].toString() + ". " + citationList[i][1]; - if (writtenArticles.some( - function (e) { - return (e.title === citationList[i][1]) && (e.author === player); - })) { - content += "

" + citation + " [Written by you!]

"; - } else if (writtenArticles.some( - function (e) { - return (e.title === citationList[i][1]); - })) { - content += "

" + citation + " [Written]"; - } else if (phantomArticles.some( - function (e) { - return (e.title === citationList[i][1]); - })) { - content += "

" + citation + " [Phantom]"; + if (writtenArticles.some(e => (e.title === citationList[i][1]) && (e.author === player))) { + content += "

" + citation + " [Written by you!]

"; + } else if (writtenArticles.some(e => (e.title === citationList[i][1]))) { + content += "

" + citation + " [Written]"; + } else if (phantomArticles.some(e => (e.title === citationList[i][1]))) { + content += "

" + citation + " [Phantom]"; } else { - content += "

" + citation + " [New]"; + content += "

" + citation + " [New]"; } content += "

\n"; }