From 2a355cf115e62f9894eac011bb6bd0aaacb156ad Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 21 Feb 2021 20:10:33 +1300 Subject: [PATCH] Reduced code change to one addition on a single line. --- server/homebrew.api.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 90bd4e2df..860257c52 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -15,10 +15,7 @@ const MAX_TITLE_LENGTH = 100; const getGoodBrewTitle = (text)=>{ const tokens = Markdown.marked.lexer(text); - let title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text; - if(title.length > MAX_TITLE_LENGTH) { - title = title.substr(0, MAX_TITLE_LENGTH); - } + const title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text.substr(0,MAX_TITLE_LENGTH); return title; };