Socket
Socket
Sign inDemoInstall

fullname

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fullname - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

12

index.d.ts

@@ -6,12 +6,8 @@ /**

```
import fullName = require('fullname');
import fullName from 'fullname';
(async () => {
console.log(await fullName());
//=> 'Sindre Sorhus'
})();
console.log(await fullName());
//=> 'Sindre Sorhus'
```
*/
declare function fullName(): Promise<string | undefined>;
export = fullName;
export default function fullName(): Promise<string | undefined>;

@@ -1,7 +0,8 @@

'use strict';
const mem = require('mem');
const execa = require('execa');
const passwdUser = require('passwd-user');
const pAny = require('p-any');
const filterObj = require('filter-obj');
import process from 'node:process';
import mem from 'mem';
import {execa} from 'execa';
import {passwdUser} from 'passwd-user';
import pAny from 'p-any';
import {includeKeys} from 'filter-obj';
import rc from 'rc';

@@ -12,3 +13,3 @@ const environmentVariables = [

'HGUSER', // Mercurial
'C9_USER' // Cloud9
'C9_USER', // Cloud9
];

@@ -30,3 +31,3 @@

async function checkAuthorName() {
const fullName = require('rc')('npm')['init-author-name'];
const fullName = rc('npm')['init-author-name'];

@@ -51,6 +52,6 @@ if (!fullName) {

async function checkGit() {
const fullName = await execa.stdout('git', [
const {stdout: fullName} = await execa('git', [
'config',
'--global',
'user.name'
'user.name',
]);

@@ -66,5 +67,5 @@

async function checkOsaScript() {
const fullName = await execa.stdout('osascript', [
const {stdout: fullName} = await execa('osascript', [
'-e',
'long user name of (system info)'
'long user name of (system info)',
]);

@@ -80,3 +81,3 @@

async function checkWmic() {
const stdout = await execa.stdout('wmic', [
const {stdout} = await execa('wmic', [
'useraccount',

@@ -86,3 +87,3 @@ 'where',

'get',
'fullname'
'fullname',
]);

@@ -100,3 +101,3 @@

async function checkGetEnt() {
const result = await execa.shell('getent passwd $(whoami)');
const result = await execa('getent passwd $(whoami)', {shell: true});
const fullName = (result.stdout.split(':')[4] || '').replace(/,.*/, '');

@@ -128,18 +129,20 @@

return await checkEnv();
} catch (_) {}
} catch {}
try {
return await checkAuthorName();
} catch (_) {}
} catch {}
try {
return await fallback();
} catch (_) {}
} catch {}
}
module.exports = mem(getFullName, {
const fullName = mem(getFullName, {
cachePromiseRejection: false,
cacheKey() {
return JSON.stringify(filterObj(process.env, environmentVariables));
}
return JSON.stringify(includeKeys(process.env, environmentVariables));
},
});
export default fullName;
{
"name": "fullname",
"version": "4.0.1",
"version": "5.0.0",
"description": "Get the fullname of the current user",
"license": "MIT",
"repository": "sindresorhus/fullname",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": ">=8"
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsd"
"//test": "xo && ava && tsd",
"test": "xo && tsd"
},

@@ -37,16 +44,19 @@ "files": [

"dependencies": {
"execa": "^1.0.0",
"filter-obj": "^2.0.0",
"execa": "^8.0.1",
"filter-obj": "^5.1.0",
"mem": "^5.1.0",
"p-any": "^2.1.0",
"passwd-user": "^3.0.0",
"p-any": "^4.0.0",
"passwd-user": "^4.0.0",
"rc": "^1.2.8"
},
"devDependencies": {
"ava": "^2.1.0",
"ava": "^5.3.1",
"import-fresh": "^3.0.0",
"mock-require": "^3.0.3",
"tsd": "^0.7.3",
"xo": "^0.24.0"
"tsd": "^0.29.0",
"xo": "^0.56.0"
},
"ava": {
"serial": true
}
}

@@ -1,38 +0,28 @@

# fullname [![Build Status](https://travis-ci.org/sindresorhus/fullname.svg?branch=master)](https://travis-ci.org/sindresorhus/fullname)
# fullname
> Get the full name of the current user
Works on macOS, Linux, and Windows.
## Install
```sh
npm install fullname
```
$ npm install fullname
```
Tested on macOS, Linux, and Windows.
## Usage
```js
const fullName = require('fullname');
import fullName from 'fullname';
(async () => {
console.log(await fullName());
//=> 'Sindre Sorhus'
})();
console.log(await fullName());
//=> 'Sindre Sorhus'
```
In the rare case a name can't be found, you could fall back to [`username`](https://github.com/sindresorhus/username).
In the rare case a name cannot be found, you could fall back to [`username`](https://github.com/sindresorhus/username).
## Related
- [fullname-cli](https://github.com/sindresorhus/fullname-cli) - CLI for this module
- [fullname-native](https://github.com/sindresorhus/fullname-native) - Native version of this module
- [fullname-cli](https://github.com/sindresorhus/fullname-cli) - CLI for this package
- [fullname-native](https://github.com/sindresorhus/fullname-native) - Native version of this package
- [username](https://github.com/sindresorhus/username) - Get the username of the current user
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc