{"name":"error-callsites","version":"2.0.3","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"},"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","coordinates":[56.043858,12.609189],"gitHead":"c30046b49f0229e761004ed3cf78eefbfa0f93b9","_id":"error-callsites@2.0.3","_nodeVersion":"13.11.0","_npmVersion":"6.13.7","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-v036z4IEffZFE5kBkV5/F2MzhLnG0vuDyN+VXpzCf4yWXvX/1WJCI0A+TGTr8HWzBfCw5k8gr9rwAo09V+obTA==","shasum":"c9278de0d7d4b4861150af295bb92891393ff24a","tarball":"http://registry-npm.ywwl.com/error-callsites/download/error-callsites-2.0.3.tgz","fileCount":6,"unpackedSize":6813,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeb5ZjCRA9TVsSAnZWagAAK2IP/2yI65KISBlT6Rr7ITzi\n3WqVhRtBHYpcyQ6hoWOjO9QjHBsiLe7Ye9pWl7fdx5e1oVSX1MvZukCLpp3I\nxLqCEoxQREvoeOuVmD+8kfgy3Raskc53xfkPybpcLKEs+P0x90FLLo1QZjzj\n7k2UPIh3aaS3oYzjzODw9akrfzKZfY68LiAh5MdASvsvwA055wPFo230cpbe\nqQ5H15oRZ+XwvHu1mWcYB+Yy9YbS2ROmCmMyTK6bPCvN0H6+idH9tIBnfOe2\nMnwaQVSQ8E+u1RyaVxWCiBlhclMWF/+oroEJMZQDfBieHdAG7vhVULNCkNaI\n/QEutNMBA6i7YpUZxkZM34qsc/B7SRfKCEw7XB4vhjY9Zs8c2K5XV948jpeq\nc6GrBb1VsOMTFtVVFlYQlRmRQU19MNe7TLnj47ycYsSBpYkdczXua9mQ38xy\nKCpBSSBAb+tCGv3nHPPXDmYScKoAGdPtYc5xGDfF06xrNUTMlRkh91XhXzss\nrpRx4oniNoKRmTrwIrPndBLGXOzL3cKyk2lKyHNqoohDdrx513+Slj9jMbEY\nDJxA4MSi6v+StJ4Wrd/4r5w5zj0JbnPzeiH0Y6nS7SUMnnjJ9SrQOgYcb+cx\nKSYtHLREtgrNUGNIpwUKu4SSAH05uKLDnKTLB03RB6sc6szPisYdrQAdkK6E\np0pJ\r\n=ustl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdZTFdu+PQvxHb4Bbp+wFnvBCE+3Z7Utj5WMwRVMvK6gIgbUYo6RaNW8LlpzB080yGC2a7cHjyuYiNPtQis7EeV4U="}],"size":3190,"noattachment":false,"key":"/error-callsites/-/error-callsites-2.0.3.tgz"},"maintainers":[{"email":"admin@stephenbelanger.com","name":"qard"},{"email":"w@tson.dk","name":"watson"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/error-callsites_2.0.3_1584371298681_0.7010904688896809"},"_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":1584371298796,"_cnpm_publish_time":1584371298796,"dist-tags":{"latest":"2.0.4"}}