UNPKG

356 BJavaScriptView Raw
1'use strict';
2
3module.exports = function () {
4 if (!Error.prototype.toJSON) {
5 Object.defineProperty(Error.prototype, 'toJSON', {
6 value: function () {
7 const alt = {};
8
9 Object.getOwnPropertyNames(this).forEach(function (key) {
10 alt[key] = this[key];
11 }, this);
12
13 return alt;
14 },
15 configurable: true,
16 writable: true,
17 });
18 }
19};