• getEnv - Determine the debug status based on environment variables or URL query parameters.

    Parameters

    • Optionaloptions: {
          defaultValue: boolean;
          nodeEnvVar: string;
          urlQueryParam: string;
          urlQueryValue: string;
      } = {}

      Configuration options for determining debug status.

      • defaultValue: boolean

        The default boolean value to return if no debug conditions are met.

      • nodeEnvVar: string

        The Node.js environment variable to check.

      • urlQueryParam: string

        The URL query parameter to check in a browser environment.

      • urlQueryValue: string

        The expected value of the URL query parameter to enable debugging.

    Returns boolean

    • True if debug conditions are met, otherwise returns the provided defaultValue.
    // Usage in Node.js environment
    process.env.DEBUG = 'true';
    console.log(getEnv()); // Outputs: true
    // Usage in Browser environment with URL: http://example.com?dev=debug=true
    console.log(getEnv()); // Outputs: true