Skip to content

Commit 9ad8fc0

Browse files
committed
docs: correct errors in types
1 parent e8aacc5 commit 9ad8fc0

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { error } from '../error'
33
/**
44
* Checks if data is valid for serialisation
55
*
6-
* @param {Boolean} isArray If root element of the payload was an Array or Object
6+
* @param {boolean} isArray If root element of the payload was an Array or Object
77
* @param {string} type Resource type
88
* @param {Object} payload The data
99
* @param {string} method Request type - `PATCH` or `POST`
@@ -185,14 +185,14 @@ function serialiseRootObject (type, payload, method, options) {
185185
* // { data: { id: '1', type: 'anime', attributes: { slug: 'shirobako' } } }
186186
* const output = serialise(model, obj, 'PATCH')
187187
*/
188-
export function serialise (model, data = {}, method = 'POST', options = {}) {
188+
export function serialise (type, data = {}, method = 'POST', options = {}) {
189189
try {
190190
if (!options.camelCaseTypes) options.camelCaseTypes = s => s
191191
if (!options.pluralTypes) options.pluralTypes = s => s
192192
// Delete relationship to-one (data: null) or to-many (data: [])
193193
if (data === null || (Array.isArray(data) && data.length === 0)) return { data }
194194

195-
const type = options.pluralTypes(options.camelCaseTypes(model))
195+
type = options.pluralTypes(options.camelCaseTypes(type))
196196

197197
if (Array.isArray(data) && data?.length > 0) return serialiseRootArray(type, data, method, options)
198198
else return serialiseRootObject(type, data, method, options)

packages/kitsu/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export default class Kitsu {
189189
if (id) url += `/${id}`
190190
if (relationship) url += `/${this.resCase(relationship)}`
191191

192-
/* istanbul ignore next */
192+
// eslint-disable-next-line no-console
193193
const { data } = await this.axios.get(url, {
194194
params,
195195
paramsSerializer: p => query(p),
@@ -369,6 +369,7 @@ export default class Kitsu {
369369
* **Note** Planned changes to the `get`, `patch`, `post` and `delete` methods in a future major release may make this method redundent. See https://github.com/wopian/kitsu/issues/415 for details.
370370
*
371371
* @memberof Kitsu
372+
* @param {Object} config Request configuration
372373
* @param {Object|Array} config.body Data to send in the request
373374
* @param {string} config.method Request method - `GET`, `PATCH`, `POST` or `DELETE` (defaults to `GET`, case-insensitive)
374375
* @param {Object} config.params JSON-API request queries
@@ -424,6 +425,7 @@ export default class Kitsu {
424425
async request ({ body, method, params, type, url }, headers = {}) {
425426
try {
426427
method = method?.toUpperCase() || 'GET'
428+
// eslint-disable-next-line no-console
427429
const { data } = await this.axios.request({
428430
method,
429431
url,

0 commit comments

Comments
 (0)