UNPKG

@opstarts/chimp

Version:

Develop acceptance tests & end-to-end tests with realtime feedback.

3 lines (2 loc) 2.54 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 r(t){return function(){return this[t]}}function n(t){if(t instanceof Object)for(var r=i.concat(o.concat(a.concat(s))),n=0;n<r.length;n++)t.hasOwnProperty(r[n])&&void 0!==t[r[n]]&&this["set"+e(r[n])](t[r[n]])}var i=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],a=["fileName","functionName","source"],s=["args"];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 u=0;u<i.length;u++)n.prototype["get"+e(i[u])]=r(i[u]),n.prototype["set"+e(i[u])]=function(t){return function(e){this[t]=Boolean(e)}}(i[u]);for(var c=0;c<o.length;c++)n.prototype["get"+e(o[c])]=r(o[c]),n.prototype["set"+e(o[c])]=function(e){return function(r){if(!t(r))throw new TypeError(e+" must be a Number");this[e]=Number(r)}}(o[c]);for(var f=0;f<a.length;f++)n.prototype["get"+e(a[f])]=r(a[f]),n.prototype["set"+e(a[f])]=function(t){return function(e){this[t]=String(e)}}(a[f]);return n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("stack-generator",["stackframe"],e):"object"==typeof exports?module.exports=e(require("stackframe")):t.StackGenerator=e(t.StackFrame)}(this,function(t){return{backtrace:function(e){var r=[],n=10;"object"==typeof e&&"number"==typeof e.maxStackSize&&(n=e.maxStackSize);for(var i=arguments.callee;i&&r.length<n;){for(var o=new Array(i.arguments.length),a=0;a<o.length;++a)o[a]=i.arguments[a];/function(?:\s+([\w$]+))+\s*\(/.test(i.toString())?r.push(new t({functionName:RegExp.$1||void 0,args:o})):r.push(new t({args:o}));try{i=i.caller}catch(s){break}}return r}}}); //# sourceMappingURL=stack-generator.min.js.map