Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 976 Bytes

README.md

File metadata and controls

34 lines (27 loc) · 976 Bytes

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