1.0.1 • Published 3 years ago

xss_blade v1.0.1

Weekly downloads
12
License
-
Repository
-
Last release
3 years ago

xss防御前端过滤工具:基于npm上的xss库简单封装

Using npm:

$ npm i xss_blade --save

简单使用

    import { xssFilter, getDefaultOptions } from "xss_blade";

    html = xssFilter('<script>alert("xss");</script>');

    console.log('默认参数:', getDefaultOptions());

传递第二个参数options来自定义规则,具体规则见 xss 官方文档👍

    options = {
        whiteList:{
            a:['href'],
            img:['src']
        }
    };  // 自定义规则

    options = {
        whiteList:{}
    };  // 覆盖封装函数内的whiteList配置

    html = xssFilter('<script>alert("xssFilter");</script>', options);
1.0.1

3 years ago

1.0.0

3 years ago