{"name":"error-callsites","version":"2.0.2","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.0.0","tape":"^4.11.0"},"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":[55.778258,12.593107],"gitHead":"496808ac22e8435ac41ea00441e8b94da6205bda","_id":"error-callsites@2.0.2","_nodeVersion":"12.7.0","_npmVersion":"6.10.3","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-s35ELWAKAY9oPqnnfP1V4AnasWV0r2ihaLlpsCGrykZgcR/YKsMXV3q8Ap4Mmp8U90VxJqxKJE5Io0IkkRhJIg==","shasum":"55c17a9490a85d72158563f13dc078851ca05b1e","tarball":"http://registry-npm.ywwl.com/error-callsites/download/error-callsites-2.0.2.tgz","fileCount":5,"unpackedSize":6297,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdXW38CRA9TVsSAnZWagAA4fQP/3ivWT+scsQXZyddL6qU\nLxHzCoh9h4413EnwnrszOXkcYsMfiGPB+p343rTyHC+nRAU30dgElq/UXwrp\n7oepshY/IGZhS6v6dhynEl9Q035syMNvNtnI8EpJ7qs+bDpJqHavSgHn/8j8\n/6Hoc3laAOQPlnLgD/9ukSHSmqh5GTXfy5aO5fGB+9M8zcphP8bFP3oXmbjc\nsl6ZHSZPRpEBOK0f+sENSbePl1DGOifFJaBaZvjiQ2EnS/jayIi6nVDyPrzN\ncZ+4+xYoAljjciVVkhxwCLBkfxpvy9FYmJ+wInYZQ8CTxzVy3z0NFH6y6Nq1\n2olWqfxe9ZsoGleVGbJXn3dTr+9ryDXxzxszjn5VhfTZoUbuHwaKTPqyhwwy\ni9RpME4bO69R423JbVL0l8m/J/ecPcPWp/XFyhqaY0/55QIMcVPOUO9A61wu\nvDDq9SzgT9Sc03dVmYVuor1wKkIzfAIO8iPDn2nNwvGg/XF6uMvWFuFqCzmY\n19Db5aJk0MDUhls3jFgZP2a5SwgMIcL/cZLksVvQcBlnlVg0kqz0JsQwLNN2\nLlI4Je4ntn8TQgHb4Yztk1rrZmo5WPXq+wV7ALWsB23e82aNHwkb49kc0TT9\nCz4JKE4PeZSncCLyjC6zAU+3cDXtjtRYTujWyuAANQ/Nt1IbH5yNzpq9Hef2\nuDyd\r\n=Tkes\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDt0PFTNi8LHiCGvQ9CD+cRbjz9qkwkuF2XCywVqhRmaQIhAOHz0XkH3n8fY9qluKfRNgjj5DBmxMBBB2mB66RnD9Qe"}],"size":2936,"noattachment":false,"key":"/error-callsites/-/error-callsites-2.0.2.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.2_1566404091844_0.638100781218746"},"_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":1566404091961,"_cnpm_publish_time":1566404091961,"dist-tags":{"latest":"2.0.4"}}