Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 44x 44x 44x | const SHORT_DESCRIPTION_MAX_LENGTH = 200;
const matchNextSentence = /([.?!])\s*(?=[A-Z])/g;
export const getShortDescriptionFromDescription = (
description: string,
): string => {
let shortDescription = "";
const sentences = description.replaceAll(matchNextSentence, "$1|").split("|");
for (const sentence of sentences) {
shortDescription = shortDescription.concat(`${sentence} `);
if (shortDescription.length >= SHORT_DESCRIPTION_MAX_LENGTH) {
break;
}
}
return shortDescription;
};
|