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

error-stack-parser

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

error-stack-parser - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

46

dist/error-stack-parser.js

@@ -20,2 +20,28 @@ (function (root, factory) {

function _map(array, fn, thisArg) {
if (typeof Array.prototype.map === 'function') {
return array.map(fn, thisArg);
} else {
var output = new Array(array.length);
for (var i = 0; i < array.length; i++) {
output[i] = fn.call(thisArg, array[i]);
}
return output;
}
}
function _filter(array, fn, thisArg) {
if (typeof Array.prototype.filter === 'function') {
return array.filter(fn, thisArg);
} else {
var output = [];
for (var i = 0; i < array.length; i++) {
if (fn.call(thisArg, array[i])) {
output.push(array[i]);
}
}
return output;
}
}
return {

@@ -32,3 +58,3 @@ /**

return this.parseV8OrIE(error);
} else if (error.stack && error.stack.match(FIREFOX_SAFARI_STACK_REGEXP)) {
} else if (error.stack) {
return this.parseFFOrSafari(error);

@@ -63,5 +89,7 @@ } else {

parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
return error.stack.split('\n').filter(function (line) {
var filtered = _filter(error.stack.split('\n'), function (line) {
return !!line.match(CHROME_IE_STACK_REGEXP);
}, this).map(function (line) {
}, this);
return _map(filtered, function (line) {
if (line.indexOf('(eval ') > -1) {

@@ -81,5 +109,7 @@ // Throw away eval information until we implement stacktrace.js/stackframe#8

parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
return error.stack.split('\n').filter(function (line) {
var filtered = _filter(error.stack.split('\n'), function (line) {
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
}, this).map(function (line) {
}, this);
return _map(filtered, function (line) {
// Throw away eval information until we implement stacktrace.js/stackframe#8

@@ -145,6 +175,8 @@ if (line.indexOf(' > eval') > -1) {

parseOpera11: function ErrorStackParser$$parseOpera11(error) {
return error.stack.split('\n').filter(function (line) {
var filtered = _filter(error.stack.split('\n'), function (line) {
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
!line.match(/^Error created at/);
}, this).map(function (line) {
}, this);
return _map(filtered, function (line) {
var tokens = line.split('@');

@@ -151,0 +183,0 @@ var locationParts = this.extractLocation(tokens.pop());

2

dist/error-stack-parser.min.js

@@ -1,2 +0,2 @@

!function(e,t){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],t):"object"==typeof exports?module.exports=t():e.StackFrame=t()}(this,function(){"use strict";function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e,t,r,i,n,a){void 0!==e&&this.setFunctionName(e),void 0!==t&&this.setArgs(t),void 0!==r&&this.setFileName(r),void 0!==i&&this.setLineNumber(i),void 0!==n&&this.setColumnNumber(n),void 0!==a&&this.setSource(a)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(e){this.functionName=String(e)},getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getFileName:function(){return this.fileName},setFileName:function(e){this.fileName=String(e)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(e){this.source=String(e)},toString:function(){var t=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",i=this.getFileName()?"@"+this.getFileName():"",n=e(this.getLineNumber())?":"+this.getLineNumber():"",a=e(this.getColumnNumber())?":"+this.getColumnNumber():"";return t+r+i+n+a}},t}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("error-stack-parser",["stackframe"],t):"object"==typeof exports?module.exports=t(require("stackframe")):e.ErrorStackParser=t(e.StackFrame)}(this,function(e){"use strict";var t=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;return{parse:function(e){if("undefined"!=typeof e.stacktrace||"undefined"!=typeof e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack&&e.stack.match(t))return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=e.replace(/[\(\)\s]/g,"").split(":"),r=t.pop(),i=t[t.length-1];if(!isNaN(parseFloat(i))&&isFinite(i)){var n=t.pop();return[t.join(":"),n,r]}return[t.join(":"),r,void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),i=this.extractLocation(r.pop()),n=r.join(" ")||void 0,a="eval"===i[0]?void 0:i[0];return new e(n,void 0,a,i[1],i[2],t)},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e(t);var r=t.split("@"),i=this.extractLocation(r.pop()),n=r.shift()||void 0;return new e(n,void 0,i[0],i[1],i[2],t)},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],a=2,s=i.length;s>a;a+=2){var o=r.exec(i[a]);o&&n.push(new e(void 0,void 0,o[2],o[1],void 0,i[a]))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],a=0,s=i.length;s>a;a+=2){var o=r.exec(i[a]);o&&n.push(new e(o[3]||void 0,void 0,o[2],o[1],void 0,i[a]))}return n},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.split("@"),n=this.extractLocation(i.pop()),a=i.shift()||"",s=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(r=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var o=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(s,o,n[0],n[1],n[2],t)},this)}}});
!function(e,t){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],t):"object"==typeof exports?module.exports=t():e.StackFrame=t()}(this,function(){"use strict";function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e,t,r,n,i,a){void 0!==e&&this.setFunctionName(e),void 0!==t&&this.setArgs(t),void 0!==r&&this.setFileName(r),void 0!==n&&this.setLineNumber(n),void 0!==i&&this.setColumnNumber(i),void 0!==a&&this.setSource(a)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(e){this.functionName=String(e)},getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getFileName:function(){return this.fileName},setFileName:function(e){this.fileName=String(e)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(e){this.source=String(e)},toString:function(){var t=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",n=this.getFileName()?"@"+this.getFileName():"",i=e(this.getLineNumber())?":"+this.getLineNumber():"",a=e(this.getColumnNumber())?":"+this.getColumnNumber():"";return t+r+n+i+a}},t}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("error-stack-parser",["stackframe"],t):"object"==typeof exports?module.exports=t(require("stackframe")):e.ErrorStackParser=t(e.StackFrame)}(this,function(e){"use strict";function t(e,t,r){if("function"==typeof Array.prototype.map)return e.map(t,r);for(var n=new Array(e.length),i=0;i<e.length;i++)n[i]=t.call(r,e[i]);return n}function r(e,t,r){if("function"==typeof Array.prototype.filter)return e.filter(t,r);for(var n=[],i=0;i<e.length;i++)t.call(r,e[i])&&n.push(e[i]);return n}var n=/(^|@)\S+\:\d+/,i=/^\s*at .*(\S+\:\d+|\(native\))/m,a=/^(eval@)?(\[native code\])?$/;return{parse:function(e){if("undefined"!=typeof e.stacktrace||"undefined"!=typeof e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(i))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=e.replace(/[\(\)\s]/g,"").split(":"),r=t.pop(),n=t[t.length-1];if(!isNaN(parseFloat(n))&&isFinite(n)){var i=t.pop();return[t.join(":"),i,r]}return[t.join(":"),r,void 0]},parseV8OrIE:function(n){var a=r(n.stack.split("\n"),function(e){return!!e.match(i)},this);return t(a,function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(r.pop()),i=r.join(" ")||void 0,a="eval"===n[0]?void 0:n[0];return new e(i,void 0,a,n[1],n[2],t)},this)},parseFFOrSafari:function(n){var i=r(n.stack.split("\n"),function(e){return!e.match(a)},this);return t(i,function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e(t);var r=t.split("@"),n=this.extractLocation(r.pop()),i=r.shift()||void 0;return new e(i,void 0,n[0],n[1],n[2],t)},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),i=[],a=2,o=n.length;o>a;a+=2){var s=r.exec(n[a]);s&&i.push(new e(void 0,void 0,s[2],s[1],void 0,n[a]))}return i},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),i=[],a=0,o=n.length;o>a;a+=2){var s=r.exec(n[a]);s&&i.push(new e(s[3]||void 0,void 0,s[2],s[1],void 0,n[a]))}return i},parseOpera11:function(i){var a=r(i.stack.split("\n"),function(e){return!!e.match(n)&&!e.match(/^Error created at/)},this);return t(a,function(t){var r,n=t.split("@"),i=this.extractLocation(n.pop()),a=n.shift()||"",o=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(r=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(o,s,i[0],i[1],i[2],t)},this)}}});
//# sourceMappingURL=error-stack-parser.min.js.map

@@ -20,2 +20,28 @@ (function (root, factory) {

function _map(array, fn, thisArg) {
if (typeof Array.prototype.map === 'function') {
return array.map(fn, thisArg);
} else {
var output = new Array(array.length);
for (var i = 0; i < array.length; i++) {
output[i] = fn.call(thisArg, array[i]);
}
return output;
}
}
function _filter(array, fn, thisArg) {
if (typeof Array.prototype.filter === 'function') {
return array.filter(fn, thisArg);
} else {
var output = [];
for (var i = 0; i < array.length; i++) {
if (fn.call(thisArg, array[i])) {
output.push(array[i]);
}
}
return output;
}
}
return {

@@ -62,5 +88,7 @@ /**

parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
return error.stack.split('\n').filter(function (line) {
var filtered = _filter(error.stack.split('\n'), function (line) {
return !!line.match(CHROME_IE_STACK_REGEXP);
}, this).map(function (line) {
}, this);
return _map(filtered, function (line) {
if (line.indexOf('(eval ') > -1) {

@@ -80,5 +108,7 @@ // Throw away eval information until we implement stacktrace.js/stackframe#8

parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
return error.stack.split('\n').filter(function (line) {
var filtered = _filter(error.stack.split('\n'), function (line) {
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
}, this).map(function (line) {
}, this);
return _map(filtered, function (line) {
// Throw away eval information until we implement stacktrace.js/stackframe#8

@@ -144,6 +174,8 @@ if (line.indexOf(' > eval') > -1) {

parseOpera11: function ErrorStackParser$$parseOpera11(error) {
return error.stack.split('\n').filter(function (line) {
var filtered = _filter(error.stack.split('\n'), function (line) {
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
!line.match(/^Error created at/);
}, this).map(function (line) {
}, this);
return _map(filtered, function (line) {
var tokens = line.split('@');

@@ -150,0 +182,0 @@ var locationParts = this.extractLocation(tokens.pop());

@@ -9,4 +9,4 @@ {

],
"version": "1.3.2",
"license": "SEE LICENSE IN LICENSE",
"version": "1.3.3",
"license": "Unlicense",
"keywords": [

@@ -18,3 +18,3 @@ "stacktrace",

],
"homepage": "http://www.stacktracejs.com",
"homepage": "https://www.stacktracejs.com",
"dependencies": {

@@ -49,2 +49,3 @@ "stackframe": "^0.3.1"

"karma-sauce-launcher": "^0.3.0",
"karma-spec-reporter": "0.0.23",
"run-sequence": "^1.1.5"

@@ -66,2 +67,1 @@ },

}

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