# @stack-tools/node-tools

> Tools for printing and parsing node errors and their stacks

Latest version **0.2.4** (published 2021-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stack-tools/node-tools
pnpm add @stack-tools/node-tools
yarn add @stack-tools/node-tools
bun add @stack-tools/node-tools
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2021-12-04 |
| First published | 2021-12-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Conrad Buck |
| Maintainers | conartist6 |

## Links

- npm: https://www.npmjs.com/package/@stack-tools/node-tools
- Repository: https://github.com/stack-tools-js/stack-tools
- Homepage: https://github.com/stack-tools-js/stack-tools#readme
- Issues: https://github.com/stack-tools-js/stack-tools/issues
- npm.io page: https://npm.io/package/@stack-tools/node-tools

## Dependencies (1)

- [@stack-tools/v8-tools](https://npm.io/package/@stack-tools/v8-tools.md) ^0.2.4

## Recent versions

- 0.2.4 (latest) — 2021-12-04
- 0.2.3 — 2021-12-04
- 0.2.2 — 2021-12-04
- 0.2.1 — 2021-12-04
- 0.2.0 — 2021-12-04
- 0.1.0 — 2021-12-03

## README

# @stack-tools/node-tools

`node-tools` provides utilites for printing and parsing node errors and their stacks.

`node-tools` is a shim on top of [v8-tools](https://github.com/stack-tools-js/stack-tools/tree/trunk/packages/stack-tools-v8) which expands the definition of `isInternalFrame` to include node internal modules like `fs`.

## Usage

```js
import getPackageName from 'get-package-name';
import {
  isInternalFrame as isNodeInternalFrame,
  parseErrors,
  cleanErrors,
  printErrors,
} from '@stack-tools/node-tools';

const internalPackages = new Set([
  'my-package',
  'test-runner',
]);

const isInternalFrame = (frame) => {
  return (
    isNodeInternalFrame(frame) ||
    (frame.site.type === 'path' &&
      internalPackages.has(getPackageName(frame.site.file)))
  );
};

try {
  doStuff();
} catch (e) {
  const errors = parseErrors(e);

  cleanErrors(errors, isInternalFrame);

  console.error(printErrors(errors));
}
```

---
_Source: https://npm.io/package/@stack-tools/node-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
