Comparing version 2.2.0 to 2.3.0
Changelog | ||
========= | ||
## 2.3.0 (2018-03-01) | ||
### Enhancements | ||
* Improve serialization of class-based data structures which expose a `.toJSON()` method [#134](https://github.com/bugsnag/bugsnag-node/pull/134) | ||
## 2.2.0 (2018-02-22) | ||
@@ -5,0 +11,0 @@ |
module.exports = { | ||
name: "Bugsnag Node Notifier", | ||
version: "2.2.0", | ||
version: "2.3.0", | ||
url: "https://github.com/bugsnag/bugsnag-node" | ||
} |
@@ -67,13 +67,14 @@ "use strict"; | ||
var copy = obj; | ||
var type = Utils.typeOf(obj); | ||
var orig = obj | ||
var maybeJsonified = (Utils.typeOf(obj) === "object" && typeof obj.toJSON === 'function') ? obj.toJSON() : obj; | ||
var type = Utils.typeOf(maybeJsonified); | ||
if (type === "object") { | ||
copy = {}; | ||
clonedSources.push(obj); | ||
var copy = {}; | ||
clonedSources.push(orig); | ||
clonedResults.push(copy); | ||
Object.keys(obj).forEach(function (key) { | ||
var val = obj[key]; | ||
if (!Utils.checkOwnProperty(obj, key)) { | ||
Object.keys(maybeJsonified).forEach(function (key) { | ||
var val = maybeJsonified[key]; | ||
if (!Utils.checkOwnProperty(maybeJsonified, key)) { | ||
return; | ||
@@ -94,10 +95,13 @@ } | ||
}); | ||
return copy; | ||
} else if (type === "array") { | ||
copy = []; | ||
clonedSources.push(obj); | ||
var copy = []; | ||
clonedSources.push(maybeJsonified); | ||
clonedResults.push(copy); | ||
for (var i = 0; i < obj.length; ++i) { | ||
copy.push(Utils.cloneObject(obj[i], options)); | ||
for (var i = 0; i < maybeJsonified.length; ++i) { | ||
copy.push(Utils.cloneObject(maybeJsonified[i], options)); | ||
} | ||
} else { | ||
copy = maybeJsonified | ||
} | ||
@@ -104,0 +108,0 @@ |
{ | ||
"name": "bugsnag", | ||
"description": "Bugsnag notifier for node.js scripts", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"main": "./lib/bugsnag.js", | ||
@@ -17,2 +17,3 @@ "typings": "./lib/bugsnag.d.ts", | ||
"devDependencies": { | ||
"bson-objectid": "^1.2.2", | ||
"chai": "~1.5.0", | ||
@@ -19,0 +20,0 @@ "coveralls": "^2.13.1", |
108869
1288
12