{"name":"error-callsites","version":"2.0.4","description":"Extract callsite objects from Error objects","main":"index.js","scripts":{"test":"standard && tape test.js"},"keywords":["v8","error","errors","stack","stacktrace","stacktraces","callsite","callsites","stackframe","stackframes","frames"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","dependencies":{},"devDependencies":{"standard":"^14.3.3","tape":"^4.13.2"},"engines":{"node":">=6.x"},"repository":{"type":"git","url":"git+https://github.com/watson/error-callsites.git"},"bugs":{"url":"https://github.com/watson/error-callsites/issues"},"homepage":"https://github.com/watson/error-callsites#readme","gitHead":"917208c601c88fcec2abb4dc3bdc17655f75e45b","_id":"error-callsites@2.0.4","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-V877Ch4FC4FN178fDK1fsrHN4I1YQIBdtjKrHh3BUHMnh3SMvwUVrqkaOgDpUuevgSNna0RBq6Ox9SGlxYrigA==","shasum":"44f09e6a201e9a1603ead81eacac5ba258fca76e","tarball":"http://registry-npm.ywwl.com/error-callsites/download/error-callsites-2.0.4.tgz","fileCount":7,"unpackedSize":8296,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgw57iCRA9TVsSAnZWagAAyUwP/iWxUfVuWYCOWv702nfg\npXt4EA9E0AD4IV+9O5aa7NNKjzmj2fr3sija0VsixvCKruMUZs8F5259eR3w\ne5J1kgw/u5ivRVZ2oBTFn83zAaETUOOBqG8mgdkY2rEGQ88Pph1bJbucoVvm\n9mcpvLfl0MbUXAtri8gd5yWQmBQOyh6DWtd3K0GUKe8Av4D5xtZq8CkDoxs1\n+FJCApjqUi8886Li9FApy+Zi/4KV9kbrx8/72psLQL3R6IARwitUfLnsbV5J\n3CaKLbBW6EtjTsygz1fWKdxaYEHfYIE/FF+lP+0Z8V/A1RFhiyI+m67WcaTR\ndtXWG04rziQkrlbvat/t1AH6joiyB+r6gjesr3HyYHqzOL9zd8ckFRg8k9ko\nfIHwMIg5kOJnXKOAvhKxEYJVZ5yy1D8tps48rfjPx+CYxwlagXD0TcEjaAw8\nwjONsXAC3hJGaZrBrj+xLQNatLOBdvsrduyriAO2ycfRWeOa6LsU+DzGsnBm\nQQg41zWPN0WDwVNVbdD1450uER8z3trqU4NOpI3t/OjBKQMOwoN6H1yHhoSZ\nDo9He8hZWrsZZlUY01Zrl/fkMGspNc60TTDkaIi4YX9LTGyJNiS1PYZz1jgR\nsMACJIiv1LgncPAXReSn6GuRGzEIakiGG7euZzUu12XyQBjT3z+VxFXiwvj4\nlNGq\r\n=kxu9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDLZ/5hEc/msGjQ1APK9cEkavtEUDb/AapyjDkxUMwsgIgcNZ+D14flAGw4gmc7PEYGAB6cWxQnd9zRHd3eqzMDew="}],"size":3827,"noattachment":false,"key":"/error-callsites/-/error-callsites-2.0.4.tgz"},"_npmUser":{"name":"trentm","email":"trentm@gmail.com"},"directories":{},"maintainers":[{"name":"trentm","email":"trentm@gmail.com"},{"name":"watson","email":"w@tson.dk"},{"name":"qard","email":"admin@stephenbelanger.com"},{"name":"alanstorm","email":"astorm@alanstorm.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/error-callsites_2.0.4_1623432930428_0.9972095786772701"},"_hasShrinkwrap":false,"readme":"# error-callsites\n\nYet another module for extracting callsites (a.k.a. stack-frames) from\nNode.js `Error` objects.\n\n[![npm](https://img.shields.io/npm/v/error-callsites.svg)](https://www.npmjs.com/package/error-callsites)\n[![Tests](https://github.com/watson/error-callsites/workflows/Tests/badge.svg)](https://github.com/watson/error-callsites/actions)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n## Installation\n\n```\nnpm install error-callsites\n```\n\n## Usage\n\n```js\nvar callsites = require('error-callsites')\n\nvar err = new Error('foo')\nvar frames = callsites(err)\n\nconsole.log('Error occurred on line', frames[0].getLineNumber())\n```\n\n## API\n\nThe module exposes a single function which expects an `Error` object as\nthe first argument:\n\n```js\nvar frames = callsites(err)\n```\n\nMore specifically, it expects an object on which `Error.captureStackTrace(obj)`\nhas been called, which is the case for `Error` objects. You can do it directly\nyourself:\n\n```js\nvar obj = {}\nError.captureStackTrace(obj)\nvar frames = callsites(err)\n```\n\nThe function returns an array of\n[v8 `CallSite` objects](https://v8.dev/docs/stack-trace-api#customizing-stack-traces)\n-- one for each frame in the stack trace. CallSite objects provide accessor\nmethods for information on that frame. For example:\n\n- `callsite.getThis()` - returns the value of this\n- `callsite.getTypeName()` - returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.\n- `callsite.getFunction()` - returns the current function\n- `callsite.getFunctionName()` - returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.\n- `callsite.getMethodName()` - returns the name of the property of this or one of its prototypes that holds the current function\n- `callsite.getFileName()` - if this function was defined in a script returns the name of the script\n- `callsite.getLineNumber()` - if this function was defined in a script returns the current line number\n- `callsite.getColumnNumber()` - if this function was defined in a script returns the current column number\n- `callsite.getEvalOrigin()` - if this function was created using a call to eval returns a CallSite object representing the location where eval was called\n- `callsite.isToplevel()` - is this a toplevel invocation, that is, is this the global object?\n- `callsite.isEval()` - does this call take place in code defined by a call to eval?\n- `callsite.isNative()` - is this call in native V8 code?\n- `callsite.isConstructor()` - is this a constructor call?\n\nSee the link above for a complete list of the accessor methods. Some have been\nadded in more recent versions of v8 and Node.js.\n\n\n## How it works\n\nThis package works by setting a [custom `Error.prepareStackTrace`](https://v8.dev/docs/stack-trace-api#customizing-stack-traces)\nproperty that transparently captures the structured stack trace that v8 passes\nto this API, while also supporting other Node.js code in the process setting\nits own `Error.prepareStackTrace`.\n\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1623432930578,"_cnpm_publish_time":1623432930578,"dist-tags":{"latest":"2.0.4"}}