hamjest
Version:
A library of composable matchers for defining meaningful and readable assertions in JavaScript.
20 lines (16 loc) • 356 B
JavaScript
;
module.exports = function () {
if (!Error.prototype.toJSON) {
Object.defineProperty(Error.prototype, 'toJSON', {
value: function () {
const alt = {};
Object.getOwnPropertyNames(this).forEach(function (key) {
alt[key] = this[key];
}, this);
return alt;
},
configurable: true,
writable: true,
});
}
};