8000 1.3.6 · stacktracejs/error-stack-parser@04b2927 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04b2927

Browse files
committed
1.3.6
1 parent 03510dd commit 04b2927

6 files changed

+40
-14
lines changed

dist/error-stack-parser.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@
4343
}
4444
}
4545

46+
function _indexOf(array, target) {
47+
if (typeof Array.prototype.indexOf === 'function') {
48+
return array.indexOf(target);
49+
} else {
50+
for (var i = 0; i < array.length; i++) {
51+
if (array[i] === target) {
52+
return i;
53+
}
54+
}
55+
return -1;
56+
}
57+
}
58+
4659
return {
4760
/**
4861
* Given an Error object, extract the most information from it.
@@ -69,9 +82,9 @@
6982
return [urlLike];
7083
}
7184

72-
var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/g;
85+
var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/;
7386
var parts = regExp.exec(urlLike.replace(/[\(\)]/g, ''));
74-
return [parts[1], parts[2], parts[3]];
87+
return [parts[1], parts[2] || undefined, parts[3] || undefined];
7588
},
7689

7790
parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
@@ -87,7 +100,7 @@
87100
var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1);
88101
var locationParts = this.extractLocation(tokens.pop());
89102
var functionName = tokens.join(' ') || undefined;
90-
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
103+
var fileName = _indexOf(['eval', '<anonymous>'], locationParts[0]) > -1 ? undefined : locationParts[0];
91104

92105
return new StackFrame(functionName, undefined, fileName, locationParts[1], locationParts[2], line);
93106
}, this);

dist/error-stack-parser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0