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:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user