{"version":3,"sources":["stackframe.js"],"names":["root","factory","define","amd","exports","module","StackFrame","this","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","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,GAAI,GAAGC,cAAgBD,EAAIE,UAAU,GAGhD,QAASC,GAAQC,GACb,MAAO,YACH,MAAOX,MAAKW,IAWpB,QAASZ,GAAWa,GAChB,GAAIA,YAAeC,QACf,IAAK,GAAIC,GAAI,EAAGA,EAAIC,EAAMC,OAAQF,IAC1BF,EAAIK,eAAeF,EAAMD,KAAyBI,SAAlBN,EAAIG,EAAMD,KAC1Cd,KAAK,MAAQM,EAAYS,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,EAY3DvB,GAAWyB,WACPC,QAAS,WACL,MAAOzB,MAAK0B,MAEhBC,QAAS,SAASC,GACd,GAA0C,mBAAtCf,OAAOW,UAAUK,SAASC,KAAKF,GAC/B,KAAM,IAAIG,WAAU,wBAExB/B,MAAK0B,KAAOE,GAGhBI,cAAe,WACX,MAAOhC,MAAKiC,YAEhB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C,GAClE,MAAO,UAASiB,GACZ5B,KAAKW,GAAKqC,OAAOpB,KAEtBP,EAAY0B,GAGnB,OAAOhD","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[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"],"sourceRoot":"/source/"}