MCPcopy
hub / github.com/Mottie/Keyboard / extractStacktrace

Function extractStacktrace

testing/qunit-2.9.2.js:2539–2563  ·  view source on GitHub ↗
(e, offset)

Source from the content-addressed store, hash-verified

2537 var fileName = (sourceFromStacktrace(0) || "").replace(/(:\d+)+\)?/, "").replace(/.+\//, "");
2538
2539 function extractStacktrace(e, offset) {
2540 offset = offset === undefined ? 4 : offset;
2541
2542 var stack, include, i;
2543
2544 if (e && e.stack) {
2545 stack = e.stack.split("\n");
2546 if (/^error$/i.test(stack[0])) {
2547 stack.shift();
2548 }
2549 if (fileName) {
2550 include = [];
2551 for (i = offset; i < stack.length; i++) {
2552 if (stack[i].indexOf(fileName) !== -1) {
2553 break;
2554 }
2555 include.push(stack[i]);
2556 }
2557 if (include.length) {
2558 return include.join("\n");
2559 }
2560 }
2561 return stack[offset];
2562 }
2563 }
2564
2565 function sourceFromStacktrace(offset) {
2566 var error = new Error();

Callers 3

sourceFromStacktraceFunction · 0.85
qunit-2.9.2.jsFile · 0.85
runHookFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected