e82a7c4327513ce73c87a9ac4e08bb843682948303d97024e7fab85948783d1f05829acc8831a1340b5c72c8d00dc77741e27b46b47e031f166f5788b39626 636 B

12345678910111213141516
  1. 'use strict';
  2. var uncurryThis = require('../internals/function-uncurry-this');
  3. var $Error = Error;
  4. var replace = uncurryThis(''.replace);
  5. var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
  6. // eslint-disable-next-line redos/no-vulnerable -- safe
  7. var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
  8. var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
  9. module.exports = function (stack, dropEntries) {
  10. if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
  11. while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
  12. } return stack;
  13. };