ChemPal Documentation - v1.18.0
    Preparing search index...

    Function resolvePriceAlertSettings

    • The price alert settings, with defaults and limits applied.

      Parameters

      Returns Required<PriceAlertSettings>

      Hours between checks, and the smallest drop to report as a percentage

      resolvePriceAlertSettings({}); // { checkIntervalHours: 12, minDropPercent: 0 }
      
      export function resolvePriceAlertSettings(
      settings: UserSettings | undefined,
      ): Required<PriceAlertSettings> {
      const { checkIntervalHours, minDropPercent } = priceAlertsConfig;
      const defaults = defaultSettings.priceAlerts;
      return {
      checkIntervalHours: clampSetting(
      settings?.priceAlerts?.checkIntervalHours,
      defaults.checkIntervalHours,
      checkIntervalHours.min,
      checkIntervalHours.max,
      ),
      minDropPercent: clampSetting(
      settings?.priceAlerts?.minDropPercent,
      defaults.minDropPercent,
      minDropPercent.min,
      minDropPercent.max,
      ),
      };
      }