{"_id":"traceback","_rev":"235653","name":"traceback","description":"Easy access to the call stack, written in pure JavaScript","dist-tags":{"latest":"0.3.1"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}],"time":{"modified":"2023-03-24T16:24:33.000Z","created":"2011-12-14T16:13:27.809Z","0.3.1":"2014-08-19T08:12:14.755Z","0.3.0":"2011-12-14T16:13:27.809Z"},"users":{},"author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"repository":{"type":"git","url":"git://github.com/iriscouch/traceback"},"versions":{"0.3.1":{"name":"traceback","version":"0.3.1","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Easy access to the call stack, written in pure JavaScript","keywords":["call","stack","trace","stacktrace","traceback","debug","line"],"homepage":"http://github.com/iriscouch/traceback","repository":{"type":"git","url":"git://github.com/iriscouch/traceback"},"engines":["node"],"scripts":{"test":"tap test/"},"dependencies":{},"devDependencies":{"tap":"~0.4.12"},"main":"./api","bugs":{"url":"https://github.com/iriscouch/traceback/issues"},"_id":"traceback@0.3.1","dist":{"shasum":"64ef24a8168fcbe37ab17be3e99a40248b0bff85","size":11121,"noattachment":false,"key":"/traceback/-/traceback-0.3.1.tgz","tarball":"http://name.csiicloud.com:7001/traceback/download/traceback-0.3.1.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}],"directories":{},"publish_time":1408435934755,"_hasShrinkwrap":false,"_cnpm_publish_time":1408435934755,"_cnpmcore_publish_time":"2021-12-16T16:37:54.440Z"},"0.3.0":{"name":"traceback","version":"0.3.0","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Easy access to the call stack, written in pure JavaScript","keywords":["call","stack","trace","stacktrace","traceback","debug","line"],"homepage":"http://github.com/iriscouch/traceback","repository":{"type":"git","url":"git://github.com/iriscouch/traceback.git"},"engines":["node"],"dependencies":{},"devDependencies":{"tap":"0.1.3"},"main":"./api","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"_id":"traceback@0.3.0","_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"4e147f07cd332fbd0330ba510b942a5c9256a0ab","size":11444,"noattachment":false,"key":"/traceback/-/traceback-0.3.0.tgz","tarball":"http://name.csiicloud.com:7001/traceback/download/traceback-0.3.0.tgz"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}],"directories":{},"publish_time":1323879207809,"_hasShrinkwrap":false,"_cnpm_publish_time":1323879207809,"_cnpmcore_publish_time":"2021-12-16T16:37:54.658Z"}},"readme":"# Traceback: easy access to the call stack, for Node.js\n\nWriting a Node app? Need to know the function backtrace? Don't want to compile C++ code? Use Traceback.\n\nTraceback provides a normal JavaScript array of the execution stack frames. You can see function names, line numbers, and other useful stuff.\n\nTraceback is available from NPM.\n\n    $ npm install traceback\n\n## Example\n\n**example.js**\n\n```javascript\nvar traceback = require('../traceback');\n\nfunction start() { first() }\nfunction first() { second() }\nvar second = function() { last() }\n\nfunction last() {\n  var stack = traceback();\n  console.log('I am ' + stack[0].name + ' from file ' + stack[0].file)\n\n  for(var i = 1; i <= 3; i++)\n    console.log('  ' + i + ' above me: ' + stack[i].name + ' at line ' + stack[i].line);\n}\n\nstart();\n```\n\nOutput:\n\n    I am last from file example.js\n      1 above me: second at line 5\n      2 above me: first at line 4\n      3 above me: start at line 3\n\n## Usage\n\nSimply calling `traceback()` gives you the stack, with the current function in position 0.\n\nStack frame objects have normal V8 [CallSite][callsite] objects as prototypes. All those methods will work. You can also call `traceback.raw()` to get the exact stack made by V8.\n\nBut `traceback()`'s stack frame objects have convenient attribute names:\n\n* **name** | The function name\n* **path** | The absolute path of the file defining the function\n* **file** | The basename of the `path` file (`\"example.js\"`)\n* **line** | The line number in the file\n* **col** | The column number in the file\n* **pos** | The byte position in the file\n* **fun** | The function itself\n* **method** | If this function was called as a method, the name it is stored as\n* **this** | The object bound to the label `this` in the function\n* **type** | The type of `this`; the name of the constructor function (Object, ReadStream, etc.)\n* **origin** | The `CallSite` that ran `eval()`, if this frame is an eval\n* **is_top** | Boolean indicating whether the function was called with a global `this`\n* **is_eval** | Boolean indicating whether the function comes from an `eval()` call\n* **is_native** | Boolean indicating whether the function is native\n* **is_ctor** | Boolean indicating whether this is a constructor (`new`) call\n\nThey also work correctly in `JSON.stringify()`.\n\n## Tests\n\nTests use [node-tap][tap]. Clone this Git repository, run `npm install` and then run the tests through npm:\n\n    $ npm test\n\n    > traceback@0.3.1 test /Users/jhs/src/traceback\n    > tap test/\n\n    ok test/api.js ...................................... 326/326\n    ok test/fail.js ....................................... 36/36\n    ok test/format.js ....................................... 7/7\n    ok test/readme.js ....................................... 2/2\n    total ............................................... 371/371\n\n    ok\n\n## License\n\nApache 2.0\n\n[callsite]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi\n[tap]: https://github.com/isaacs/node-tap\n","_attachments":{},"homepage":"http://github.com/iriscouch/traceback","bugs":{"url":"https://github.com/iriscouch/traceback/issues"}}