1 | # path-key
|
2 |
|
3 | > Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
|
4 |
|
5 | It's usually `PATH` but on Windows it can be any casing like `Path`...
|
6 |
|
7 | ## Install
|
8 |
|
9 | ```
|
10 | $ npm install path-key
|
11 | ```
|
12 |
|
13 | ## Usage
|
14 |
|
15 | ```js
|
16 | import pathKey from 'path-key';
|
17 |
|
18 | const key = pathKey();
|
19 | //=> 'PATH'
|
20 |
|
21 | const PATH = process.env[key];
|
22 | //=> '/usr/local/bin:/usr/bin:/bin'
|
23 | ```
|
24 |
|
25 | ## API
|
26 |
|
27 | ### pathKey(options?)
|
28 |
|
29 | #### options
|
30 |
|
31 | Type: `object`
|
32 |
|
33 | ##### env
|
34 |
|
35 | Type: `object`\
|
36 | Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
|
37 |
|
38 | Use a custom environment variables object.
|
39 |
|
40 | #### platform
|
41 |
|
42 | Type: `string`\
|
43 | Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
|
44 |
|
45 | Get the PATH key for a specific platform.
|
46 |
|
47 | ---
|
48 |
|
49 | <div align="center">
|
50 | <b>
|
51 | <a href="https://tidelift.com/subscription/pkg/npm-path-key?utm_source=npm-path-key&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
52 | </b>
|
53 | <br>
|
54 | <sub>
|
55 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
56 | </sub>
|
57 | </div>
|