Comparing version 0.1.0 to 1.0.0
11
index.js
// userhome | ||
// Copyright (c) 2013 Kyle Robinson Young | ||
// Copyright (c) 2014 Kyle Robinson Young | ||
// Licensed under the MIT license. | ||
@@ -8,5 +8,8 @@ | ||
module.exports = function() { | ||
return path.resolve.apply(path.resolve, [ | ||
process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'] | ||
].concat(Array.prototype.slice.call(arguments, 0))); | ||
var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME']; | ||
if (!home) { | ||
throw new Error('Could not find a valid user home path.'); | ||
} | ||
return path.resolve.apply(path.resolve, [home] | ||
.concat(Array.prototype.slice.call(arguments, 0))); | ||
}; |
{ | ||
"name": "userhome", | ||
"description": "A platform independent path to the user's home", | ||
"version": "0.1.0", | ||
"description": "A cross-platform path to the user's home", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/shama/userhome", | ||
@@ -11,2 +11,5 @@ "author": { | ||
}, | ||
"scripts": { | ||
"test": "node test.js" | ||
}, | ||
"repository": { | ||
@@ -27,3 +30,13 @@ "type": "git", | ||
"node": ">= 0.8.0" | ||
}, | ||
"keywords": [ | ||
"userhome", | ||
"user", | ||
"home", | ||
"homedir", | ||
"path" | ||
], | ||
"devDependencies": { | ||
"tape": "^3.0.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# userhome | ||
# userhome [![Build Status](http://img.shields.io/travis/shama/userhome.svg)](https://travis-ci.org/shama/userhome) | ||
> A platform independent path to the user's home. | ||
> A cross-platform (OSX, Windows, Linux) path to the user's home. | ||
@@ -13,9 +13,15 @@ ```js | ||
// /Users/shama/test/sub/file | ||
console.log(userhome()); | ||
// C:\Users\shama | ||
``` | ||
> If a valid user home environment variable could not be found an error will be thrown indicating so. | ||
## Release History | ||
* 1.0.0 - Throws an error if a user home can not be found. | ||
* 0.1.0 - initial release | ||
## License | ||
Copyright (c) 2013 Kyle Robinson Young | ||
Copyright (c) 2014 Kyle Robinson Young | ||
Licensed under the MIT license. |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3617
7
29
0
27
0
1
4