Files
openclaw/src/plugin-sdk/text-utility-runtime.ts
2026-07-12 22:33:53 -07:00

36 lines
826 B
TypeScript

// Focused low-level text/runtime helpers used by bundled plugins.
/** Escapes text for safe insertion into HTML text and quoted attribute values. */
export function escapeHtml(value: string): string {
return value
.replaceAll("&", "&")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#39;");
}
export {
CONFIG_DIR,
clamp,
clampInt,
clampNumber,
displayPath,
displayString,
ensureDir,
escapeRegExp,
normalizeE164,
pathExists,
resolveConfigDir,
resolveHomeDir,
resolveUserPath,
safeParseJson,
shortenHomeInString,
shortenHomePath,
sleep,
sliceUtf16Safe,
truncateUtf16Safe,
} from "../utils.js";
export { fetchWithTimeout } from "../utils/fetch-timeout.js";
export { withTimeout } from "../utils/with-timeout.js";