Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

61 wiersze
1.3 KiB

4 lat temu
  1. # path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/path-key)
  2. > Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
  3. It's usually `PATH`, but on Windows it can be any casing like `Path`...
  4. ## Install
  5. ```
  6. $ npm install path-key
  7. ```
  8. ## Usage
  9. ```js
  10. const pathKey = require('path-key');
  11. const key = pathKey();
  12. //=> 'PATH'
  13. const PATH = process.env[key];
  14. //=> '/usr/local/bin:/usr/bin:/bin'
  15. ```
  16. ## API
  17. ### pathKey(options?)
  18. #### options
  19. Type: `object`
  20. ##### env
  21. Type: `object`<br>
  22. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
  23. Use a custom environment variables object.
  24. #### platform
  25. Type: `string`<br>
  26. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
  27. Get the PATH key for a specific platform.
  28. ---
  29. <div align="center">
  30. <b>
  31. <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>
  32. </b>
  33. <br>
  34. <sub>
  35. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  36. </sub>
  37. </div>