Merge pull request #228 from fabien/fix/list-to-object
Prevent failure with null in List toObject
This commit is contained in:
commit
e1a516be75
|
@ -75,7 +75,7 @@ List.prototype.push = function (obj) {
|
|||
List.prototype.toObject = function (onlySchema, removeHidden) {
|
||||
var items = [];
|
||||
this.forEach(function (item) {
|
||||
if (item.toObject) {
|
||||
if (item && typeof item === 'object' && item.toObject) {
|
||||
items.push(item.toObject(onlySchema, removeHidden));
|
||||
} else {
|
||||
items.push(item);
|
||||
|
|
Loading…
Reference in New Issue