Skip to content

Commit ff05659

Browse files
committed
docs(kitsu-core): add examples for linkRelationships
1 parent 66b5a6f commit ff05659

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • packages/kitsu-core/src/linkRelationships

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ function linkAttr (data, included, key) {
7171
*
7272
* @param {Object} data The response data object
7373
* @param {Object} included The response included object
74+
* @returns Parsed data
75+
*
76+
* @example
77+
* const data = {
78+
* attributes: { author: 'Joe' },
79+
* relationships: {
80+
* author: {
81+
* data: { id: '1', type: 'people' }
82+
* }
83+
* }
84+
* }
85+
* const included = [ {
86+
* id: '1',
87+
* type: 'people',
88+
* attributes: { name: 'Joe' }
89+
* } ]
90+
* const output = linkRelationships(data, included)
91+
* // {
92+
* // attributes: { author: 'Joe' },
93+
* // author: {
94+
* // data: { id: '1', name: 'Joe', type: 'people' }
95+
* // }
96+
* // }
7497
*/
7598
export function linkRelationships (data, included = []) {
7699
const { relationships } = data

0 commit comments

Comments
 (0)