Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 1 | 'use strict'; |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 2 | |
Tim van der Lippe | 16aca39 | 2020-11-13 11:37:13 +0000 | [diff] [blame^] | 3 | const pathKey = (options = {}) => { |
| 4 | const environment = options.env || process.env; |
| 5 | const platform = options.platform || process.platform; |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 6 | |
| 7 | if (platform !== 'win32') { |
| 8 | return 'PATH'; |
| 9 | } |
| 10 | |
Tim van der Lippe | 16aca39 | 2020-11-13 11:37:13 +0000 | [diff] [blame^] | 11 | return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path'; |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 12 | }; |
Tim van der Lippe | 16aca39 | 2020-11-13 11:37:13 +0000 | [diff] [blame^] | 13 | |
| 14 | module.exports = pathKey; |
| 15 | // TODO: Remove this for the next major release |
| 16 | module.exports.default = pathKey; |