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
2.1 KiB

4 years ago
  1. !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 r(t){return t.charAt(0).toUpperCase()+t.substring(1)}function t(t){return function(){return this[t]}}var e=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],i=["fileName","functionName","source"],o=e.concat(n,i,["args"]);function c(t){if(t instanceof Object)for(var e=0;e<o.length;e++)t.hasOwnProperty(o[e])&&void 0!==t[o[e]]&&this["set"+r(o[e])](t[o[e]])}c.prototype={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},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof c)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new c(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:n?n+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},c.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),n=t.substring(0,e),i=t.substring(e+1,r).split(","),o=t.substring(r+1);if(0===o.indexOf("@"))var s=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),u=s[1],a=s[2],f=s[3];return new c({functionName:n,args:i||void 0,fileName:u,lineNumber:a||void 0,columnNumber:f||void 0})};for(var s=0;s<e.length;s++)c.prototype["get"+r(e[s])]=t(e[s]),c.prototype["set"+r(e[s])]=function(e){return function(t){this[e]=Boolean(t)}}(e[s]);for(var u=0;u<n.length;u++)c.prototype["get"+r(n[u])]=t(n[u]),c.prototype["set"+r(n[u])]=function(r){return function(t){if(e=t,isNaN(parseFloat(e))||!isFinite(e))throw new TypeError(r+" must be a Number");var e;this[r]=Number(t)}}(n[u]);for(var a=0;a<i.length;a++)c.prototype["get"+r(i[a])]=t(i[a]),c.prototype["set"+r(i[a])]=function(e){return function(t){this[e]=String(t)}}(i[a]);return c});
  2. //# sourceMappingURL=stackframe.min.js.map