Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stacktrace-gps

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stacktrace-gps

Turns partial code location into precise code location

  • 3.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7M
decreased by-1.6%
Maintainers
2
Weekly downloads
 
Created

What is stacktrace-gps?

The stacktrace-gps npm package is a library for enhancing JavaScript stack traces. It provides functionalities to map minified stack traces back to their original source locations, retrieve function names, and resolve source maps. This is particularly useful for debugging and error tracking in production environments where code is often minified.

What are stacktrace-gps's main functionalities?

Pinpointing Original Source Locations

This feature allows you to pinpoint the original source location of a stack frame. The `pinpoint` method takes a stack frame object and returns a promise that resolves to the original position in the source code.

const StackTraceGPS = require('stacktrace-gps');
const stackFrame = { fileName: 'http://example.com/app.min.js', lineNumber: 1, columnNumber: 32 };
const gps = new StackTraceGPS();
gps.pinpoint(stackFrame).then(function(originalPosition) {
  console.log(originalPosition);
}).catch(function(error) {
  console.error(error);
});

Getting Function Names

This feature allows you to retrieve the function name from a stack frame. The `findFunctionName` method takes a stack frame object and returns a promise that resolves to the function name.

const StackTraceGPS = require('stacktrace-gps');
const stackFrame = { fileName: 'http://example.com/app.min.js', lineNumber: 1, columnNumber: 32 };
const gps = new StackTraceGPS();
gps.findFunctionName(stackFrame).then(function(functionName) {
  console.log(functionName);
}).catch(function(error) {
  console.error(error);
});

Resolving Source Maps

This feature allows you to resolve source maps for a given stack frame. The `getMappedLocation` method takes a stack frame object and returns a promise that resolves to the mapped location in the source code.

const StackTraceGPS = require('stacktrace-gps');
const stackFrame = { fileName: 'http://example.com/app.min.js', lineNumber: 1, columnNumber: 32 };
const gps = new StackTraceGPS();
gps.getMappedLocation(stackFrame).then(function(mappedLocation) {
  console.log(mappedLocation);
}).catch(function(error) {
  console.error(error);
});

Other packages similar to stacktrace-gps

Keywords

FAQs

Package last updated on 18 Sep 2019

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc