UNPKG

@blueking/xss-filter

Version:

蓝鲸 XSS 过滤工具

19 lines (18 loc) 734 B
import type { XssOptions, FilterFunction } from '../types/index.d.ts'; /** * 过滤 HTML 字符串,允许保留安全的 HTML 标签和属性 */ export declare function filterXss(content: string, options?: XssOptions): string; /** * 去除所有 HTML 标签,只保留字符串中的纯文本 */ declare function filterPlainText(content: string): string; /** * 递归过滤对象或数组中的所有字符串值 * @param data 要过滤的对象或数组 * @param filterFn 过滤函数,默认为 filterPlainText * @param options XSS 过滤配置选项 */ declare function deepFilterXss<T>(data: T, filterFn?: FilterFunction, options?: XssOptions): T; export default filterXss; export { deepFilterXss, filterPlainText };