Home

Awesome

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();
  }
};