Skip to content

Commit 43d5d4b

Browse files
committed
refactor(kitsu-core): use optional chaining in deserialise
1 parent 94dc48a commit 43d5d4b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • packages/kitsu-core/src/deserialise

packages/kitsu-core/src/deserialise/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ export function deserialise (response) {
5858
if (!response) return
5959

6060
// Collection of resources
61-
if (response.data && Array.isArray(response.data)) response = deserialiseArray(response)
61+
if (Array.isArray(response.data)) response = deserialiseArray(response)
6262
// Single resource with included relationships
6363
else if (response.included) response.data = linkRelationships(response.data, response.included)
64-
else if (response.data && response.data.constructor === Object) response.data = linkRelationships(response.data)
64+
else if (response.data?.constructor === Object) response.data = linkRelationships(response.data)
6565

6666
delete response.included
6767

6868
// Move attributes to the parent object
69-
if (response.data && response.data.attributes) response.data = deattribute(response.data)
69+
if (response.data?.attributes) response.data = deattribute(response.data)
7070

7171
return response
7272
}

0 commit comments

Comments
 (0)