refactor: use escape-html
dat SLOC
This commit is contained in:
parent
182f9d6fa4
commit
c382305d4f
2 changed files with 2 additions and 16 deletions
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
var debug = require('debug')('koa:response');
|
||||
var escape = require('escape-html');
|
||||
var status = require('statuses');
|
||||
var http = require('http');
|
||||
var path = require('path');
|
||||
|
@ -448,19 +449,3 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape special characters in the given string of html.
|
||||
*
|
||||
* @param {String} html
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function escape(html) {
|
||||
return String(html)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"escape-html": "~1.0.1",
|
||||
"statuses": "~1.0.1",
|
||||
"accepts": "~1.0.0",
|
||||
"type-is": "~1.0.0",
|
||||
|
|
Loading…
Reference in a new issue