Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

user-home

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

user-home - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

15

index.js
'use strict';
var env = process.env;
var home = env.HOME;
var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
if (process.platform === 'win32') {
module.exports = env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
} else if (process.platform === 'darwin') {
module.exports = home || (user ? '/Users/' + user : null) || null;
} else if (process.platform === 'linux') {
module.exports = home ||
(user ? (process.getuid() === 0 ? '/root' : '/home/' + user) : null) || null;
} else {
module.exports = home || null;
}
module.exports = require('os-homedir')();

26

package.json
{
"name": "user-home",
"version": "1.1.1",
"version": "2.0.0",
"description": "Get the path to the user home directory",
"license": "MIT",
"repository": "sindresorhus/user-home",
"bin": {
"user-home": "cli.js"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},

@@ -22,19 +19,26 @@ "engines": {

"files": [
"index.js",
"cli.js"
"index.js"
],
"keywords": [
"cli",
"bin",
"user",
"home",
"homedir",
"os-homedir",
"dir",
"directory",
"folder",
"path"
"path",
"env",
"vars",
"environment",
"variables",
"userprofile"
],
"dependencies": {
"os-homedir": "^1.0.0"
},
"devDependencies": {
"ava": "0.0.3"
"ava": "0.0.4",
"path-exists": "^1.0.0"
}
}

@@ -8,3 +8,3 @@ # user-home [![Build Status](https://travis-ci.org/sindresorhus/user-home.svg?branch=master)](https://travis-ci.org/sindresorhus/user-home)

```sh
```
$ npm install --save user-home

@@ -20,3 +20,3 @@ ```

console.log(userHome);
//=> /Users/sindresorhus
//=> '/Users/sindresorhus'
```

@@ -27,19 +27,10 @@

## CLI
## Related
```sh
$ npm install --global user-home
```
- [user-home-cli](https://github.com/sindresorhus/user-home-cli) - CLI for this module
- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory
```sh
$ user-home --help
Example
$ user-home
/Users/sindresorhus
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
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