{"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"jamestalmage","email":"james@talmage.io"}],"keywords":[],"dist-tags":{"latest":"1.0.1"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"description":"Captures and cleans stack traces","readme":"# stack-utils \n\n> Captures and cleans stack traces.\n\n[![Linux Build](https://travis-ci.org/tapjs/stack-utils.svg?branch=master)](https://travis-ci.org/tapjs/stack-utils) [![Build status](https://ci.appveyor.com/api/projects/status/fb9i157knoixe3iq/branch/master?svg=true)](https://ci.appveyor.com/project/jamestalmage/stack-utils-oiw96/branch/master)  [![Coverage](https://coveralls.io/repos/tapjs/stack-utils/badge.svg?branch=master&service=github)](https://coveralls.io/github/tapjs/stack-utils?branch=master)\n\n\nExtracted from `lib/stack.js` in the [`node-tap` project](https://github.com/tapjs/node-tap)\n\n## Install\n\n```\n$ npm install --save stack-utils\n```\n\n\n## Usage\n\n```js\nconst StackUtils = require('stack-utils');\nconst stack = new StackUtils({cwd: process.cwd(), internals: StackUtils.nodeInternals()});\n\nconsole.log(stack.clean(new Error().stack));\n// outputs a beautified stack trace\n```\n\n\n## API\n\n\n### new StackUtils([options])\n\nCreates a new `stackUtils` instance.\n\n#### options\n\n##### internals\n\nType: `array` of `RegularExpression`s  \n\nA set of regular expressions that match internal stack stack trace lines which should be culled from the stack trace.\n`StackUtils.nodeInternals()` returns a relatively set of sensible defaults for use on the node platform.\n\n##### cwd\n\nType: `string`\n\nThe path to the current working directory. File names in the stack trace will be shown relative to this directory.\n\n##### wrapCallSite\n\nType: `function(CallSite)`\n\nA mapping function for manipulating CallSites before processing. The first argument is a CallSite instance, and the function should return a modified CallSite. This is useful for providing source map support.\n\n\n### StackUtils.nodeInternals()\n\nReturns an array of regular expressions that be used to cull lines from the stack trace that reference common Node.js internal files.\n\n\n### stackUtils.clean(stack)\n\nCleans up a stack trace by deleting any lines that match the `internals` passed to the constructor, and shortening file names relative to `cwd`.\n\nReturns a `string` with the cleaned up stack (always terminated with a `\\n` newline character).\n\n#### stack\n\n*Required*  \nType: `string` or an `array` of `string`s\n\n\n### stackUtils.capture([limit], [startStackFunction])\n\nCaptures the current stack trace, returning an array of `CallSite`s. There are good overviews of the available CallSite methods [here](https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces), and [here](https://github.com/sindresorhus/callsites#api).\n\n#### limit\n\nType: `number`\nDefault: `Infinity`\n\nLimits the number of lines returned by dropping all lines in excess of the limit. This removes lines from the stack trace.\n\n#### startStackFunction\n\nType: `function`\n\nThe function where the stack trace should start. The first line of the stack trace will be the function that called `startStackFunction`. This removes lines from the end of the stack trace.\n\n\n### stackUtils.captureString([limit], [startStackFunction])\n\nCaptures the current stack trace, cleans it using `stackUtils.clean(stack)`, and returns a string with the cleaned stack trace. It takes the same arguments as `stackUtils.capture`.\n\n\n### stackUtils.at([startStackFunction])\n\nCaptures the first line of the stack trace (or the first line after `startStackFunction` if supplied), and returns a `CallSite` like object that is serialization friendly (properties are actual values instead of getter functions). \n\nThe available properties are:\n\n - `line`: `number` \n - `column`: `number`\n - `file`: `string`\n - `constructor`: `boolean`\n - `evalOrigin`: `string`\n - `native`: `boolean`\n - `typename`: `string`\n - `function`: `string`\n - `method`: `string`\n\n### stackUtils.parseLine(line)\n\nParses a `string` (which should be a single line from a stack trace), and generates an object with the following properties:\n\n - `line`: `number` \n - `column`: `number`\n - `file`: `string`\n - `constructor`: `boolean`\n - `evalOrigin`: `string`\n - `evalLine`: `number`\n - `evalColumn`: `number`\n - `evalFile`: `string`\n - `native`: `boolean`\n - `function`: `string`\n - `method`: `string`\n\n\n## License\n\nMIT © [Isaac Z. Schlueter](http://github.com/isaacs), [James Talmage](http://github.com/jamestalmage)\n","repository":{"type":"git","url":"git+https://github.com/tapjs/stack-utils.git"},"users":{"timdp":true,"monsterkodi":true},"bugs":{"url":"https://github.com/tapjs/stack-utils/issues"},"license":"MIT","versions":{"0.0.1":{"name":"stack-utils","version":"0.0.1","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/jamestalmage/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && nyc --reporter lcov --reporter text --cache ava --verbose"},"files":["index.js"],"keywords":[],"config":{"nyc":{"exclude":["fixtures/*"]}},"dependencies":{},"devDependencies":{"ava":"^0.8.0","coveralls":"^2.11.6","flatten":"0.0.1","nyc":"^5.2.0","xo":"^0.12.1"},"gitHead":"f0d147cc28c5aacaf6712ea4cdbf8cccfe3ba79c","bugs":{"url":"https://github.com/jamestalmage/stack-utils/issues"},"homepage":"https://github.com/jamestalmage/stack-utils#readme","_id":"stack-utils@0.0.1","_shasum":"5c7f358e79d45dedff43e8affb9fd905b33bd65c","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"jamestalmage","email":"james@talmage.io"},"dist":{"shasum":"5c7f358e79d45dedff43e8affb9fd905b33bd65c","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-0.0.1.tgz"},"maintainers":[{"name":"jamestalmage","email":"james@talmage.io"}],"directories":{}},"0.1.0":{"name":"stack-utils","version":"0.1.0","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/jamestalmage/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && nyc --reporter lcov --reporter text --cache ava --verbose","test-win":"ava --verbose"},"files":["index.js"],"keywords":[],"config":{"nyc":{"exclude":["fixtures/*"]}},"dependencies":{},"devDependencies":{"ava":"^0.8.0","coveralls":"^2.11.6","flatten":"0.0.1","nyc":"^5.2.0","xo":"^0.12.1"},"gitHead":"772ffe6894b42d450e7aef2fd9a379b822993572","bugs":{"url":"https://github.com/jamestalmage/stack-utils/issues"},"homepage":"https://github.com/jamestalmage/stack-utils#readme","_id":"stack-utils@0.1.0","_shasum":"9b2de559f5d1940c3eb40b480ff8c6d9ff6a1b1b","_from":".","_npmVersion":"3.5.2","_nodeVersion":"0.12.7","_npmUser":{"name":"jamestalmage","email":"james@talmage.io"},"dist":{"shasum":"9b2de559f5d1940c3eb40b480ff8c6d9ff6a1b1b","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-0.1.0.tgz"},"maintainers":[{"name":"jamestalmage","email":"james@talmage.io"}],"directories":{}},"0.2.0":{"name":"stack-utils","version":"0.2.0","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/jamestalmage/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && nyc --reporter lcov --reporter text --cache ava --verbose","test-win":"ava --verbose"},"files":["index.js"],"keywords":[],"config":{"nyc":{"exclude":["fixtures/*"]}},"dependencies":{},"devDependencies":{"ava":"^0.8.0","coveralls":"^2.11.6","flatten":"0.0.1","nyc":"^5.2.0","xo":"^0.12.1"},"gitHead":"64fa2c1f51caaeec57fec4843e8a65a4ed41fd8e","bugs":{"url":"https://github.com/jamestalmage/stack-utils/issues"},"homepage":"https://github.com/jamestalmage/stack-utils#readme","_id":"stack-utils@0.2.0","_shasum":"2e7a45dc67131a0e7bcf472caef3ff1f394b091d","_from":".","_npmVersion":"3.5.2","_nodeVersion":"0.12.7","_npmUser":{"name":"jamestalmage","email":"james@talmage.io"},"dist":{"shasum":"2e7a45dc67131a0e7bcf472caef3ff1f394b091d","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-0.2.0.tgz"},"maintainers":[{"name":"jamestalmage","email":"james@talmage.io"}],"directories":{}},"0.3.0":{"name":"stack-utils","version":"0.3.0","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/tapjs/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && nyc --reporter lcov --reporter text --cache ava --verbose","test-win":"ava --verbose"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"ava":"^0.8.0","bluebird":"^3.1.1","coveralls":"^2.11.6","flatten":"0.0.1","nested-error-stacks":"^1.0.2","nyc":"^5.2.0","pify":"^2.3.0","q":"^1.4.1","xo":"^0.12.1"},"gitHead":"cc2fe4c667ddd9e9f11c633e6ef6397d689016be","bugs":{"url":"https://github.com/tapjs/stack-utils/issues"},"homepage":"https://github.com/tapjs/stack-utils#readme","_id":"stack-utils@0.3.0","_shasum":"cddc6cec2ed9a5ce65f1ac05c90243b7a0ce325d","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.3.0","_npmUser":{"name":"jamestalmage","email":"james@talmage.io"},"dist":{"shasum":"cddc6cec2ed9a5ce65f1ac05c90243b7a0ce325d","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-0.3.0.tgz"},"maintainers":[{"name":"jamestalmage","email":"james@talmage.io"}],"directories":{}},"0.4.0":{"name":"stack-utils","version":"0.4.0","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/tapjs/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && nyc --reporter lcov --reporter text --cache ava --verbose","test-win":"ava --verbose"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"ava":"^0.8.0","bluebird":"^3.1.1","coveralls":"^2.11.6","flatten":"0.0.1","nested-error-stacks":"^1.0.2","nyc":"^5.2.0","pify":"^2.3.0","q":"^1.4.1","xo":"^0.12.1"},"gitHead":"8701171af041a235bae83a6da4ea516a815bb66a","bugs":{"url":"https://github.com/tapjs/stack-utils/issues"},"homepage":"https://github.com/tapjs/stack-utils#readme","_id":"stack-utils@0.4.0","_shasum":"940cb82fccfa84e8ff2f3fdf293fe78016beccd1","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.4.1","_npmUser":{"name":"jamestalmage","email":"james@talmage.io"},"dist":{"shasum":"940cb82fccfa84e8ff2f3fdf293fe78016beccd1","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-0.4.0.tgz"},"maintainers":[{"name":"jamestalmage","email":"james@talmage.io"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/stack-utils-0.4.0.tgz_1454711753671_0.9951272297184914"},"directories":{}},"1.0.0":{"name":"stack-utils","version":"1.0.0","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/tapjs/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"tap test/*.js --cov"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"bluebird":"^3.1.1","coveralls":"^2.11.6","flatten":"0.0.1","nested-error-stacks":"^2.0.0","pify":"^2.3.0","q":"^1.4.1","tap":"^10.0.0"},"gitHead":"faa81f19c8fd23cb5c9b13dfd7b26df6be7d7b1e","bugs":{"url":"https://github.com/tapjs/stack-utils/issues"},"homepage":"https://github.com/tapjs/stack-utils#readme","_id":"stack-utils@1.0.0","_shasum":"2392cd8ddbd222492ed6c047960f7414b46c0f83","_from":".","_npmVersion":"3.10.9","_nodeVersion":"8.0.0-pre","_npmUser":{"name":"isaacs","email":"i@izs.me"},"dist":{"shasum":"2392cd8ddbd222492ed6c047960f7414b46c0f83","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-1.0.0.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"jamestalmage","email":"james@talmage.io"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/stack-utils-1.0.0.tgz_1486016285424_0.8635052388999611"},"directories":{}},"1.0.1":{"name":"stack-utils","version":"1.0.1","description":"Captures and cleans stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/tapjs/stack-utils.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"tap test/*.js --100 -J","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --all; git push origin --tags"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"bluebird":"^3.1.1","coveralls":"^2.11.6","flatten":"0.0.1","nested-error-stacks":"^2.0.0","pify":"^2.3.0","q":"^1.4.1","tap":"^10.3.2"},"gitHead":"f080bcb2ee9be20520cfb312837d6056011e9094","bugs":{"url":"https://github.com/tapjs/stack-utils/issues"},"homepage":"https://github.com/tapjs/stack-utils#readme","_id":"stack-utils@1.0.1","_shasum":"d4f33ab54e8e38778b0ca5cfd3b3afb12db68620","_from":".","_npmVersion":"4.5.0","_nodeVersion":"8.0.0-pre","_npmUser":{"name":"isaacs","email":"i@izs.me"},"dist":{"shasum":"d4f33ab54e8e38778b0ca5cfd3b3afb12db68620","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/stack-utils/-/stack-utils-1.0.1.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"jamestalmage","email":"james@talmage.io"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/stack-utils-1.0.1.tgz_1492979544062_0.2575548014137894"},"directories":{}}},"name":"stack-utils","time":{"modified":"2017-04-23T20:32:26.102Z","created":"2016-01-04T05:15:37.432Z","0.0.1":"2016-01-04T05:15:37.432Z","0.1.0":"2016-01-07T20:24:53.362Z","0.2.0":"2016-01-07T21:19:49.097Z","0.3.0":"2016-01-14T03:54:58.328Z","0.4.0":"2016-02-05T22:35:56.320Z","1.0.0":"2017-02-02T06:18:07.294Z","1.0.1":"2017-04-23T20:32:26.102Z"},"readmeFilename":"readme.md","homepage":"https://github.com/tapjs/stack-utils#readme"}