react-query-external-sync
Version:
A tool for syncing React Query state to an external Dev Tools
38 lines (37 loc) • 1.24 kB
TypeScript
export interface UseDynamicEnvOptions {
/**
* Optional filter function to determine which env vars to include
* Note: Only EXPO_PUBLIC_ prefixed variables are available in process.env
*/
envFilter?: (key: string, value: string | undefined) => boolean;
}
export interface EnvResult {
key: string;
data: unknown;
}
/**
* Hook that returns all available environment variables with parsed values
* Includes all available environment variables by default (only EXPO_PUBLIC_ prefixed vars are loaded by Expo)
*
* @example
* // Get all available environment variables (only EXPO_PUBLIC_ prefixed)
* const envVars = useDynamicEnv();
* // Returns: [
* // { key: 'EXPO_PUBLIC_API_URL', data: 'https://api.example.com' },
* // { key: 'EXPO_PUBLIC_APP_NAME', data: 'MyApp' },
* // ...
* // ]
*
* @example
* // Filter to specific variables
* const envVars = useDynamicEnv({
* envFilter: (key) => key.includes('API') || key.includes('URL')
* });
*
* @example
* // Filter by value content
* const envVars = useDynamicEnv({
* envFilter: (key, value) => value !== undefined && value.length > 0
* });
*/
export declare function useDynamicEnv({ envFilter, }?: UseDynamicEnvOptions): EnvResult[];