get-installed-path
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.0.2"></a> | ||
## [2.0.2](https://github.com/tunnckocore/get-installed-path/compare/v2.0.1...v2.0.2) (2016-12-11) | ||
### Bug Fixes | ||
* **err:** fix to return rejected promise if exists but not a directory ([80a2b1e](https://github.com/tunnckocore/get-installed-path/commit/80a2b1e)) | ||
<a name="2.0.1"></a> | ||
@@ -7,0 +17,0 @@ ## [2.0.1](https://github.com/tunnckocore/get-installed-path/compare/v2.0.0...v2.0.1) (2016-12-11) |
13
index.js
@@ -78,4 +78,4 @@ /*! | ||
const filepath = defaults(name, opts) | ||
fs.stat(filepath, (err, stats) => { | ||
if (err) { | ||
fs.stat(filepath, (e, stats) => { | ||
if (e) { | ||
const label = 'get-installed-path:' | ||
@@ -85,3 +85,10 @@ const msg = `${label} module not found "${name}" in path ${filepath}` | ||
} | ||
resolve(filepath) | ||
if (stats.isDirectory()) { | ||
return resolve(filepath) | ||
} | ||
const msg = `Possibly "${name}" is not a directory: ${filepath}` | ||
let err = new Error('get-installed-path: some error occured! ' + msg) | ||
reject(err) | ||
}) | ||
@@ -88,0 +95,0 @@ }) |
{ | ||
"name": "get-installed-path", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Get locally or globally installation path of given package name", | ||
@@ -5,0 +5,0 @@ "repository": "tunnckoCore/get-installed-path", |
20579
139