main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | # path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/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 |
|
---|
8 | ## Install
|
---|
9 |
|
---|
10 | ```
|
---|
11 | $ npm install path-key
|
---|
12 | ```
|
---|
13 |
|
---|
14 |
|
---|
15 | ## Usage
|
---|
16 |
|
---|
17 | ```js
|
---|
18 | const pathKey = require('path-key');
|
---|
19 |
|
---|
20 | const key = pathKey();
|
---|
21 | //=> 'PATH'
|
---|
22 |
|
---|
23 | const PATH = process.env[key];
|
---|
24 | //=> '/usr/local/bin:/usr/bin:/bin'
|
---|
25 | ```
|
---|
26 |
|
---|
27 |
|
---|
28 | ## API
|
---|
29 |
|
---|
30 | ### pathKey(options?)
|
---|
31 |
|
---|
32 | #### options
|
---|
33 |
|
---|
34 | Type: `object`
|
---|
35 |
|
---|
36 | ##### env
|
---|
37 |
|
---|
38 | Type: `object`<br>
|
---|
39 | Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
|
---|
40 |
|
---|
41 | Use a custom environment variables object.
|
---|
42 |
|
---|
43 | #### platform
|
---|
44 |
|
---|
45 | Type: `string`<br>
|
---|
46 | Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
|
---|
47 |
|
---|
48 | Get the PATH key for a specific platform.
|
---|
49 |
|
---|
50 |
|
---|
51 | ---
|
---|
52 |
|
---|
53 | <div align="center">
|
---|
54 | <b>
|
---|
55 | <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>
|
---|
56 | </b>
|
---|
57 | <br>
|
---|
58 | <sub>
|
---|
59 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
---|
60 | </sub>
|
---|
61 | </div>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.