forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
username.d.ts
27 lines (24 loc) · 1.07 KB
/
username.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Type definitions for username v1.0.1
// Project: https://www.npmjs.com/package/username
// Definitions by: Klaus Reimer <https://github.com/kayahr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "username" {
/**
* 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.
*
* @param callback The callback function to call asynchronously with the result.
*/
function username(callback: (err: Error, result: string) => void): void;
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;
}