think-purify

1.1.4 • Public • Published

think-purify

npm Build Status Coverage Status

Use the HTML5 Purify extension in ThinkJS

How to use

Install

npm install think-purify --save

Configure extends.js

const purify = require('think-purify')
 
module.exports = [
  purify
];

Use in controller, service, context or think

module.exports = class extends Base {
  indexAction() {
    const html = this.post('html');
    const result = this.purify(html); // Filtering dangerous html tags and attributes
    return this.display();
  }
};

Dependencies (2)

Dev Dependencies (9)

Package Sidebar

Install

npm i think-purify

Weekly Downloads

6

Version

1.1.4

License

MIT

Unpacked Size

51.3 kB

Total Files

9

Last publish

Collaborators

  • weihongyu12