@pathmaker-digital/pmd-utilities - v2.2.6
    Preparing search index...

    Function jsonSafeGet

    • Safely retrieves a deeply nested value from a JSON object using dot notation, with optional fallback.

      Type Parameters

      • T = any

      Parameters

      • json: JSON
      • path: string

        A dot-separated string path like "ui.settings.theme"

      • fallback: null | T = null

        A fallback value returned if the path is not found.

      Returns null | T

      The found value or the fallback.

      const port = configSafeGet<number>("server.port", 3000);
      const theme = configSafeGet<string>("ui.settings.theme", "light");
      const output = configSafeGet<string>("outputDir", "./dist");