@karmaniverous/get-dotenv 4.4.5 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,14 +84,17 @@ Since keys will be evaluated progressively, each successive key function will ha
84
84
 
85
85
  Even though the rest of your project is in TypeScript, the dynamic processing module SHOULD be in JavasScript.
86
86
 
87
- Think about it: the module is loaded via a dynamic import, with the file name determined at run time. You will have to jump through some hoops to get your bundler to compile this file, and you'll have to be careful to set `dynamicPath` to reference the compiled file. That's a lot of work for some very simple log.
87
+ Think about it: the module is loaded via a dynamic import, with the file name determined at run time. If you write this module in TS, you'll have to jump through some hoops to get your bundler to compile this file, and you'll have to be careful to set `dynamicPath` to reference the compiled file. That's a lot of work to do for some very simple logic.
88
88
 
89
89
  BUT... if you must, then your dynamic module's default export should be of the `GetDotenvDynamic` type, which is defined [here](./src/GetDotenvOptions.ts) and looks like this:
90
90
 
91
91
  ```ts
92
92
  export type ProcessEnv = Record<string, string | undefined>;
93
93
 
94
- export type GetDotenvDynamicFunction = (vars: ProcessEnv) => string | undefined;
94
+ export type GetDotenvDynamicFunction = (
95
+ vars: ProcessEnv,
96
+ env: string | undefined,
97
+ ) => string | undefined;
95
98
 
96
99
  export type GetDotenvDynamic = Record<
97
100
  string,
@@ -99,6 +102,8 @@ export type GetDotenvDynamic = Record<
99
102
  >;
100
103
  ```
101
104
 
105
+ The second argumnt `env` of the `GetDotenvDynamicFunction` type is the environment token (if any) specified in the controlling `getDotenv` call.
106
+
102
107
  ## Command Line Interface
103
108
 
104
109
  You can also use `getdotenv` from the command line: