error-stack-parser
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -1,2 +0,2 @@ | ||
Array.prototype.map||(Array.prototype.map=function(t,e){var r,n=Object(this),i=n.length>>>0;arguments.length>1&&(r=e);for(var s=new Array(i),o=0;i>o;){var a,u;o in n&&(a=n[o],u=t.call(r,a,o,n),s[o]=u),o++}return s}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e=Object(this),r=e.length>>>0,n=[],i=arguments.length>=2?arguments[1]:void 0,s=0;r>s;s++)if(s in e){var o=e[s];t.call(i,o,s,e)&&n.push(o)}return n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],e):"object"==typeof exports?module.exports=e():t.StackFrame=e()}(this,function(){"use strict";function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,r,n,i,s){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==r&&this.setFileName(r),void 0!==n&&this.setLineNumber(n),void 0!==i&&this.setColumnNumber(i),void 0!==s&&this.setSource(s)}return e.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){var e=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",n=this.getFileName()?"@"+this.getFileName():"",i=t(this.getLineNumber())?":"+this.getLineNumber():"",s=t(this.getColumnNumber())?":"+this.getColumnNumber():"";return e+r+n+i+s}},e}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("error-stack-parser",["stackframe"],e):"object"==typeof exports?module.exports=e(require("stackframe")):t.ErrorStackParser=e(t.StackFrame)}(this,function(t){"use strict";var e=/(^|@)\S+\:\d+/,r=/\s+at .*(\S+\:\d+|\(native\))/;return{parse:function(t){if("undefined"!=typeof t.stacktrace||"undefined"!=typeof t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack&&t.stack.match(e))return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=t.replace(/[\(\)\s]/g,"").split(":"),r=e.pop(),n=e[e.length-1];if(!isNaN(parseFloat(n))&&isFinite(n)){var i=e.pop();return[e.join(":"),i,r]}return[e.join(":"),r,void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(t){return!!t.match(r)},this).map(function(e){var r=e.replace(/^\s+/,"").split(/\s+/).slice(1),n=this.extractLocation(r.pop()),i=r.join(" ")||void 0;return new t(i,void 0,n[0],n[1],n[2],e)},this)},parseFFOrSafari:function(r){return r.stack.split("\n").filter(function(t){return!!t.match(e)},this).map(function(e){var r=e.split("@"),n=this.extractLocation(r.pop()),i=r.shift()||void 0;return new t(i,void 0,n[0],n[1],n[2],e)},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),i=[],s=2,o=n.length;o>s;s+=2){var a=r.exec(n[s]);a&&i.push(new t(void 0,void 0,a[2],a[1],void 0,n[s]))}return i},parseOpera10:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),i=[],s=0,o=n.length;o>s;s+=2){var a=r.exec(n[s]);a&&i.push(new t(a[3]||void 0,void 0,a[2],a[1],void 0,n[s]))}return i},parseOpera11:function(r){return r.stack.split("\n").filter(function(t){return!!t.match(e)&&!t.match(/^Error created at/)},this).map(function(e){var r,n=e.split("@"),i=this.extractLocation(n.pop()),s=n.shift()||"",o=s.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;s.match(/\(([^\)]*)\)/)&&(r=s.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new t(o,a,i[0],i[1],i[2],e)},this)}}}); | ||
Array.prototype.map||(Array.prototype.map=function(e,t){var r,n=Object(this),i=n.length>>>0;arguments.length>1&&(r=t);for(var a=new Array(i),o=0;i>o;){var s,u;o in n&&(s=n[o],u=e.call(r,s,o,n),a[o]=u),o++}return a}),Array.prototype.filter||(Array.prototype.filter=function(e){for(var t=Object(this),r=t.length>>>0,n=[],i=arguments.length>=2?arguments[1]:void 0,a=0;r>a;a++)if(a in t){var o=t[a];e.call(i,o,a,t)&&n.push(o)}return n}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],t):"object"==typeof exports?module.exports=t():e.StackFrame=t()}(this,function(){"use strict";function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e,t,r,n,i,a){void 0!==e&&this.setFunctionName(e),void 0!==t&&this.setArgs(t),void 0!==r&&this.setFileName(r),void 0!==n&&this.setLineNumber(n),void 0!==i&&this.setColumnNumber(i),void 0!==a&&this.setSource(a)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(e){this.functionName=String(e)},getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getFileName:function(){return this.fileName},setFileName:function(e){this.fileName=String(e)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(e){this.source=String(e)},toString:function(){var t=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",n=this.getFileName()?"@"+this.getFileName():"",i=e(this.getLineNumber())?":"+this.getLineNumber():"",a=e(this.getColumnNumber())?":"+this.getColumnNumber():"";return t+r+n+i+a}},t}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("error-stack-parser",["stackframe"],t):"object"==typeof exports?module.exports=t(require("stackframe")):e.ErrorStackParser=t(e.StackFrame)}(this,function(e){"use strict";var t=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,n=/^(eval@)?(\[native code\])?$/;return{parse:function(e){if("undefined"!=typeof e.stacktrace||"undefined"!=typeof e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack&&e.stack.match(t))return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=e.replace(/[\(\)\s]/g,"").split(":"),r=t.pop(),n=t[t.length-1];if(!isNaN(parseFloat(n))&&isFinite(n)){var i=t.pop();return[t.join(":"),i,r]}return[t.join(":"),r,void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(r.pop()),i=r.join(" ")||void 0,a="eval"===n[0]?void 0:n[0];return new e(i,void 0,a,n[1],n[2],t)},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(n)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e(t);var r=t.split("@"),n=this.extractLocation(r.pop()),i=r.shift()||void 0;return new e(i,void 0,n[0],n[1],n[2],t)},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),i=[],a=2,o=n.length;o>a;a+=2){var s=r.exec(n[a]);s&&i.push(new e(void 0,void 0,s[2],s[1],void 0,n[a]))}return i},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),i=[],a=0,o=n.length;o>a;a+=2){var s=r.exec(n[a]);s&&i.push(new e(s[3]||void 0,void 0,s[2],s[1],void 0,n[a]))}return i},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,n=t.split("@"),i=this.extractLocation(n.pop()),a=n.shift()||"",o=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(r=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(o,s,i[0],i[1],i[2],t)},this)}}}); | ||
//# sourceMappingURL=error-stack-parser-with-polyfills.min.js.map |
@@ -17,3 +17,4 @@ (function (root, factory) { | ||
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/; | ||
var CHROME_IE_STACK_REGEXP = /\s+at .*(\S+\:\d+|\(native\))/; | ||
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m; | ||
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/; | ||
@@ -64,7 +65,12 @@ return { | ||
}, this).map(function (line) { | ||
var tokens = line.replace(/^\s+/, '').split(/\s+/).slice(1); | ||
if (line.indexOf('(eval ') > -1) { | ||
// Throw away eval information until we implement stacktrace.js/stackframe#8 | ||
line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ''); | ||
} | ||
var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.join(' ') || undefined; | ||
var fileName = locationParts[0] === 'eval' ? undefined : locationParts[0]; | ||
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); | ||
return new StackFrame(functionName, undefined, fileName, locationParts[1], locationParts[2], line); | ||
}, this); | ||
@@ -75,8 +81,18 @@ }, | ||
return error.stack.split('\n').filter(function (line) { | ||
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP); | ||
return !line.match(SAFARI_NATIVE_CODE_REGEXP); | ||
}, this).map(function (line) { | ||
var tokens = line.split('@'); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.shift() || undefined; | ||
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); | ||
// Throw away eval information until we implement stacktrace.js/stackframe#8 | ||
if (line.indexOf(' > eval') > -1) { | ||
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ':$1'); | ||
} | ||
if (line.indexOf('@') === -1 && line.indexOf(':') === -1) { | ||
// Safari eval frames only have function names and nothing else | ||
return new StackFrame(line); | ||
} else { | ||
var tokens = line.split('@'); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.shift() || undefined; | ||
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); | ||
} | ||
}, this); | ||
@@ -83,0 +99,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],e):"object"==typeof exports?module.exports=e():t.StackFrame=e()}(this,function(){"use strict";function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,r,i,n,s){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==r&&this.setFileName(r),void 0!==i&&this.setLineNumber(i),void 0!==n&&this.setColumnNumber(n),void 0!==s&&this.setSource(s)}return e.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){var e=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",i=this.getFileName()?"@"+this.getFileName():"",n=t(this.getLineNumber())?":"+this.getLineNumber():"",s=t(this.getColumnNumber())?":"+this.getColumnNumber():"";return e+r+i+n+s}},e}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("error-stack-parser",["stackframe"],e):"object"==typeof exports?module.exports=e(require("stackframe")):t.ErrorStackParser=e(t.StackFrame)}(this,function(t){"use strict";var e=/(^|@)\S+\:\d+/,r=/\s+at .*(\S+\:\d+|\(native\))/;return{parse:function(t){if("undefined"!=typeof t.stacktrace||"undefined"!=typeof t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack&&t.stack.match(e))return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=t.replace(/[\(\)\s]/g,"").split(":"),r=e.pop(),i=e[e.length-1];if(!isNaN(parseFloat(i))&&isFinite(i)){var n=e.pop();return[e.join(":"),n,r]}return[e.join(":"),r,void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(t){return!!t.match(r)},this).map(function(e){var r=e.replace(/^\s+/,"").split(/\s+/).slice(1),i=this.extractLocation(r.pop()),n=r.join(" ")||void 0;return new t(n,void 0,i[0],i[1],i[2],e)},this)},parseFFOrSafari:function(r){return r.stack.split("\n").filter(function(t){return!!t.match(e)},this).map(function(e){var r=e.split("@"),i=this.extractLocation(r.pop()),n=r.shift()||void 0;return new t(n,void 0,i[0],i[1],i[2],e)},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[],s=2,o=i.length;o>s;s+=2){var a=r.exec(i[s]);a&&n.push(new t(void 0,void 0,a[2],a[1],void 0,i[s]))}return n},parseOpera10:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[],s=0,o=i.length;o>s;s+=2){var a=r.exec(i[s]);a&&n.push(new t(a[3]||void 0,void 0,a[2],a[1],void 0,i[s]))}return n},parseOpera11:function(r){return r.stack.split("\n").filter(function(t){return!!t.match(e)&&!t.match(/^Error created at/)},this).map(function(e){var r,i=e.split("@"),n=this.extractLocation(i.pop()),s=i.shift()||"",o=s.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;s.match(/\(([^\)]*)\)/)&&(r=s.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new t(o,a,n[0],n[1],n[2],e)},this)}}}); | ||
!function(e,t){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],t):"object"==typeof exports?module.exports=t():e.StackFrame=t()}(this,function(){"use strict";function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e,t,r,i,n,a){void 0!==e&&this.setFunctionName(e),void 0!==t&&this.setArgs(t),void 0!==r&&this.setFileName(r),void 0!==i&&this.setLineNumber(i),void 0!==n&&this.setColumnNumber(n),void 0!==a&&this.setSource(a)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(e){this.functionName=String(e)},getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getFileName:function(){return this.fileName},setFileName:function(e){this.fileName=String(e)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(e){this.source=String(e)},toString:function(){var t=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",i=this.getFileName()?"@"+this.getFileName():"",n=e(this.getLineNumber())?":"+this.getLineNumber():"",a=e(this.getColumnNumber())?":"+this.getColumnNumber():"";return t+r+i+n+a}},t}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("error-stack-parser",["stackframe"],t):"object"==typeof exports?module.exports=t(require("stackframe")):e.ErrorStackParser=t(e.StackFrame)}(this,function(e){"use strict";var t=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;return{parse:function(e){if("undefined"!=typeof e.stacktrace||"undefined"!=typeof e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack&&e.stack.match(t))return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=e.replace(/[\(\)\s]/g,"").split(":"),r=t.pop(),i=t[t.length-1];if(!isNaN(parseFloat(i))&&isFinite(i)){var n=t.pop();return[t.join(":"),n,r]}return[t.join(":"),r,void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),i=this.extractLocation(r.pop()),n=r.join(" ")||void 0,a="eval"===i[0]?void 0:i[0];return new e(n,void 0,a,i[1],i[2],t)},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e(t);var r=t.split("@"),i=this.extractLocation(r.pop()),n=r.shift()||void 0;return new e(n,void 0,i[0],i[1],i[2],t)},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],a=2,s=i.length;s>a;a+=2){var o=r.exec(i[a]);o&&n.push(new e(void 0,void 0,o[2],o[1],void 0,i[a]))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],a=0,s=i.length;s>a;a+=2){var o=r.exec(i[a]);o&&n.push(new e(o[3]||void 0,void 0,o[2],o[1],void 0,i[a]))}return n},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.split("@"),n=this.extractLocation(i.pop()),a=i.shift()||"",s=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(r=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var o=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(s,o,n[0],n[1],n[2],t)},this)}}}); | ||
//# sourceMappingURL=error-stack-parser.min.js.map |
@@ -17,3 +17,4 @@ (function (root, factory) { | ||
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/; | ||
var CHROME_IE_STACK_REGEXP = /\s+at .*(\S+\:\d+|\(native\))/; | ||
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m; | ||
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/; | ||
@@ -64,7 +65,12 @@ return { | ||
}, this).map(function (line) { | ||
var tokens = line.replace(/^\s+/, '').split(/\s+/).slice(1); | ||
if (line.indexOf('(eval ') > -1) { | ||
// Throw away eval information until we implement stacktrace.js/stackframe#8 | ||
line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ''); | ||
} | ||
var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.join(' ') || undefined; | ||
var fileName = locationParts[0] === 'eval' ? undefined : locationParts[0]; | ||
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); | ||
return new StackFrame(functionName, undefined, fileName, locationParts[1], locationParts[2], line); | ||
}, this); | ||
@@ -75,8 +81,18 @@ }, | ||
return error.stack.split('\n').filter(function (line) { | ||
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP); | ||
return !line.match(SAFARI_NATIVE_CODE_REGEXP); | ||
}, this).map(function (line) { | ||
var tokens = line.split('@'); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.shift() || undefined; | ||
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); | ||
// Throw away eval information until we implement stacktrace.js/stackframe#8 | ||
if (line.indexOf(' > eval') > -1) { | ||
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ':$1'); | ||
} | ||
if (line.indexOf('@') === -1 && line.indexOf(':') === -1) { | ||
// Safari eval frames only have function names and nothing else | ||
return new StackFrame(line); | ||
} else { | ||
var tokens = line.split('@'); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.shift() || undefined; | ||
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); | ||
} | ||
}, this); | ||
@@ -83,0 +99,0 @@ }, |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"license": "SEE LICENSE IN LICENSE", | ||
@@ -12,0 +12,0 @@ "keywords": [ |
@@ -12,3 +12,3 @@ error-stack-parser.js - Extract meaning from JS Errors | ||
Note that in IE9 and earlier, `Error` objects don't have enough information to extract much of anything. In IE 10, `Error`s | ||
are given a `stack` once they're `throw`n. | ||
are given a `stack` once they're `throw`n. | ||
@@ -36,11 +36,2 @@ ## Browser Support | ||
## Browser Support | ||
* Chrome 1+ | ||
* Firefox 3.6+ | ||
* Safari 7+ | ||
* Opera 9+ | ||
* IE 10+ | ||
* iOS 7+ | ||
* Android 4.2+ | ||
## Contributing | ||
@@ -47,0 +38,0 @@ Want to be listed as a *Contributor*? Start with the [Contributing Guide](CONTRIBUTING.md)! |
Sorry, the diff of this file is not supported yet
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
64269
322
40