CODEBASE: Remove duplicate getStockFromSymbol function (#2725)

This commit is contained in:
catloversg
2026-05-05 04:31:20 +07:00
committed by GitHub
parent d324a93bac
commit ec307241e0
+9 -18
View File
@@ -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<StockAPI> {
/** 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<StockAPI> {
}
};
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<StockAPI> = {
getConstants: () => () => structuredClone(StockMarketConstants),
hasWseAccount: () => () => Player.hasWseAccount,
@@ -353,12 +353,3 @@ export function NetscriptStockMarket(): InternalAPI<StockAPI> {
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;
};