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