resolve-global
Advanced tools
Comparing version 0.1.0 to 1.0.0
12
index.js
@@ -5,6 +5,6 @@ 'use strict'; | ||
module.exports = moduleId => { | ||
const resolveGlobal = moduleId => { | ||
try { | ||
return require.resolve(path.join(globalDirs.yarn.packages, moduleId)); | ||
} catch (err) { | ||
} catch (_) { | ||
return require.resolve(path.join(globalDirs.npm.packages, moduleId)); | ||
@@ -14,8 +14,10 @@ } | ||
module.exports = resolveGlobal; | ||
module.exports.silent = moduleId => { | ||
try { | ||
return module.exports(moduleId); | ||
} catch (err) { | ||
return null; | ||
return resolveGlobal(moduleId); | ||
} catch (_) { | ||
return undefined; | ||
} | ||
}; |
{ | ||
"name": "resolve-global", | ||
"version": "0.1.0", | ||
"description": "Resolve the path of a globally installed module", | ||
"license": "MIT", | ||
"repository": "sindresorhus/resolve-global", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"resolve", | ||
"global", | ||
"package", | ||
"module", | ||
"globally", | ||
"path", | ||
"npm", | ||
"yarn", | ||
"packages", | ||
"require" | ||
], | ||
"dependencies": { | ||
"global-dirs": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"execa": "^0.7.0", | ||
"xo": "*" | ||
} | ||
"name": "resolve-global", | ||
"version": "1.0.0", | ||
"description": "Resolve the path of a globally installed module", | ||
"license": "MIT", | ||
"repository": "sindresorhus/resolve-global", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"resolve", | ||
"global", | ||
"package", | ||
"module", | ||
"globally", | ||
"path", | ||
"npm", | ||
"yarn", | ||
"packages", | ||
"require" | ||
], | ||
"dependencies": { | ||
"global-dirs": "^0.1.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"execa": "^1.0.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -35,3 +35,3 @@ # resolve-global [![Build Status](https://travis-ci.org/sindresorhus/resolve-global.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-global) | ||
Returns `null` instead of throwing if the module can't be found. | ||
Returns `undefined` instead of throwing if the module can't be found. | ||
@@ -38,0 +38,0 @@ #### moduleId |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4343
5
40
1
4
Updatedglobal-dirs@^0.1.1