From 0377c99a549bed141d1371577a8d0b10dd09f40d Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 17 Mar 2024 01:23:40 +0100 Subject: [javascript] refactoring --- nodejs/lib/systems.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nodejs/lib/systems.js') diff --git a/nodejs/lib/systems.js b/nodejs/lib/systems.js index e03da6c..fefa5cd 100644 --- a/nodejs/lib/systems.js +++ b/nodejs/lib/systems.js @@ -1,9 +1,11 @@ import * as api from './api.js'; import * as db from '../database/systems.js'; +import * as utils from './utils.js'; + // Retrieves a shipyard's information for ctx.symbol export async function shipyard(ctx) { - const systemSymbol = ctx.symbol.match(/([^-]+-[^-]+)/)[1]; // TODO generalise this extraction + const systemSymbol = utils.systemFromWaypoint(ctx.symbol); console.log(systemSymbol); return await api.send({endpoint: `/systems/${systemSymbol}/waypoints/${ctx.symbol}/shipyard`}); } -- cgit v1.2.3