mirror of
https://github.com/quartz-community/utils.git
synced 2026-07-22 02:50:27 +00:00
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.
23 lines
690 B
TypeScript
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>') // '<script>alert("xss")</script>'
|
|
*/
|
|
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('<div>') // '<div>'
|
|
*/
|
|
declare function unescapeHTML(html: string): string;
|
|
|
|
export { escapeHTML, unescapeHTML };
|