Socket
Book a DemoInstallSign in
Socket

sourcemap-view

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sourcemap-view

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

latest
Source
npmnpm
Version
1.0.11
Version published
Maintainers
1
Created
Source

sourcemap-view

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

Installation

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

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.

Keywords

sourcemap

FAQs

Package last updated on 20 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.