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')(); |
{ | ||
"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) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2646
1
2
4
2
34
1
+ Addedos-homedir@^1.0.0
+ Addedos-homedir@1.0.2(transitive)