main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
636 bytes
|
Rev | Line | |
---|
[d24f17c] | 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 -- 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.