error-stack-parser
Advanced tools
Comparing version 1.3.5 to 1.3.6
@@ -46,2 +46,15 @@ (function(root, factory) { | ||
function _indexOf(array, target) { | ||
if (typeof Array.prototype.indexOf === 'function') { | ||
return array.indexOf(target); | ||
} else { | ||
for (var i = 0; i < array.length; i++) { | ||
if (array[i] === target) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
} | ||
return { | ||
@@ -66,8 +79,3 @@ /** | ||
/** | ||
* Separate line and column numbers from a URL-like string. | ||
* | ||
* @param {String} urlLike | ||
* @return {Array} 3-tuple of URL, Line Number, and Column Number | ||
*/ | ||
// Separate line and column numbers from a string of the form: (URI:Line:Column) | ||
extractLocation: function ErrorStackParser$$extractLocation(urlLike) { | ||
@@ -79,11 +87,5 @@ // Fail-fast but return locations like "(native)" | ||
var locationParts = urlLike.replace(/[\(\)\s]/g, '').split(':'); | ||
var lastNumber = locationParts.pop(); | ||
var possibleNumber = locationParts[locationParts.length - 1]; | ||
if (!isNaN(parseFloat(possibleNumber)) && isFinite(possibleNumber)) { | ||
var lineNumber = locationParts.pop(); | ||
return [locationParts.join(':'), lineNumber, lastNumber]; | ||
} else { | ||
return [locationParts.join(':'), lastNumber, undefined]; | ||
} | ||
var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/; | ||
var parts = regExp.exec(urlLike.replace(/[\(\)]/g, '')); | ||
return [parts[1], parts[2] || undefined, parts[3] || undefined]; | ||
}, | ||
@@ -104,3 +106,3 @@ | ||
var functionName = tokens.join(' ') || undefined; | ||
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; | ||
var fileName = _indexOf(['eval', '<anonymous>'], locationParts[0]) > -1 ? undefined : locationParts[0]; | ||
@@ -107,0 +109,0 @@ return new StackFrame(functionName, undefined, fileName, locationParts[1], locationParts[2], line); |
@@ -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,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","<anonymous>"].indexOf(n[0])>-1?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.join("@")||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)}}}); | ||
!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,o){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!==o&&this.setSource(o)}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():"",o=e(this.getColumnNumber())?":"+this.getColumnNumber():"";return t+r+n+i+o}},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}function n(e,t){if("function"==typeof Array.prototype.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1}var i=/(^|@)\S+\:\d+/,o=/^\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(o))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+))?$/,r=t.exec(e.replace(/[\(\)]/g,""));return[r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(i){var a=r(i.stack.split("\n"),function(e){return!!e.match(o)},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),i=this.extractLocation(r.pop()),o=r.join(" ")||void 0,a=n(["eval","<anonymous>"],i[0])>-1?void 0:i[0];return new e(o,void 0,a,i[1],i[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.join("@")||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=[],o=2,a=n.length;a>o;o+=2){var s=r.exec(n[o]);s&&i.push(new e(void 0,void 0,s[2],s[1],void 0,n[o]))}return i},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),i=[],o=0,a=n.length;a>o;o+=2){var s=r.exec(n[o]);s&&i.push(new e(s[3]||void 0,void 0,s[2],s[1],void 0,n[o]))}return i},parseOpera11:function(n){var o=r(n.stack.split("\n"),function(e){return!!e.match(i)&&!e.match(/^Error created at/)},this);return t(o,function(t){var r,n=t.split("@"),i=this.extractLocation(n.pop()),o=n.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(r=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(a,s,i[0],i[1],i[2],t)},this)}}}); | ||
//# sourceMappingURL=error-stack-parser.min.js.map |
@@ -46,2 +46,15 @@ (function(root, factory) { | ||
function _indexOf(array, target) { | ||
if (typeof Array.prototype.indexOf === 'function') { | ||
return array.indexOf(target); | ||
} else { | ||
for (var i = 0; i < array.length; i++) { | ||
if (array[i] === target) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
} | ||
return { | ||
@@ -66,8 +79,3 @@ /** | ||
/** | ||
* Separate line and column numbers from a URL-like string. | ||
* | ||
* @param {String} urlLike | ||
* @return {Array} 3-tuple of URL, Line Number, and Column Number | ||
*/ | ||
// Separate line and column numbers from a string of the form: (URI:Line:Column) | ||
extractLocation: function ErrorStackParser$$extractLocation(urlLike) { | ||
@@ -79,11 +87,5 @@ // Fail-fast but return locations like "(native)" | ||
var locationParts = urlLike.replace(/[\(\)\s]/g, '').split(':'); | ||
var lastNumber = locationParts.pop(); | ||
var possibleNumber = locationParts[locationParts.length - 1]; | ||
if (!isNaN(parseFloat(possibleNumber)) && isFinite(possibleNumber)) { | ||
var lineNumber = locationParts.pop(); | ||
return [locationParts.join(':'), lineNumber, lastNumber]; | ||
} else { | ||
return [locationParts.join(':'), lastNumber, undefined]; | ||
} | ||
var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/; | ||
var parts = regExp.exec(urlLike.replace(/[\(\)]/g, '')); | ||
return [parts[1], parts[2] || undefined, parts[3] || undefined]; | ||
}, | ||
@@ -104,3 +106,3 @@ | ||
var functionName = tokens.join(' ') || undefined; | ||
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; | ||
var fileName = _indexOf(['eval', '<anonymous>'], locationParts[0]) > -1 ? undefined : locationParts[0]; | ||
@@ -107,0 +109,0 @@ return new StackFrame(functionName, undefined, fileName, locationParts[1], locationParts[2], line); |
@@ -5,7 +5,7 @@ { | ||
"maintainers": [ | ||
"Eric Wendelin <me@eriwen.com> (http://www.eriwen.com)", | ||
"Eric Wendelin <me@eriwen.com> (https://www.eriwen.com)", | ||
"Victor Homyakov <vkhomyackov@gmail.com> (https://github.com/victor-homyakov)", | ||
"Oliver Salzburg (https://github.com/oliversalzburg)" | ||
], | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"license": "Unlicense", | ||
@@ -38,2 +38,3 @@ "keywords": [ | ||
"jscs": "^2.9.0", | ||
"jsdoc-dash-template": "^1.2.0", | ||
"jshint": "^2.8.0", | ||
@@ -40,0 +41,0 @@ "karma": "~0.13", |
@@ -36,3 +36,3 @@ error-stack-parser.js - Extract meaning from JS Errors | ||
## Contributing | ||
Want to be listed as a *Contributor*? Start with the [Contributing Guide](CONTRIBUTING.md)! | ||
Want to be listed as a *Contributor*? Start with the [Contributing Guide](.github/CONTRIBUTING.md)! | ||
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
464385
9
406
25
1