chore: optimize performance (replace he with entities) (#6497)

This commit is contained in:
oppilate
2020-12-22 18:38:10 +00:00
committed by GitHub
parent e735aef8a7
commit dfdb9630b7
5 changed files with 19 additions and 16 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
const got = require('@/utils/got');
const cache = require('./cache');
const he = require('he');
const entities = require('entities');
const queryString = require('query-string');
module.exports = async (ctx) => {
@@ -25,7 +25,7 @@ module.exports = async (ctx) => {
link: host,
item: data.map((item) => ({
title: item.subject,
description: he.escape(he.escape(item.content)).replace(/\n/g, '<br>'),
description: entities.escape(entities.escape(item.content)).replace(/\n/g, '<br>'),
pubDate: new Date(item.date).toUTCString(),
link: item.web_url,
})),