MCPcopy
hub / github.com/microfeed/microfeed / truncateString

Function truncateString

common-src/StringUtils.js:215–221  ·  view source on GitHub ↗
(str, num, ellipsis = true)

Source from the content-addressed store, hash-verified

213}
214
215export function truncateString(str, num, ellipsis = true) {
216 if (str.length > num) {
217 return `${str.slice(0, num)}${ellipsis ? '...' : ''}`;
218 } else {
219 return str;
220 }
221}
222
223export function htmlMetaDescription(str, isHtml = true) {
224 const text = isHtml ? htmlToPlainText(str) : str;

Callers 2

htmlMetaDescriptionFunction · 0.85
webItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected