stackframe.min.js.map 6.45 KB
{"version":3,"sources":["stackframe.js"],"names":["root","factory","define","amd","exports","module","StackFrame","this","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","charAt","toUpperCase","substring","_getter","p","obj","Object","i","props","length","hasOwnProperty","undefined","booleanProps","numericProps","stringProps","arrayProps","concat","prototype","getArgs","args","setArgs","v","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","functionName","getFunctionName","join","fileName","getFileName","lineNumber","getLineNumber","columnNumber","getColumnNumber","Boolean","j","Number","k","String"],"mappings":"CAAC,SAASA,EAAMC,GACZ,YAIsB,mBAAXC,SAAyBA,OAAOC,IACvCD,OAAO,gBAAkBD,GACC,gBAAZG,SACdC,OAAOD,QAAUH,IAEjBD,EAAKM,WAAaL,KAExBM,KAAM,WACJ,YACA,SAASC,GAAUC,GACf,OAAQC,MAAMC,WAAWF,KAAOG,SAASH,GAG7C,QAASI,GAAYC,GACjB,MAAOA,GAAIC,OAAO,GAAGC,cAAgBF,EAAIG,UAAU,GAGvD,QAASC,GAAQC,GACb,MAAO,YACH,MAAOZ,MAAKY,IAWpB,QAASb,GAAWc,GAChB,GAAIA,YAAeC,QACf,IAAK,GAAIC,GAAI,EAAGA,EAAIC,EAAMC,OAAQF,IAC1BF,EAAIK,eAAeF,EAAMD,KAAyBI,SAAlBN,EAAIG,EAAMD,KAC1Cf,KAAK,MAAQM,EAAYU,EAAMD,KAAKF,EAAIG,EAAMD,KAX9D,GAAIK,IAAgB,gBAAiB,SAAU,WAAY,cACvDC,GAAgB,eAAgB,cAChCC,GAAe,WAAY,eAAgB,UAC3CC,GAAc,QAEdP,EAAQI,EAAaI,OAAOH,EAAcC,EAAaC,EAY3DxB,GAAW0B,WACPC,QAAS,WACL,MAAO1B,MAAK2B,MAEhBC,QAAS,SAASC,GACd,GAA0C,mBAAtCf,OAAOW,UAAUK,SAASC,KAAKF,GAC/B,KAAM,IAAIG,WAAU,wBAExBhC,MAAK2B,KAAOE,GAGhBI,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AU,MAAQnB,EAAYgB,EAAY0B,KAAO,SAAUpC,GAClE,MAAO,UAASiB,GACZ7B,KAAKY,GAAKqC,OAAOpB,KAEtBP,EAAY0B,GAGnB,OAAOjD","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 functionName = this.getFunctionName() || '{anonymous}';\n            var args = '(' + (this.getArgs() || []).join(',') + ')';\n            var fileName = this.getFileName() ? ('@' + this.getFileName()) : '';\n            var lineNumber = _isNumber(this.getLineNumber()) ? (':' + this.getLineNumber()) : '';\n            var columnNumber = _isNumber(this.getColumnNumber()) ? (':' + this.getColumnNumber()) : '';\n            return functionName + args + fileName + lineNumber + columnNumber;\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"]}