Socket
Socket
Sign inDemoInstall

error-stack-parser

Package Overview
Dependencies
Maintainers
5
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 2.0.7 to 2.1.0

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 r(e){return e.charAt(0).toUpperCase()+e.substring(1)}function e(e){return function(){return this[e]}}var t=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],i=["fileName","functionName","source"],a=t.concat(n,i,["args"]);function s(e){if(e)for(var t=0;t<a.length;t++)void 0!==e[a[t]]&&this["set"+r(a[t])](e[a[t]])}s.prototype={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},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:n?n+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},s.fromString=function(e){var t,r,n,i=e.indexOf("("),a=e.lastIndexOf(")"),o=e.substring(0,i),i=e.substring(i+1,a).split(","),a=e.substring(a+1);return 0===a.indexOf("@")&&(t=(n=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,""))[1],r=n[2],n=n[3]),new s({functionName:o,args:i||void 0,fileName:t,lineNumber:r||void 0,columnNumber:n||void 0})};for(var o=0;o<t.length;o++)s.prototype["get"+r(t[o])]=e(t[o]),s.prototype["set"+r(t[o])]=function(t){return function(e){this[t]=Boolean(e)}}(t[o]);for(var c=0;c<n.length;c++)s.prototype["get"+r(n[c])]=e(n[c]),s.prototype["set"+r(n[c])]=function(r){return function(e){if(t=e,isNaN(parseFloat(t))||!isFinite(t))throw new TypeError(r+" must be a Number");var t;this[r]=Number(e)}}(n[c]);for(var u=0;u<i.length;u++)s.prototype["get"+r(i[u])]=e(i[u]),s.prototype["set"+r(i[u])]=function(t){return function(e){this[t]=String(e)}}(i[u]);return s}),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(s){"use strict";var t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,n=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))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];e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(e){var t=(r=(e=-1<e.indexOf("(eval ")?e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""):e).replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,"")).match(/ (\(.+\)$)/),r=t?r.replace(t[0],""):r,n=this.extractLocation(t?t[1]:r),t=t&&r||void 0,r=-1<["eval","<anonymous>"].indexOf(n[0])?void 0:n[0];return new s({functionName:t,fileName:r,lineNumber:n[1],columnNumber:n[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(n)},this).map(function(e){if(-1===(e=-1<e.indexOf(" > eval")?e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1"):e).indexOf("@")&&-1===e.indexOf(":"))return new s({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),r=r&&r[1]?r[1]:void 0,t=this.extractLocation(e.replace(t,""));return new s({functionName:r,fileName:t[0],lineNumber:t[1],columnNumber:t[2],source:e})},this)},parseOpera:function(e){return!e.stacktrace||-1<e.message.indexOf("\n")&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[],i=2,a=r.length;i<a;i+=2){var o=t.exec(r[i]);o&&n.push(new s({fileName:o[2],lineNumber:o[1],source:r[i]}))}return n},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[],i=0,a=r.length;i<a;i+=2){var o=t.exec(r[i]);o&&n.push(new s({functionName:o[3]||void 0,fileName:o[2],lineNumber:o[1],source:r[i]}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),n=t.shift()||"",t=n.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,i=void 0===(i=n.match(/\(([^)]*)\)/)?n.replace(/^[^(]+\(([^)]*)\)$/,"$1"):i)||"[arguments not available]"===i?void 0:i.split(",");return new s({functionName:t,args:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},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 e.charAt(0).toUpperCase()+e.substring(1)}function t(e){return function(){return this[e]}}var r=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],i=["fileName","functionName","source"],a=r.concat(n,i,["args"],["evalOrigin"]);function o(t){if(t)for(var r=0;r<a.length;r++)void 0!==t[a[r]]&&this["set"+e(a[r])](t[a[r]])}o.prototype={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},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof o)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new o(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:n?n+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},o.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),n=e.substring(0,t),i=e.substring(t+1,r).split(","),a=e.substring(r+1);if(0===a.indexOf("@"))var s=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,""),c=s[1],u=s[2],f=s[3];return new o({functionName:n,args:i||void 0,fileName:c,lineNumber:u||void 0,columnNumber:f||void 0})};for(var s=0;s<r.length;s++)o.prototype["get"+e(r[s])]=t(r[s]),o.prototype["set"+e(r[s])]=function(e){return function(t){this[e]=Boolean(t)}}(r[s]);for(var c=0;c<n.length;c++)o.prototype["get"+e(n[c])]=t(n[c]),o.prototype["set"+e(n[c])]=function(e){return function(t){if(r=t,isNaN(parseFloat(r))||!isFinite(r))throw new TypeError(e+" must be a Number");var r;this[e]=Number(t)}}(n[c]);for(var u=0;u<i.length;u++)o.prototype["get"+e(i[u])]=t(i[u]),o.prototype["set"+e(i[u])]=function(e){return function(t){this[e]=String(t)}}(i[u]);return o}),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,n=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))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=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||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,"(").replace(/^.*?\s+/,""),n=r.match(/ (\(.+\)$)/);r=n?r.replace(n[0],""):r;var i=this.extractLocation(n?n[1]:r),a=n&&r||void 0,o=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new e({functionName:a,fileName:o,lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(n)},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({functionName:t});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(r),i=n&&n[1]?n[1]:void 0,a=this.extractLocation(t.replace(r,""));return new e({functionName:i,fileName:a[0],lineNumber:a[1],columnNumber:a[2],source: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;a<o;a+=2){var s=r.exec(n[a]);s&&i.push(new e({fileName:s[2],lineNumber:s[1],source: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;a<o;a+=2){var s=r.exec(n[a]);s&&i.push(new e({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:n[a]}))}return i},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,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({functionName:o,args:s,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:t})},this)}}});
//# sourceMappingURL=error-stack-parser.min.js.map

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

// Type definitions for ErrorStackParser v2.0.0
// Type definitions for ErrorStackParser v2.1.0
// Project: https://github.com/stacktracejs/error-stack-parser

@@ -6,5 +6,6 @@ // Definitions by: Eric Wendelin <https://www.eriwen.com>

import StackFrame = require("stackframe");
import StackFrame from "stackframe";
declare module ErrorStackParser {
declare namespace ErrorStackParser {
export type {StackFrame};
/**

@@ -19,2 +20,2 @@ * Given an Error object, extract the most information from it.

export = ErrorStackParser;
export default ErrorStackParser;

@@ -10,3 +10,3 @@ {

],
"version": "2.0.7",
"version": "2.1.0",
"license": "MIT",

@@ -21,3 +21,3 @@ "keywords": [

"dependencies": {
"stackframe": "^1.1.1"
"stackframe": "^1.3.0"
},

@@ -29,17 +29,17 @@ "repository": {

"devDependencies": {
"eslint": "^6.8.0",
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"karma": "^4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.1",
"eslint": "^8.17.0",
"jasmine": "^4.1.0",
"jasmine-core": "^4.1.1",
"karma": "^6.3.20",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage": "^2.2.0",
"karma-coveralls": "^2.1.0",
"karma-firefox-launcher": "^1.2.0",
"karma-firefox-launcher": "^2.1.2",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^1.1.2",
"karma-jasmine": "^4.0.2",
"karma-opera-launcher": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^2.0.2",
"karma-spec-reporter": "0.0.32",
"karma-sauce-launcher": "^4.3.6",
"karma-spec-reporter": "^0.0.34",
"uglify-es": "^3.3.9"

@@ -62,3 +62,3 @@ },

"test": "karma start karma.conf.js --single-run",
"test-pr": "karma start karma.conf.js --single-run --browsers Firefox,Chrome_Travis",
"test-pr": "karma start karma.conf.js --single-run --browsers Firefox,Chrome_No_Sandbox",
"test-ci": "karma start karma.conf.ci.js --single-run",

@@ -65,0 +65,0 @@ "prepare": "cp error-stack-parser.js dist/ && uglifyjs node_modules/stackframe/stackframe.js error-stack-parser.js -o dist/error-stack-parser.min.js --compress --mangle --source-map \"url=error-stack-parser.min.js.map\""

error-stack-parser.js - Extract meaning from JS Errors
===============
[![Build Status](https://img.shields.io/travis/stacktracejs/error-stack-parser/master.svg?style=flat-square)](https://travis-ci.org/stacktracejs/error-stack-parser)
[![Build Status](https://img.shields.io/github/workflow/status/stacktracejs/error-stack-parser/Continuous%20Integration/master?logo=github&style=flat-square)](https://github.com/stacktracejs/error-stack-parser/actions?query=workflow%3AContinuous+Integration+branch%3Amaster)
[![Coverage Status](https://img.shields.io/coveralls/stacktracejs/error-stack-parser.svg?style=flat-square)](https://coveralls.io/r/stacktracejs/error-stack-parser?branch=master)

@@ -5,0 +5,0 @@ [![GitHub license](https://img.shields.io/github/license/stacktracejs/error-stack-parser.svg?style=flat-square)](https://opensource.org/licenses/MIT)

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