Comparing version 1.0.1 to 1.0.2
@@ -1,33 +0,39 @@ | ||
"use strict"; | ||
var os = require("os"); | ||
'use strict' | ||
var os = require('os') | ||
/** | ||
Cross-platform home directory retriever, tested on Windows XP, Windows 8.1, Mac OSX, Linux. Will use the built-in [`os.homedir`](https://nodejs.org/api/os.html#os_os_homedir) if available. | ||
@module home-path | ||
* Cross-platform home directory retriever, tested on Windows XP and above, Mac OSX and Linux. Will use the built-in [`os.homedir`](https://nodejs.org/api/os.html#os_os_homedir) if available. | ||
* @module home-path | ||
* @example | ||
* var getHomePath = require('home-path') | ||
*/ | ||
module.exports = os.homedir ? os.homedir : getHomePath; | ||
module.exports = os.homedir ? os.homedir : getHomePath | ||
/** | ||
@alias module:home-path | ||
@example | ||
Mac OSX & Linux | ||
```js | ||
> var getHomePath = require("home-path"); | ||
> getHomePath() | ||
'/Users/Lloyd' | ||
``` | ||
Windows 8.1 | ||
```js | ||
> var getHomePath = require("home-path"); | ||
> getHomePath() | ||
'C:\\Users\\Lloyd' | ||
``` | ||
* @alias module:home-path | ||
* @example | ||
* Mac OSX | ||
* ```js | ||
* > getHomePath() | ||
* '/Users/Lloyd' | ||
* ``` | ||
* | ||
* Ubuntu Linux | ||
* ```js | ||
* > getHomePath() | ||
* '/home/lloyd' | ||
* ``` | ||
* | ||
* Windows 8.1 | ||
* ```js | ||
* > getHomePath() | ||
* 'C:\\Users\\Lloyd' | ||
* ``` | ||
*/ | ||
function getHomePath() { | ||
if (process.platform === "win32") { | ||
return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || process.env.HOME; | ||
} else { | ||
return process.env.HOME | ||
} | ||
}; | ||
function getHomePath () { | ||
if (process.platform === 'win32') { | ||
return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || process.env.HOME | ||
} else { | ||
return process.env.HOME | ||
} | ||
} |
{ | ||
"name": "home-path", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Cross-platform home directory retriever", | ||
@@ -17,9 +17,8 @@ "repository": "https://github.com/75lb/home-path.git", | ||
"test": "tape test/*.js", | ||
"lint": "jshint lib/*.js test/*.js; echo", | ||
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/*.js > README.md; echo" | ||
}, | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^1.1.1", | ||
"tape": "^4" | ||
"jsdoc-to-markdown": "^1.3.3", | ||
"tape": "^4.4" | ||
} | ||
} |
[![view on npm](http://img.shields.io/npm/v/home-path.svg)](https://www.npmjs.org/package/home-path) | ||
[![npm module downloads per month](http://img.shields.io/npm/dm/home-path.svg)](https://www.npmjs.org/package/home-path) | ||
[![npm module downloads](http://img.shields.io/npm/dt/home-path.svg)](https://www.npmjs.org/package/home-path) | ||
[![Build Status](https://travis-ci.org/75lb/home-path.svg?branch=master)](https://travis-ci.org/75lb/home-path) | ||
[![Dependency Status](https://david-dm.org/75lb/home-path.svg)](https://david-dm.org/75lb/home-path) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) | ||
<a name="module_home-path"></a> | ||
## home-path | ||
Cross-platform home directory retriever, tested on Windows XP, Windows 8.1, Mac OSX, Linux. Will use the built-in [`os.homedir`](https://nodejs.org/api/os.html#os_os_homedir) if available. | ||
Cross-platform home directory retriever, tested on Windows XP and above, Mac OSX and Linux. Will use the built-in [`os.homedir`](https://nodejs.org/api/os.html#os_os_homedir) if available. | ||
**Example** | ||
```js | ||
var getHomePath = require('home-path') | ||
``` | ||
<a name="exp_module_home-path--getHomePath"></a> | ||
@@ -14,5 +19,4 @@ ### getHomePath() ⏏ | ||
**Example** | ||
Mac OSX & Linux | ||
Mac OSX | ||
```js | ||
> var getHomePath = require("home-path"); | ||
> getHomePath() | ||
@@ -22,5 +26,10 @@ '/Users/Lloyd' | ||
Ubuntu Linux | ||
```js | ||
> getHomePath() | ||
'/home/lloyd' | ||
``` | ||
Windows 8.1 | ||
```js | ||
> var getHomePath = require("home-path"); | ||
> getHomePath() | ||
@@ -27,0 +36,0 @@ 'C:\\Users\\Lloyd' |
@@ -1,7 +0,7 @@ | ||
var test = require("tape"); | ||
var getHomePath = require("../"); | ||
var test = require('tape') | ||
var getHomePath = require('../') | ||
test("returns string", function(t){ | ||
t.equal(typeof getHomePath(), "string"); | ||
t.end(); | ||
}); | ||
test('returns string', function (t) { | ||
t.equal(typeof getHomePath(), 'string') | ||
t.end() | ||
}) |
Sorry, the diff of this file is not supported yet
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
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
43
40
4664
8