# sourcemap-view

> View the original code from the sourcemap based on the error lineno and colno.

Latest version **1.0.11** (published 2020-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install sourcemap-view
pnpm add sourcemap-view
yarn add sourcemap-view
bun add sourcemap-view
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2020-11-20 |
| First published | 2020-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 10.16.0 |
| Dependencies | 1 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vilien |
| Maintainers | vilien |
| Keywords | sourcemap, sourcemap view, js error, original code |

## Links

- npm: https://www.npmjs.com/package/sourcemap-view
- Repository: https://github.com/vilien/sourcemap-view
- Homepage: https://github.com/vilien/sourcemap-view#readme
- Issues: https://github.com/vilien/sourcemap-view/issues
- npm.io page: https://npm.io/package/sourcemap-view

## Dependencies (1)

- [vlq](https://npm.io/package/vlq.md) ^1.0.1

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.11 (latest) — 2020-11-20
- 1.0.10 — 2020-08-22
- 1.0.9 — 2020-08-03
- 1.0.8 — 2020-07-07
- 1.0.7 — 2020-07-07
- 1.0.6 — 2020-07-03
- 1.0.5 — 2020-07-03
- 1.0.4 — 2020-07-03
- 1.0.3 — 2020-07-03
- 1.0.2 — 2020-07-02
- 1.0.1 — 2020-07-02

## README

# sourcemap-view

View the original code from the sourcemap based on the error lineno and colno. 



## Installation

```bash
npm install sourcemap-view
```



## Why would you want to do that?

When js throws an exception, we can view the original code without Chrome Console or Other.

```
Uncaught TypeError: Cannot read property 'a' of undefined
    at a.getSameError (app.07cd8612.js:1:3842)
    at app.07cd8612.js:1:3357
```



## Usage

```javascript
const fs = require('fs');
const sourcemapView = require('sourcemap-view');

const sourcemapRaw = fs.readFileSync('./app.07cd8612.js.map', { encoding: 'utf-8'});

const view = sourcemapView(JSON.parse(sourcemapRaw));

view(1, 3842); // { file: './HelloWorld.js', lineNo: 43, colNo: 29, name: 'a', content: <Original Code> }
view(1, 3357); // { file: './HelloWorld.js', lineNo: 35, colNo: 0, name: 'setTimeout', content: <Original Code> }
```



## License

[MIT](https://github.com/vilien/sourcemap-view/blob/master/LICENSE).

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