blob: 0cf6415d60938fa78ba51b277fa2a57fa0bdc587 [file] [log] [blame]
Yang Guo4fd355c2019-09-19 10:59:03 +02001'use strict';
Yang Guo4fd355c2019-09-19 10:59:03 +02002
Tim van der Lippe16aca392020-11-13 11:37:13 +00003const pathKey = (options = {}) => {
4 const environment = options.env || process.env;
5 const platform = options.platform || process.platform;
Yang Guo4fd355c2019-09-19 10:59:03 +02006
7 if (platform !== 'win32') {
8 return 'PATH';
9 }
10
Tim van der Lippe16aca392020-11-13 11:37:13 +000011 return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
Yang Guo4fd355c2019-09-19 10:59:03 +020012};
Tim van der Lippe16aca392020-11-13 11:37:13 +000013
14module.exports = pathKey;
15// TODO: Remove this for the next major release
16module.exports.default = pathKey;