From f69a2339b8201a573e9fe6d5f984d542067287a2 Mon Sep 17 00:00:00 2001 From: Martin d'Allens Date: Tue, 21 Nov 2023 11:49:45 +0100 Subject: [PATCH] chore: remove duplicated field names to simplify code Signed-off-by: Martin d'Allens --- src/main.js | 8 ++++---- src/serve_rendered.js | 24 ++++++++++++------------ src/server.js | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main.js b/src/main.js index f3bb71b..d32f11a 100644 --- a/src/main.js +++ b/src/main.js @@ -68,8 +68,8 @@ const StartServer = (configPath, config) => { publicUrl += '/'; } return server({ - configPath: configPath, - config: config, + configPath, + config, bind: opts.bind, port: opts.port, cors: opts.cors, @@ -77,7 +77,7 @@ const StartServer = (configPath, config) => { silent: opts.silent, logFile: opts.log_file, logFormat: opts.log_format, - publicUrl: publicUrl, + publicUrl, }); }; @@ -215,7 +215,7 @@ const StartWithInputFile = async (inputFile) => { config['styles'][styleName] = { style: styleFileRel, tilejson: { - bounds: bounds, + bounds, }, }; } diff --git a/src/serve_rendered.js b/src/serve_rendered.js index adfe255..4ff0e8b 100644 --- a/src/serve_rendered.js +++ b/src/serve_rendered.js @@ -97,7 +97,7 @@ function createEmptyResponse(format, color, callback) { raw: { width: 1, height: 1, - channels: channels, + channels, }, }) .toFormat(format) @@ -405,10 +405,10 @@ const respondImage = ( const params = { zoom: mlglZ, center: [lon, lat], - bearing: bearing, - pitch: pitch, - width: width, - height: height, + bearing, + pitch, + width, + height, }; if (z === 0) { @@ -856,8 +856,8 @@ export const serve_rendered = { const createPool = (ratio, mode, min, max) => { const createRenderer = (ratio, createCallback) => { const renderer = new mlgl.Map({ - mode: mode, - ratio: ratio, + mode, + ratio, request: async (req, callback) => { const protocol = req.url.split(':')[0]; // console.log('Handling request:', req); @@ -1016,8 +1016,8 @@ export const serve_rendered = { createCallback(null, renderer); }; return new advancedPool.Pool({ - min: min, - max: max, + min, + max, create: createRenderer.bind(null, ratio), destroy: (renderer) => { renderer.release(); @@ -1114,9 +1114,9 @@ export const serve_rendered = { let inputFile; const DataInfo = dataResolver(dataId); - if (DataInfo.inputfile) { - inputFile = DataInfo.inputfile; - source_type = DataInfo.filetype; + if (DataInfo.inputFile) { + inputFile = DataInfo.inputFile; + source_type = DataInfo.fileType; } else { console.error(`ERROR: data "${inputFile}" not found!`); process.exit(1); diff --git a/src/server.js b/src/server.js index a4a3760..6b10644 100644 --- a/src/server.js +++ b/src/server.js @@ -253,7 +253,7 @@ function start(opts) { inputFile = path.resolve(options.paths[fileType], inputFile); } - return { inputfile: inputFile, filetype: fileType }; + return { inputFile, fileType }; }, ), ); @@ -344,7 +344,7 @@ function start(opts) { result.push({ version: styleJSON.version, name: styleJSON.name, - id: id, + id, url: `${getPublicUrl( opts.publicUrl, req, @@ -630,9 +630,9 @@ function start(opts) { enableShutdown(server); return { - app: app, - server: server, - startupPromise: startupPromise, + app, + server, + startupPromise, }; }