main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
656 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var uncurryThis = require('../internals/function-uncurry-this');
|
---|
3 |
|
---|
4 | var $Error = Error;
|
---|
5 | var replace = uncurryThis(''.replace);
|
---|
6 |
|
---|
7 | var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
|
---|
8 | // eslint-disable-next-line redos/no-vulnerable, sonarjs/slow-regex -- safe
|
---|
9 | var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
|
---|
10 | var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
|
---|
11 |
|
---|
12 | module.exports = function (stack, dropEntries) {
|
---|
13 | if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
|
---|
14 | while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
|
---|
15 | } return stack;
|
---|
16 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.