Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Fix assumption that attributes is present
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
pjfreeze committed Dec 14, 2020
1 parent caf8437 commit 78caded
Show file tree
Hide file tree
Showing 7 changed files with 4,457 additions and 9 deletions.
5 changes: 5 additions & 0 deletions dist/jsonapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
return;
}

// IF: No attributes, populate with empty object
if (!isObject(record.attributes)) {
record.attributes = {};
}

// IF: Relationship has multiple matches, create an array for matched records
// ELSE: Assign relationship directly to the property
if (isArray(relationship.data)) {
Expand Down
2 changes: 1 addition & 1 deletion dist/jsonapi.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ gulp.task(

gulp.task(
'build',
['normal', 'minified']
gulp.parallel('normal', 'minified')
);
Loading

0 comments on commit 78caded

Please sign in to comment.