UNPKG

@4ex/indicators

Version:

Technical indicators for ohlc charts written in TypeScript

26 lines (25 loc) 951 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FactoryIndicators = void 0; const indicators_store_1 = require("./indicators.store"); /** * Factory class to get instance of indicators present in store. */ class FactoryIndicators { /** * Get class present in Store for specified indicators * @param {IndicatorsEnum | string} indicatorClass indicator class name * to retrieve * @return {Indicator} indicator Class * @throws {Error} Unrecognized indicator type */ static getClass(indicatorClass) { if (indicators_store_1.Store[indicatorClass] === undefined || indicators_store_1.Store[indicatorClass] === null) { throw new Error(`[FactoryIndicators] Indicator type of ${indicatorClass} is not in store!`); } return indicators_store_1.Store[indicatorClass]; } } exports.FactoryIndicators = FactoryIndicators;