index.d.ts (1032B)
1 /// <reference types="node" /> 2 3 declare namespace pathKey { 4 interface Options { 5 /** 6 Use a custom environment variables object. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env). 7 */ 8 readonly env?: {[key: string]: string | undefined}; 9 10 /** 11 Get the PATH key for a specific platform. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform). 12 */ 13 readonly platform?: NodeJS.Platform; 14 } 15 } 16 17 declare const pathKey: { 18 /** 19 Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform. 20 21 @example 22 ``` 23 import pathKey = require('path-key'); 24 25 const key = pathKey(); 26 //=> 'PATH' 27 28 const PATH = process.env[key]; 29 //=> '/usr/local/bin:/usr/bin:/bin' 30 ``` 31 */ 32 (options?: pathKey.Options): string; 33 34 // TODO: Remove this for the next major release, refactor the whole definition to: 35 // declare function pathKey(options?: pathKey.Options): string; 36 // export = pathKey; 37 default: typeof pathKey; 38 }; 39 40 export = pathKey;