{"name":"error-callsites","version":"1.0.1","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":"^8.5.0","tape":"^4.6.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":[55.6809551,12.5643655],"gitHead":"9dcb172b2bf7c075b4fe1a30014205229a82b157","_id":"error-callsites@1.0.1","_shasum":"4286169adf8fc12482f556111724c5aed873a692","_from":".","_npmVersion":"3.10.8","_nodeVersion":"7.0.0","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"4286169adf8fc12482f556111724c5aed873a692","tarball":"http://registry-npm.ywwl.com/error-callsites/download/error-callsites-1.0.1.tgz","integrity":"sha512-3hrljNq3FMjUEQ7sUQyfIEyfcHN1iBjmtsJwI+MN8QNz1VNuQWgKowWBAOvlCdyXPKQICdoLuAS+Pxam7GxT0Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAk2I1gJYXrAZfj4lgioRZxj8XR0KMWPyLOIv4IlY5r5AiBx9RukWFUNBkYofLdnvBZVmNw75z5He2em1PNaoS7c8w=="}],"size":3309,"noattachment":false,"key":"/error-callsites/-/error-callsites-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/error-callsites-1.0.1.tgz_1477578442855_0.7339367899112403"},"directories":{},"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":1477578444950,"_cnpm_publish_time":1477578444950,"dist-tags":{"latest":"2.0.4"}}