Comparing version 0.0.9 to 0.0.11
module.exports = trycatch; | ||
var colors = require('colors'); | ||
// use colors module, if available | ||
try { trycatch.colors = require('colors'); } catch(err) {} | ||
var FormatStackTrace = require('./formatStackTrace'); | ||
var path = require('path'); | ||
var d = path.join('/'); | ||
@@ -100,12 +103,16 @@ | ||
var ret = []; | ||
return frames.split("\n").filter(function(frame) { | ||
ret = frames.split("\n").filter(function(frame) { | ||
return frame.indexOf(filename1) < 0 && frame.indexOf(filename2) < 0; | ||
}).map(function(frame, k) { | ||
if (frame.indexOf('/node_modules/') >= 0) { | ||
frame = colors.cyan(frame); | ||
} else if (frame.indexOf('/') >= 0) { | ||
frame = colors.red(frame); | ||
} | ||
return frame; | ||
}).join("\n"); | ||
}); | ||
if (trycatch.colors) { | ||
ret = ret.map(function(frame, k) { | ||
if (frame.indexOf(d + 'node_modules' + d) >= 0) { | ||
frame = trycatch.colors.cyan(frame); | ||
} else if (frame.indexOf(d) >= 0) { | ||
frame = trycatch.colors.red(frame); | ||
} | ||
return frame; | ||
}); | ||
} | ||
return ret.join("\n"); | ||
} |
{ | ||
"name" : "trycatch", | ||
"version" : "0.0.9", | ||
"version" : "0.0.11", | ||
"description" : "An asynchronous exception handler with long stack traces for node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/CrabDude/trycatch", |
379
16136
10