0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Reduced code change to one addition on a single line.

This commit is contained in:
G.Ambatte
2021-02-21 20:10:33 +13:00
parent 93cd933117
commit 2a355cf115

View File

@@ -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;
};