stack-chain
Advanced tools
Comparing version 1.3.5 to 1.3.6
{ | ||
"name": "stack-chain", | ||
"description": "API for combining call site modifiers", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"author": "Andreas Madsen <amwebdk@gmail.com>", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -13,3 +13,4 @@ | ||
var SHORTCUT_CALLSITE = false; | ||
var SHORTCIRCUIT_CALLSITE = false; | ||
stackChain.prototype.callSite = function collectCallSites(options) { | ||
@@ -19,7 +20,7 @@ if (!options) options = {}; | ||
// Get CallSites | ||
SHORTCUT_CALLSITE = true; | ||
SHORTCIRCUIT_CALLSITE = true; | ||
var obj = {}; | ||
Error.captureStackTrace(obj, collectCallSites); | ||
var callSites = obj.stack; | ||
SHORTCUT_CALLSITE = false; | ||
SHORTCIRCUIT_CALLSITE = false; | ||
@@ -79,14 +80,16 @@ // Slice | ||
this._formater = defaultFormater; | ||
this._previous = undefined; | ||
}; | ||
StackFormater.prototype._backup = function () { | ||
if (this._formater === defaultFormater) { | ||
this._previous = undefined; | ||
this._previous = this._formater; | ||
}; | ||
StackFormater.prototype._roolback = function () { | ||
if (this._previous === defaultFormater) { | ||
this.replace(undefined); | ||
} else { | ||
this._previous = this._formater; | ||
this.replace(this._previous); | ||
} | ||
}; | ||
StackFormater.prototype._roolback = function () { | ||
this.replace(this._previous); | ||
this._previous = undefined; | ||
@@ -107,4 +110,6 @@ }; | ||
var SHORTCIRCUIT_FORMATER = false; | ||
function prepareStackTrace(error, originalFrames) { | ||
if (SHORTCUT_CALLSITE) return originalFrames; | ||
if (SHORTCIRCUIT_CALLSITE) return originalFrames; | ||
if (SHORTCIRCUIT_FORMATER) return defaultFormater(error, originalFrames); | ||
@@ -136,3 +141,7 @@ // Make a loss copy of originalFrames | ||
// format frames | ||
return chain.format._formater(error, frames); | ||
SHORTCIRCUIT_FORMATER = true; | ||
var format = chain.format._formater(error, frames); | ||
SHORTCIRCUIT_FORMATER = false; | ||
return format; | ||
} | ||
@@ -139,0 +148,0 @@ |
34509
25
897