{"name":"error-callsites","version":"2.0.0","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.778277,12.593083],"gitHead":"39b6e39d8eb1ab9df269a773a4942246d92a3db0","_id":"error-callsites@2.0.0","_nodeVersion":"12.7.0","_npmVersion":"6.10.3","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-EswkdhEfu+5pzdslJcNg3m9vQ1xurmx7zAukz4xcbjDyFHvYvmhprUH9RqHaW8yMclJEdKQ1TiRwE0IKnL4alw==","shasum":"78051db9004cb402192802ba578e149b568cde49","tarball":"http://registry-npm.ywwl.com/error-callsites/download/error-callsites-2.0.0.tgz","fileCount":7,"unpackedSize":7429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdXWM6CRA9TVsSAnZWagAAv8IQAIZS4TpIH2ScatsJX+A/\naZZReGFdtq48XTZrPqKtxsSzRag91npEhMmMqJ02f2GMCcbeSCNnMp+dJ2Ju\nZ3tUhHKB7ZUaagti7GN3OxrhieXyJa0ZJiadud6Rx2KmlguevLXz7hknxTvt\n1VZ5vhBDdd3+WaV4rn5Qpxh00DY6uoNtlCB64LykF1dPxXGI9MJTDlojNRE+\nu0yUNWekpfSpLMG1E+K/I2ULyS3DuTOGSQHPvq+DtspqAlO1leFbcIkFFLYt\nCF0XGAp3f2aK7zbeChzINrVMa1jHU3b4uuBSrRDG+cUupushFXFVqzxczbLY\nTExtwzOm5DjzmWOLbTJQ+WEnXRl8iEE6E28tLttD4yogJGh2EKJH5H5xLO30\na74vC3O2xQ60n/0crFHQvSxbZT0Bpbgi/WgdZmm5HuNu0WGSyVRicNv3nS5E\nrzo/ddFgWX16RHJbg8VwWRvCiDivraQC0reA623B4Asw5e9bBFkwR63nDMUN\n29gyJs+5K0Se61W8YMsKWB8zzgUgtr/JMYys0baBTLeuT5MFKM993POC6iEB\nTVZwXZR9TS5l0hp9N/rgqgpuHw2kJ+F6pFHmvkTxKn71PEEwiysLazSkNiaD\nEtWw25CTgfO90RieogUYt6jNxhTWgsLzaGTE7CxTUi4Z1d7ejo3SZ504gqDm\n3H+6\r\n=dNRC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAxmEJu86I0BnwLqLJGPJC9CG0j1fCvrSsD56if2plxBAiBsvXYYFVeJnZS2U2wXs6rQCv38enRzAf/nlwJ8g+8lAw=="}],"size":3296,"noattachment":false,"key":"/error-callsites/-/error-callsites-2.0.0.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.0_1566401337972_0.5318221038594013"},"_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":1566401338075,"_cnpm_publish_time":1566401338075,"dist-tags":{"latest":"2.0.4"}}