stackframe.min.js 1.84 KB
!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){return t.charAt(0).toUpperCase()+t.substring(1)}function r(t){return function(){return this[t]}}function n(t){if(t instanceof Object)for(var r=0;r<a.length;r++)t.hasOwnProperty(a[r])&&void 0!==t[a[r]]&&this["set"+e(a[r])](t[a[r]])}var i=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],s=["fileName","functionName","source"],u=["args"],a=i.concat(o,s,u);n.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 n)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new n(t)}},toString:function(){var e=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",n=this.getFileName()?"@"+this.getFileName():"",i=t(this.getLineNumber())?":"+this.getLineNumber():"",o=t(this.getColumnNumber())?":"+this.getColumnNumber():"";return e+r+n+i+o}};for(var c=0;c<i.length;c++)n.prototype["get"+e(i[c])]=r(i[c]),n.prototype["set"+e(i[c])]=function(t){return function(e){this[t]=Boolean(e)}}(i[c]);for(var f=0;f<o.length;f++)n.prototype["get"+e(o[f])]=r(o[f]),n.prototype["set"+e(o[f])]=function(e){return function(r){if(!t(r))throw new TypeError(e+" must be a Number");this[e]=Number(r)}}(o[f]);for(var g=0;g<s.length;g++)n.prototype["get"+e(s[g])]=r(s[g]),n.prototype["set"+e(s[g])]=function(t){return function(e){this[t]=String(e)}}(s[g]);return n});
//# sourceMappingURL=stackframe.min.js.map