2017-09-13 07:52:34 +02:00

3 lines
1.8 KiB
JavaScript
Vendored

!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=0;n<a.length;n++)t.hasOwnProperty(a[n])&&void 0!==t[a[n]]&&this["set"+e(a[n])](t[a[n]])}var i=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],s=["fileName","functionName","source"],u=["args"],a=i.concat(o,s,u);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 c=0;c<i.length;c++)r.prototype["get"+e(i[c])]=n(i[c]),r.prototype["set"+e(i[c])]=function(t){return function(e){this[t]=Boolean(e)}}(i[c]);for(var f=0;f<o.length;f++)r.prototype["get"+e(o[f])]=n(o[f]),r.prototype["set"+e(o[f])]=function(e){return function(n){if(!t(n))throw new TypeError(e+" must be a Number");this[e]=Number(n)}}(o[f]);for(var g=0;g<s.length;g++)r.prototype["get"+e(s[g])]=n(s[g]),r.prototype["set"+e(s[g])]=function(t){return function(e){this[t]=String(e)}}(s[g]);return r});
//# sourceMappingURL=stackframe.min.js.map