You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/kitsu-core/README.md
+44-22Lines changed: 44 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,40 +99,42 @@ All code released under [MIT]
99
99
*[deattribute](#deattribute)
100
100
*[Parameters](#parameters-1)
101
101
*[Examples](#examples-1)
102
-
*[deserialise](#deserialise)
102
+
*[hoist](#hoist)
103
103
*[Parameters](#parameters-2)
104
+
*[deserialise](#deserialise)
105
+
*[Parameters](#parameters-3)
104
106
*[Examples](#examples-2)
105
107
*[error](#error)
106
-
*[Parameters](#parameters-3)
108
+
*[Parameters](#parameters-4)
107
109
*[Examples](#examples-3)
108
110
*[filterIncludes](#filterincludes)
109
-
*[Parameters](#parameters-4)
111
+
*[Parameters](#parameters-5)
110
112
*[Examples](#examples-4)
111
113
*[kebab](#kebab)
112
-
*[Parameters](#parameters-5)
114
+
*[Parameters](#parameters-6)
113
115
*[Examples](#examples-5)
114
116
*[linkRelationships](#linkrelationships)
115
-
*[Parameters](#parameters-6)
117
+
*[Parameters](#parameters-7)
116
118
*[Examples](#examples-6)
117
119
*[isDeepEqual](#isdeepequal)
118
-
*[Parameters](#parameters-7)
120
+
*[Parameters](#parameters-8)
119
121
*[Examples](#examples-7)
120
122
*[query](#query)
121
-
*[Parameters](#parameters-8)
123
+
*[Parameters](#parameters-9)
122
124
*[Examples](#examples-8)
123
125
*[serialise](#serialise)
124
-
*[Parameters](#parameters-9)
126
+
*[Parameters](#parameters-10)
125
127
*[Examples](#examples-9)
126
128
*[snake](#snake)
127
-
*[Parameters](#parameters-10)
129
+
*[Parameters](#parameters-11)
128
130
*[Examples](#examples-10)
129
131
*[splitModel](#splitmodel)
130
-
*[Parameters](#parameters-11)
132
+
*[Parameters](#parameters-12)
131
133
*[Examples](#examples-11)
132
134
133
135
### camel
134
136
135
-
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/camel/index.js#L14-L14"Source code on GitHub")
137
+
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/camel/index.js#L14-L14"Source code on GitHub")
136
138
137
139
Converts kebab-case and snake\_case into camelCase
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/deattribute/index.js#L29-L51"Source code on GitHub")
163
+
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/deattribute/index.js#L29-L51"Source code on GitHub")
Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>)** Deattributed resource data
200
202
203
+
### hoist
204
+
205
+
[packages/kitsu-core/src/deserialise/index.js:24-77](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/deserialise/index.js#L24-L77"Source code on GitHub")
206
+
207
+
Recursively traverses and clones an object or array, handling cyclic references.
208
+
If the object is a wrapper of the form { data: ... }, it unwraps and processes the `data` property.
209
+
210
+
#### Parameters
211
+
212
+
*`object`**any** The input to hoist (object or array)
213
+
214
+
Returns **any** The hoisted object or array
215
+
201
216
### deserialise
202
217
203
-
[packages/kitsu-core/src/deserialise/index.js:63-78](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/deserialise/index.js#L63-L78"Source code on GitHub")
218
+
[packages/kitsu-core/src/deserialise/index.js:150-170](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/deserialise/index.js#L150-L170"Source code on GitHub")
204
219
205
220
Deserialises a JSON-API response
206
221
207
222
#### Parameters
208
223
209
224
*`response`**[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The raw JSON:API response object
*`options.hoistData`**[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If enabled, the contents of the `data` property will be hoisted to the parent. This provides a flatter response object, but removes access to `links` and `meta` properties. It will transform:```js
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/error/index.js#L27-L33"Source code on GitHub")
275
+
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/error/index.js#L27-L33"Source code on GitHub")
254
276
255
277
Uniform error handling for Axios, JSON:API and internal package errors. Mutated Error object is rethrown to the caller.
256
278
@@ -287,7 +309,7 @@ error({
287
309
288
310
### filterIncludes
289
311
290
-
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/filterIncludes/index.js#L33-L46"Source code on GitHub")
312
+
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/filterIncludes/index.js#L33-L46"Source code on GitHub")
291
313
292
314
Filters includes for the specific relationship requested
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/kebab/index.js#L11-L11"Source code on GitHub")
352
+
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/kebab/index.js#L11-L11"Source code on GitHub")
[packages/kitsu-core/src/linkRelationships/index.js:144-164](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/linkRelationships/index.js#L144-L164"Source code on GitHub")
370
+
[packages/kitsu-core/src/linkRelationships/index.js:144-164](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/linkRelationships/index.js#L144-L164"Source code on GitHub")
349
371
350
372
Links relationships to included data
351
373
@@ -385,7 +407,7 @@ Returns **any** Parsed data
385
407
386
408
### isDeepEqual
387
409
388
-
[packages/kitsu-core/src/deepEqual/index.js:18-42](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/deepEqual/index.js#L18-L42"Source code on GitHub")
410
+
[packages/kitsu-core/src/deepEqual/index.js:18-42](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/deepEqual/index.js#L18-L42"Source code on GitHub")
[packages/kitsu-core/src/query/index.js:57-66](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/query/index.js#L57-L66"Source code on GitHub")
439
+
[packages/kitsu-core/src/query/index.js:57-66](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/query/index.js#L57-L66"Source code on GitHub")
418
440
419
441
Constructs a URL query string for JSON:API parameters
[packages/kitsu-core/src/serialise/index.js:210-221](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/serialise/index.js#L210-L221"Source code on GitHub")
468
+
[packages/kitsu-core/src/serialise/index.js:210-221](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/serialise/index.js#L210-L221"Source code on GitHub")
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/snake/index.js#L11-L11"Source code on GitHub")
513
+
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/snake/index.js#L11-L11"Source code on GitHub")
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/a794fdd4c0266be8d8404455ebf2847e47e66a64/packages/kitsu-core/src/splitModel/index.js#L29-L39"Source code on GitHub")
531
+
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/9039f9be49ca8ba032ad6b7099316b6751e18198/packages/kitsu-core/src/splitModel/index.js#L29-L39"Source code on GitHub")
* @param {boolean} [options.hoistData=false] If enabled, the contents of the `data` property will be hoisted to the parent. This provides a flatter response object, but removes access to `links` and `meta` properties. It will transform:
0 commit comments