utils/dist/escape.d.ts
saberzero1 81189f697c
chore: commit dist/ and remove prepare script
With build tools (tsup, typescript) moved to devDependencies, the prepare
script can no longer build when npm fetches this package from GitHub (npm
does not install devDependencies for git dependencies). Commit the pre-built
dist/ output so GitHub-based installs work without a build step.
2026-03-14 21:30:17 +01:00

23 lines
690 B
TypeScript

/**
* HTML escape utilities for safe string rendering.
*/
/**
* Escapes HTML special characters in a string to prevent XSS.
* @param unsafe - The string to escape
* @returns The escaped string safe for HTML rendering
*
* @example
* escapeHTML('<script>alert("xss")</script>') // '&lt;script&gt;alert(&quot;xss&quot;)&lt;/script&gt;'
*/
declare function escapeHTML(unsafe: string): string;
/**
* Unescapes HTML entities back to their original characters.
* @param html - The HTML-escaped string
* @returns The unescaped string
*
* @example
* unescapeHTML('&lt;div&gt;') // '<div>'
*/
declare function unescapeHTML(html: string): string;
export { escapeHTML, unescapeHTML };