MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / clipLine

Function clipLine

scripts/hsr/widget-view.mjs:40–45  ·  view source on GitHub ↗
(value, maxLength = 88)

Source from the content-addressed store, hash-verified

38}
39
40function clipLine(value, maxLength = 88) {
41 const text = typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
42 if (text.length <= maxLength) return text;
43 if (maxLength <= 1) return text.slice(0, maxLength);
44 return `${text.slice(0, maxLength - 1)}…`;
45}
46
47function asNonNegativeInt(value, fallback = 0) {
48 if (typeof value !== "number" || !Number.isFinite(value)) return fallback;

Callers 3

renderHeaderFunction · 0.85
renderEditorPanelFunction · 0.85
renderFeedbackModalFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected