From 8919f63c98d385b2e2ea11a1a96c10243e9378a7 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 9 Feb 2021 16:54:25 -0500 Subject: [PATCH] lint: Replace use of underscore.js with plain ECMAScript --- src/node/hooks/express/static.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/node/hooks/express/static.js b/src/node/hooks/express/static.js index 950fe3f78..58528a6c7 100644 --- a/src/node/hooks/express/static.js +++ b/src/node/hooks/express/static.js @@ -4,7 +4,6 @@ const minify = require('../../utils/Minify'); const plugins = require('../../../static/js/pluginfw/plugin_defs'); const CachingMiddleware = require('../../utils/caching_middleware'); const Yajsml = require('etherpad-yajsml'); -const _ = require('underscore'); exports.expressCreateServer = (hookName, args, cb) => { // Cache both minified and static. @@ -38,19 +37,12 @@ exports.expressCreateServer = (hookName, args, cb) => { // not very static, but served here so that client can do // require("pluginfw/static/js/plugin-definitions.js"); args.app.get('/pluginfw/plugin-definitions.json', (req, res, next) => { - const clientParts = _(plugins.parts) - .filter((part) => _(part).has('client_hooks')); - + const clientParts = plugins.parts.filter((part) => part.client_hooks != null); const clientPlugins = {}; - - _(clientParts).chain() - .map((part) => part.plugin) - .uniq() - .each((name) => { - clientPlugins[name] = _(plugins.plugins[name]).clone(); - delete clientPlugins[name].package; - }); - + for (const name of new Set(clientParts.map((part) => part.plugin))) { + clientPlugins[name] = {...plugins.plugins[name]}; + delete clientPlugins[name].package; + } res.header('Content-Type', 'application/json; charset=utf-8'); res.write(JSON.stringify({plugins: clientPlugins, parts: clientParts})); res.end();