You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
5.0 KiB
2 lines
5.0 KiB
3 years ago
|
!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 r(e){return e.charAt(0).toUpperCase()+e.substring(1)}function e(e){return function(){return this[e]}}var t=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],i=["fileName","functionName","source"],a=t.concat(n,i,["args"]);function s(e){if(e)for(var t=0;t<a.length;t++)void 0!==e[a[t]]&&this["set"+r(a[t])](e[a[t]])}s.prototype={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},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:n?n+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},s.fromString=function(e){var t,r,n,i=e.indexOf("("),a=e.lastIndexOf(")"),o=e.substring(0,i),i=e.substring(i+1,a).split(","),a=e.substring(a+1);return 0===a.indexOf("@")&&(t=(n=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,""))[1],r=n[2],n=n[3]),new s({functionName:o,args:i||void 0,fileName:t,lineNumber:r||void 0,columnNumber:n||void 0})};for(var o=0;o<t.length;o++)s.prototype["get"+r(t[o])]=e(t[o]),s.prototype["set"+r(t[o])]=function(t){return function(e){this[t]=Boolean(e)}}(t[o]);for(var c=0;c<n.length;c++)s.prototype["get"+r(n[c])]=e(n[c]),s.prototype["set"+r(n[c])]=function(r){return function(e){if(t=e,isNaN(parseFloat(t))||!isFinite(t))throw new TypeError(r+" must be a Number");var t;this[r]=Number(e)}}(n[c]);for(var u=0;u<i.length;u++)s.prototype["get"+r(i[u])]=e(i[u]),s.prototype["set"+r(i[u])]=function(t){return function(e){this[t]=String(e)}}(i[u]);return s}),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(s){"use strict";var t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,n=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(e){var t=(r=(e=-1<e.indexOf("(eval ")?e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""):e).replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,"")).match(/ (\(.+\)$)/),r=t?r.replace(t[0],""):r,n=this.extractLocation(t?t[1]:r),t=t&&r||void 0,r=-1<["eval","<anonymous>"].indexOf(n[0])?void 0:n[0];return new s({functionName:t,fileName:r,lineNumber:n[1],columnNumber:n[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(n)},this).map(function(e){if(-1===(e=-1<e.indexOf(" > eval")?e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1"):e).indexOf("@")&&-1===e.indexOf(":"))return new s({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),r=r&&r[1]?r[1]:void 0,t=this.extractLocation(e.replace(t,""));return new s({functionName:r,fileName:t[0],lineNumber:t[1],columnNumber:t[2],source:e})},this)},parseOpera:function(e){return!e.stacktrace||-1<e.message.indexOf("\n")&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/
|
||
|
//# sourceMappingURL=error-stack-parser.min.js.map
|