2.0.2 • Published 6 months ago
@types/html-escape v2.0.2
Installation
npm install --save @types/html-escape
Summary
This package contains type definitions for html-escape (https://github.com/parshap/html-escape).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-escape/v1.
index.d.ts
// Type definitions for html-escape 1.0
// Project: https://github.com/parshap/html-escape
// Definitions by: ExE Boss <https://github.com/ExE-Boss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Escape a string to be safe for use in HTML by escaping
* [reserved characters](http://www.w3.org/International/questions/qa-escapes#use)
* (`&<>'"`).
*
* @param str The plain text to escape HTML markup in.
* @return The text with HTML markup safely escaped.
*
* @example
* ```js
* > var escape = require("html-escape");
* > var xssAttempt = "Hello <script>while(1);</script> world!";
* > // Output safe html
* > console.log("<p>" + escape(xssAttempt) + "</p>");
* "<p>Hello <script>while(1);</script> world!</p>"
* ```
*/
declare function htmlEscape(str: string): string;
export = htmlEscape;
Additional Details
- Last updated: Fri, 08 Oct 2021 13:31:21 GMT
- Dependencies: none
- Global values: none
Credits
These definitions were written by ExE Boss.