DefinitelyTyped/types/username/index.d.ts
Akos Krivachy ae52dc806c Update @types/username typings from 1.0.1 to 3.0.0 (#23112)
The API has been promisifyed, instead of using a callback based one
2018-01-23 10:12:15 -08:00

28 lines
1.0 KiB
TypeScript

// Type definitions for username v3.0.0
// Project: https://www.npmjs.com/package/username
// Definitions by: Klaus Reimer <https://github.com/kayahr>
// Akos Krivachy <https://github.com/krivachy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Tries to get the username from the LOGNAME, USER, LNAME or USERNAME environment variables.
* Falls back to `id -un` on OS X / Linux and `whoami` on Windows in the rare case none of the environment
* variables are set. The result is cached.
*
* @return Promise<string> A promise containing the username or empty string if not found.
*/
declare function username(): Promise<string>;
declare namespace username {
/**
* Tries to get the username from the LOGNAME, USER, LNAME or USERNAME environment variables. Falls back
* to returning an empty string in the reare case none of the environment variables are set.
*
* @return The username or empty string if not found.
*/
function sync(): string;
}
export = username;