UNPKG

730 BTypeScriptView Raw
1export interface Options {
2 /**
3 Use a custom environment variables object.
4
5 Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env).
6 */
7 readonly env?: Record<string, string | undefined>;
8
9 /**
10 Get the PATH key for a specific platform.
11
12 Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform).
13 */
14 readonly platform?: NodeJS.Platform;
15}
16
17/**
18Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform.
19
20@example
21```
22import pathKey from 'path-key';
23
24const key = pathKey();
25//=> 'PATH'
26
27const PATH = process.env[key];
28//=> '/usr/local/bin:/usr/bin:/bin'
29```
30*/
31export default function pathKey(options?: Options): string;