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

sourcemapped-stacktrace

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sourcemapped-stacktrace - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

2

package.json
{
"name": "sourcemapped-stacktrace",
"version": "1.1.3",
"version": "1.1.4",
"homepage": "https://github.com/novocaine/sourcemapped-stacktrace",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

@@ -34,3 +34,3 @@ This is a simple module for applying source maps to JS stack traces in the browser.

### mapStackTrace(stack, done)
### mapStackTrace(stack, done [, opts])

@@ -41,7 +41,12 @@ Re-map entries in a stacktrace using sourcemaps if available.

*stack*: Array of strings from the browser's stack representation. Currently only Chrome
- *stack*: Array of strings from the browser's stack representation. Currently only Chrome
and Firefox format is supported.
*done*: Callback invoked with the transformed stacktrace (an Array of Strings) passed as the first argument
- *done*: Callback invoked with the transformed stacktrace (an Array of Strings) passed as the first argument
- *opts*: Optional options object containing:
- *filter*: Function that filters each stackTrace line.
It is invoked with _(line)_ and should return truthy/ falsy value.
Sources which do not pass the filter won't be processed.
## Example

@@ -58,2 +63,7 @@

console.log(mappedStack.join("\n"));
}, {
filter: function (line) {
// process only sources containing `spec.js`
return /(spec\.js)/.test(line);
}
});

@@ -60,0 +70,0 @@ }

@@ -15,3 +15,3 @@ /*

// which includes gear for generating source maps that we don't need
define(['./node_modules/source-map/lib/source-map-consumer'],
define(['source-map/lib/source-map-consumer'],
function(source_map_consumer) {

@@ -27,5 +27,9 @@ /**

* argument
* @param {Object} [opts] - Optional options object.
* @param {Function} [opts.filter] - Filter function applied to each stackTrace line.
* Lines which do not pass the filter won't be processesd.
*/
var mapStackTrace = function(stack, done) {
var mapStackTrace = function(stack, done, opts) {
var lines;
var line;
var mapForUri = {};

@@ -59,3 +63,6 @@ var rows = {};

for (var i=0; i < lines.length; i++) {
fields = lines[i].match(regex);
line = lines[i];
if ( opts && opts.filter && !opts.filter(line) ) continue;
fields = line.match(regex);
if (fields && fields.length === expected_fields) {

@@ -120,6 +127,6 @@ rows[i] = fields;

var embeddedSourceMap = mapUri.match("data:application/json;base64,(.*)");
var embeddedSourceMap = mapUri.match("data:application/json;(charset=[^;]+;)?base64,(.*)");
if (embeddedSourceMap && embeddedSourceMap[1]) {
this.mapForUri[uri] = atob(embeddedSourceMap[1]);
if (embeddedSourceMap && embeddedSourceMap[2]) {
this.mapForUri[uri] = atob(embeddedSourceMap[2]);
this.done(this.mapForUri);

@@ -126,0 +133,0 @@ } else {

@@ -0,0 +0,0 @@ module.exports = {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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