error-stack-parser
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -93,5 +93,6 @@ (function(root, factory) { | ||
} else { | ||
var tokens = line.split('@'); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.join('@') || undefined; | ||
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/; | ||
var matches = line.match(functionNameRegex); | ||
var functionName = matches && matches[1] ? matches[1] : undefined; | ||
var locationParts = this.extractLocation(line.replace(functionNameRegex, '')); | ||
@@ -98,0 +99,0 @@ return new StackFrame({ |
@@ -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){return e[0].toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}function n(e){if(e instanceof Object)for(var r=i.concat(a.concat(o.concat(s))),n=0;n<r.length;n++)e.hasOwnProperty(r[n])&&void 0!==e[r[n]]&&this["set"+t(r[n])](e[r[n]])}var i=["isConstructor","isEval","isNative","isToplevel"],a=["columnNumber","lineNumber"],o=["fileName","functionName","source"],s=["args"];n.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 n)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new n(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}};for(var c=0;c<i.length;c++)n.prototype["get"+t(i[c])]=r(i[c]),n.prototype["set"+t(i[c])]=function(e){return function(t){this[e]=Boolean(t)}}(i[c]);for(var u=0;u<a.length;u++)n.prototype["get"+t(a[u])]=r(a[u]),n.prototype["set"+t(a[u])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(a[u]);for(var f=0;f<o.length;f++)n.prototype["get"+t(o[f])]=r(o[f]),n.prototype["set"+t(o[f])]=function(e){return function(t){this[e]=String(t)}}(o[f]);return n}),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("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)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];var t=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/,r=t.exec(e.replace(/[\(\)]/g,""));return[r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(t){var n=t.stack.split("\n").filter(function(e){return!!e.match(r)},this);return n.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),n=this.extractLocation(r.pop()),i=r.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new e({functionName:i,fileName:a,lineNumber:n[1],columnNumber:n[2],source:t})},this)},parseFFOrSafari:function(t){var r=t.stack.split("\n").filter(function(e){return!e.match(n)},this);return r.map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),t.indexOf("@")===-1&&t.indexOf(":")===-1)return new e({functionName:t});var r=t.split("@"),n=this.extractLocation(r.pop()),i=r.join("@")||void 0;return new e({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[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){var n=r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this);return n.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)}}}); | ||
!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){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}function n(e){if(e instanceof Object)for(var r=0;r<c.length;r++)e.hasOwnProperty(c[r])&&void 0!==e[c[r]]&&this["set"+t(c[r])](e[c[r]])}var i=["isConstructor","isEval","isNative","isToplevel"],a=["columnNumber","lineNumber"],o=["fileName","functionName","source"],s=["args"],c=i.concat(a,o,s);n.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 n)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new n(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}};for(var u=0;u<i.length;u++)n.prototype["get"+t(i[u])]=r(i[u]),n.prototype["set"+t(i[u])]=function(e){return function(t){this[e]=Boolean(t)}}(i[u]);for(var f=0;f<a.length;f++)n.prototype["get"+t(a[f])]=r(a[f]),n.prototype["set"+t(a[f])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(a[f]);for(var p=0;p<o.length;p++)n.prototype["get"+t(o[p])]=r(o[p]),n.prototype["set"+t(o[p])]=function(e){return function(t){this[e]=String(t)}}(o[p]);return n}),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("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)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];var t=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/,r=t.exec(e.replace(/[\(\)]/g,""));return[r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(t){var n=t.stack.split("\n").filter(function(e){return!!e.match(r)},this);return n.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),n=this.extractLocation(r.pop()),i=r.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new e({functionName:i,fileName:a,lineNumber:n[1],columnNumber:n[2],source:t})},this)},parseFFOrSafari:function(t){var r=t.stack.split("\n").filter(function(e){return!e.match(n)},this);return r.map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),t.indexOf("@")===-1&&t.indexOf(":")===-1)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){var n=r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this);return n.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 |
@@ -93,5 +93,6 @@ (function(root, factory) { | ||
} else { | ||
var tokens = line.split('@'); | ||
var locationParts = this.extractLocation(tokens.pop()); | ||
var functionName = tokens.join('@') || undefined; | ||
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/; | ||
var matches = line.match(functionNameRegex); | ||
var functionName = matches && matches[1] ? matches[1] : undefined; | ||
var locationParts = this.extractLocation(line.replace(functionNameRegex, '')); | ||
@@ -98,0 +99,0 @@ return new StackFrame({ |
@@ -7,5 +7,6 @@ { | ||
"Victor Homyakov <vkhomyackov@gmail.com> (https://github.com/victor-homyakov)", | ||
"Oliver Salzburg (https://github.com/oliversalzburg)" | ||
"Oliver Salzburg (https://github.com/oliversalzburg)", | ||
"Ben Gourley (https://github.com/bengourley)" | ||
], | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"license": "MIT", | ||
@@ -20,3 +21,3 @@ "keywords": [ | ||
"dependencies": { | ||
"stackframe": "^1.0.3" | ||
"stackframe": "^1.0.4" | ||
}, | ||
@@ -29,3 +30,3 @@ "repository": { | ||
"colors": "^1.1.2", | ||
"del": "^1.2.1", | ||
"del": "^3.0.0", | ||
"gulp": "^3.9.0", | ||
@@ -35,20 +36,20 @@ "gulp-concat": "^2.6.0", | ||
"gulp-jshint": "^2.0.0", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-sourcemaps": "^1.12.0", | ||
"gulp-uglify": "^1.5.1", | ||
"jasmine": "^2.3.2", | ||
"jasmine-core": "^2.3.4", | ||
"jasmine": "^2.7.0", | ||
"jasmine-core": "^2.7.0", | ||
"jscs": "^2.9.0", | ||
"jsdoc-dash-template": "^1.2.0", | ||
"jshint": "^2.8.0", | ||
"karma": "~0.13", | ||
"karma-chrome-launcher": "^0.1.12", | ||
"karma-coverage": "^0.5.3", | ||
"karma-firefox-launcher": "^0.1.7", | ||
"karma-ie-launcher": "^0.2.0", | ||
"karma-jasmine": "^0.3.6", | ||
"karma-opera-launcher": "^0.1.0", | ||
"karma-phantomjs2-launcher": "^0.3.2", | ||
"karma-safari-launcher": "^0.1.1", | ||
"karma-sauce-launcher": "^0.3.0", | ||
"karma-spec-reporter": "0.0.23", | ||
"jsdoc-dash-template": "^2.0.1", | ||
"jshint": "^2.9.5", | ||
"karma": "^1.7.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-jasmine": "^1.1.0", | ||
"karma-opera-launcher": "^1.0.0", | ||
"karma-phantomjs2-launcher": "^0.5.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-sauce-launcher": "^1.1.0", | ||
"karma-spec-reporter": "^0.0.31", | ||
"run-sequence": "^1.1.5" | ||
@@ -55,0 +56,0 @@ }, |
@@ -10,2 +10,3 @@ error-stack-parser.js - Extract meaning from JS Errors | ||
[![code of conduct](https://img.shields.io/badge/code%20of-conduct-lightgrey.svg?style=flat-square&colorB=ff69b4)](http://todogroup.org/opencodeofconduct/#stacktrace.js/me@eriwen.com) | ||
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/error-stack-parser/badge)](https://www.jsdelivr.com/package/npm/error-stack-parser) | ||
@@ -12,0 +13,0 @@ Simple, cross-browser [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) parser. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
411
45
48056
9
Updatedstackframe@^1.0.4