index.js 330 B

123456789101112131415161718
  1. 'use strict';
  2. module.exports = Error.captureStackTrace || function (error) {
  3. var container = new Error();
  4. Object.defineProperty(error, 'stack', {
  5. configurable: true,
  6. get: function getStack() {
  7. var stack = container.stack;
  8. Object.defineProperty(this, 'stack', {
  9. value: stack
  10. });
  11. return stack;
  12. }
  13. });
  14. };