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.
 
 
 

1 lines
8.1 KiB

{"version":3,"sources":["stackframe.js"],"names":["root","factory","define","amd","exports","module","StackFrame","this","_capitalize","str","charAt","toUpperCase","substring","_getter","p","booleanProps","numericProps","stringProps","props","concat","obj","Object","i","length","hasOwnProperty","undefined","prototype","getArgs","args","setArgs","v","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","fileName","getFileName","lineNumber","getLineNumber","columnNumber","getColumnNumber","functionName","getFunctionName","getIsEval","fromString","argsStartIndex","indexOf","argsEndIndex","lastIndexOf","split","locationString","parts","exec","Boolean","j","n","isNaN","parseFloat","isFinite","Number","k","String"],"mappings":"CAAC,SAASA,EAAMC,GACZ,aAIsB,mBAAXC,QAAyBA,OAAOC,IACvCD,OAAO,aAAc,GAAID,GACC,iBAAZG,QACdC,OAAOD,QAAUH,IAEjBD,EAAKM,WAAaL,IAV1B,CAYEM,KAAM,WACJ,aAKA,SAASC,EAAYC,GACjB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,UAAU,GAGvD,SAASC,EAAQC,GACb,OAAO,WACH,OAAOP,KAAKO,IAIpB,IAAIC,EAAe,CAAC,gBAAiB,SAAU,WAAY,cACvDC,EAAe,CAAC,eAAgB,cAChCC,EAAc,CAAC,WAAY,eAAgB,UAG3CC,EAAQH,EAAaI,OAAOH,EAAcC,EAF7B,CAAC,SAIlB,SAASX,EAAWc,GAChB,GAAIA,aAAeC,OACf,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAMK,OAAQD,IAC1BF,EAAII,eAAeN,EAAMI,UAAyBG,IAAlBL,EAAIF,EAAMI,KAC1Cf,KAAK,MAAQC,EAAYU,EAAMI,KAAKF,EAAIF,EAAMI,KAM9DhB,EAAWoB,UAAY,CACnBC,QAAS,WACL,OAAOpB,KAAKqB,MAEhBC,QAAS,SAASC,GACd,GAA0C,mBAAtCT,OAAOK,UAAUK,SAASC,KA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AAU,MAAQlB,EAAYO,EAAaO,KAAO,SAAUR,GACnE,OAAO,SAASgB,GACZvB,KAAKO,GAAKyC,QAAQzB,IAFmC,CAI1Df,EAAaO,IAGpB,IAAK,IAAIkC,EAAI,EAAGA,EAAIxC,EAAaO,OAAQiC,IACrClD,EAAWoB,UAAU,MAAQlB,EAAYQ,EAAawC,KAAO3C,EAAQG,EAAawC,IAClFlD,EAAWoB,UAAU,MAAQlB,EAAYQ,EAAawC,KAAO,SAAU1C,GACnE,OAAO,SAASgB,GACZ,GA9GO2B,EA8GQ3B,EA7Gf4B,MAAMC,WAAWF,MAAOG,SAASH,GA8G7B,MAAM,IAAIxB,UAAUnB,EAAI,qBA/GxC,IAAmB2C,EAiHPlD,KAAKO,GAAK+C,OAAO/B,IALoC,CAO1Dd,EAAawC,IAGpB,IAAK,IAAIM,EAAI,EAAGA,EAAI7C,EAAYM,OAAQuC,IACpCxD,EAAWoB,UAAU,MAAQlB,EAAYS,EAAY6C,KAAOjD,EAAQI,EAAY6C,IAChFxD,EAAWoB,UAAU,MAAQlB,EAAYS,EAAY6C,KAAO,SAAUhD,GAClE,OAAO,SAASgB,GACZvB,KAAKO,GAAKiD,OAAOjC,IAFmC,CAIzDb,EAAY6C,IAGnB,OAAOxD","file":"stackframe.min.js","sourcesContent":["(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stackframe', [], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.StackFrame = factory();\n }\n}(this, function() {\n 'use strict';\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n\n function _getter(p) {\n return function() {\n return this[p];\n };\n }\n\n var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];\n var numericProps = ['columnNumber', 'lineNumber'];\n var stringProps = ['fileName', 'functionName', 'source'];\n var arrayProps = ['args'];\n\n var props = booleanProps.concat(numericProps, stringProps, arrayProps);\n\n function StackFrame(obj) {\n if (obj instanceof Object) {\n for (var i = 0; i < props.length; i++) {\n if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {\n this['set' + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n }\n\n StackFrame.prototype = {\n getArgs: function() {\n return this.args;\n },\n setArgs: function(v) {\n if (Object.prototype.toString.call(v) !== '[object Array]') {\n throw new TypeError('Args must be an Array');\n }\n this.args = v;\n },\n\n getEvalOrigin: function() {\n return this.evalOrigin;\n },\n setEvalOrigin: function(v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError('Eval Origin must be an Object or StackFrame');\n }\n },\n\n toString: function() {\n var fileName = this.getFileName() || '';\n var lineNumber = this.getLineNumber() || '';\n var columnNumber = this.getColumnNumber() || '';\n var functionName = this.getFunctionName() || '';\n if (this.getIsEval()) {\n if (fileName) {\n return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return '[eval]:' + lineNumber + ':' + columnNumber;\n }\n if (functionName) {\n return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return fileName + ':' + lineNumber + ':' + columnNumber;\n }\n };\n\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf('(');\n var argsEndIndex = str.lastIndexOf(')');\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf('@') === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, '');\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {\n return function(v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n }\n\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {\n return function(v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + ' must be a Number');\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n }\n\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {\n return function(v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n }\n\n return StackFrame;\n}));\n"]}