From ec307241e031dd653681dbf1cbc46d20a2c4a007 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Tue, 5 May 2026 04:31:20 +0700 Subject: [PATCH] CODEBASE: Remove duplicate getStockFromSymbol function (#2725) --- src/NetscriptFunctions/StockMarket.ts | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index 3851ccca2..ace7a8889 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -26,6 +26,15 @@ import { getEnumHelper } from "../utils/EnumHelper"; import { CONSTANTS } from "../Constants"; import { getDarknetVolatilityMult } from "../DarkNet/effects/effects"; +export const getStockFromSymbol = function (ctx: NetscriptContext, symbol: string): Stock { + const stock = SymbolToStockMap[symbol]; + if (stock == null) { + throw helpers.errorMessage(ctx, `Invalid stock symbol: '${symbol}'`); + } + + return stock; +}; + export function NetscriptStockMarket(): InternalAPI { /** Checks if the player has TIX API access. Throws an error if the player does not */ const checkTixApiAccess = function (ctx: NetscriptContext): void { @@ -34,15 +43,6 @@ export function NetscriptStockMarket(): InternalAPI { } }; - const getStockFromSymbol = function (ctx: NetscriptContext, symbol: string): Stock { - const stock = SymbolToStockMap[symbol]; - if (stock == null) { - throw helpers.errorMessage(ctx, `Invalid stock symbol: '${symbol}'`); - } - - return stock; - }; - const stockFunctions: InternalAPI = { getConstants: () => () => structuredClone(StockMarketConstants), hasWseAccount: () => () => Player.hasWseAccount, @@ -353,12 +353,3 @@ export function NetscriptStockMarket(): InternalAPI { return stockFunctions; } - -export const getStockFromSymbol = function (ctx: NetscriptContext, symbol: string): Stock { - const stock = SymbolToStockMap[symbol]; - if (stock == null) { - throw helpers.errorMessage(ctx, `Invalid stock symbol: '${symbol}'`); - } - - return stock; -};