diff --git a/.gitignore b/.gitignore index fe5397c..bc9ef43 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist/ node_modules npm-debug.log .DS_Store +.idea diff --git a/lib/Resource.js b/lib/Resource.js index 838f18a..0f06766 100644 --- a/lib/Resource.js +++ b/lib/Resource.js @@ -56,11 +56,12 @@ Resource.prototype._getRaw = function() { Resource.prototype._getDelta = function() { var primaryRelations = { }; var relationships = this._getRaw().relationships; - Object.keys(relationships).forEach(function(i) { - if (getMeta(relationships[i]).relation === "foreign") return; - primaryRelations[i] = relationships[i]; - }); - + if (typeof relationships != 'undefined') { + Object.keys(relationships).forEach(function (i) { + if (getMeta(relationships[i]).relation === "foreign") return; + primaryRelations[i] = relationships[i]; + }); + } return { id: this._base.id, type: this._base.type,