tryrequire
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -5,7 +5,7 @@ (function() { | ||
module.exports = function tryRequire(name, options) { | ||
var module, | ||
var result, | ||
o = options || {}, | ||
error = tryCatch(function() { | ||
module = require(name); | ||
result = require(name); | ||
}); | ||
@@ -15,5 +15,9 @@ | ||
if (o.log) | ||
console.error(error.message); | ||
console.error([ | ||
module.parent.filename + ':', | ||
error.code, | ||
'\'' + name + '\'', | ||
].join(' ')); | ||
else if (o.callback) | ||
module = exec.bind(null, error); | ||
result = exec.bind(null, error); | ||
@@ -24,3 +28,3 @@ if (o.exit) | ||
return module; | ||
return result; | ||
}; | ||
@@ -27,0 +31,0 @@ |
{ | ||
"name": "tryrequire", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "try to require", |
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
3566
35