source: node_modules/core-js-pure/internals/error-stack-clear.js

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
Line 
1'use strict';
2var uncurryThis = require('../internals/function-uncurry-this');
3
4var $Error = Error;
5var replace = uncurryThis(''.replace);
6
7var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
8// eslint-disable-next-line redos/no-vulnerable -- safe
9var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
10var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
11
12module.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.