Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kitsu-core

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kitsu-core - npm Package Compare versions

Comparing version 9.1.1 to 9.1.2

LICENSE.md

23

CHANGELOG.md

@@ -6,2 +6,25 @@ # Change Log

## [9.1.2](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/compare/v9.1.1...v9.1.2) (2020-05-21)
### Bug Fixes
* **kitsu-core:** optional chain constructor calls to allow invalid JSON values ([66d76ef](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/66d76ef)), closes [#416](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/issues/416)
### Chores
* **release:** update documentation ([20e7cc6](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/20e7cc6))
### Documentation Changes
* **kitsu-core:** declare optional parameters in JSDoc syntax ([a78a075](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/a78a075))
* autogenerate typescript definitions ([6e1879f](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/6e1879f))
* update JSDoc Array syntax for better TypeScript usability ([8f147ab](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/8f147ab))
## [9.1.1](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/compare/v9.1.0...v9.1.1) (2020-05-21)

@@ -8,0 +31,0 @@

2

lib/deattribute.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.deattribute=function t(e){if("object"==typeof e&&null!==e)if(Array.isArray(e))e.map(e=>t(e));else if(e.attributes&&e.attributes.constructor===Object){for(const t of Object.keys(e.attributes))e.attributes.attributes||(e[t]=e.attributes[t]);e.attributes.attributes?e.attributes=e.attributes.attributes:delete e.attributes}return e};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.deattribute=function t(e){var r;if("object"==typeof e&&null!==e)if(Array.isArray(e))e.map(e=>t(e));else if((null===(r=e.attributes)||void 0===r?void 0:r.constructor)===Object){for(const t of Object.keys(e.attributes))e.attributes.attributes||(e[t]=e.attributes[t]);e.attributes.attributes?e.attributes=e.attributes.attributes:delete e.attributes}return e};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.error=function(r){if(r.response){const e=r.response.data;e&&e.errors&&(r.errors=e.errors)}throw r};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.error=function(r){if(r.response){const e=r.response.data;(null==e?void 0:e.errors)&&(r.errors=e.errors)}throw r};

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).kitsuCore={})}(this,(function(t){"use strict";function e(t){if("object"==typeof t&&null!==t)if(Array.isArray(t))t.map(t=>e(t));else if(t.attributes&&t.attributes.constructor===Object){for(const e of Object.keys(t.attributes))t.attributes.attributes||(t[e]=t.attributes[e]);t.attributes.attributes?t.attributes=t.attributes.attributes:delete t.attributes}return t}function r(t){if(t.response){const e=t.response.data;e&&e.errors&&(t.errors=e.errors)}throw t}function n(t,{id:e,type:n}){try{if(e&&n){const r=t.filter(t=>t.id===e&&t.type===n)[0]||{id:e,type:n};return Object.assign({},r)}return{}}catch(t){r(t)}}function i({id:t,type:r,meta:i},a){const o=n(a,{id:t,type:r});return o.relationships&&l(o,a),i&&(o.meta=i),e(o)}function a(t,e,r){t[r]={},t.relationships[r].links&&(t[r].links=t.relationships[r].links),t[r].data=[];for(const n of t.relationships[r].data)t[r].data.push(i(n,e));delete t.relationships[r]}function o(t,e,r){t[r]={},t[r].data=i(t.relationships[r].data,e),t.relationships[r].links&&(t[r].links=t.relationships[r].links),delete t.relationships[r]}function s(t,e){t[e]={},t.relationships[e].links&&(t[e].links=t.relationships[e].links),delete t.relationships[e]}function l(t,e=[]){const{relationships:r}=t;for(const i in r){var n;Array.isArray(null===(n=r[i])||void 0===n?void 0:n.data)?a(t,e,i):r[i].data?o(t,e,i):s(t,i)}return 0===Object.keys(r||[]).length&&(null==r?void 0:r.constructor)===Object&&delete t.relationships,t}function u(t,e=null){const r=[];for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&r.push((n=t[a],i=e?"".concat(e,"[").concat(a,"]"):a,null!==n&&"object"==typeof n?u(n,i):encodeURIComponent(i)+"="+encodeURIComponent(n)));var n,i;return r.join("&")}function c(t,e,r,n){const i=new Error("".concat(n," requires an ID for the ").concat(e," type"));if(void 0===e)throw new Error("".concat(n," requires a resource type"));if(t){if("POST"!==n&&r.length>0)for(const t of r)if(!t.id)throw i}else{if(r.constructor!==Object||0===Object.keys(r).length)throw new Error("".concat(n," requires an object or array body"));if("POST"!==n&&!r.id)throw i}}function d(t,e,r,n,i){return n.relationships||(n.relationships={}),t.type||(t.type=e),n.relationships[r]={data:Object.assign(t)},n}function p(t,e,r,n,i){return n.relationships||(n.relationships={}),n.relationships[r]={data:t.map(({id:t,type:r})=>({id:t,type:r||e}))},n}function f(t,e,r){return r.attributes||(r.attributes={}),r.attributes[e]=t,r}function y(t){return Object.prototype.hasOwnProperty.call(t,"id")}function h(t,e,r,n){c(!1,t,e,r);let i={type:t=n.pluralTypes(n.camelCaseTypes(t))};(null==e?void 0:e.id)&&(i.id=String(e.id));for(const t in e){const r=e[t],a=n.pluralTypes(n.camelCaseTypes(t));null!==r&&r.constructor===Object&&y(r)?i=d(r,a,t,i):null!==r&&Array.isArray(r)&&r.length>0&&y(r[0])?i=p(r,a,t,i):"id"!==t&&"type"!==t&&(i=f(r,t,i))}return{data:i}}t.camel=t=>t.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,t=>t.slice(1).toUpperCase()),t.deattribute=e,t.deserialise=function(t){var r,n;if(t)return Array.isArray(t.data)?t=function(t){for(let r of t.data)t.included&&(r=l(r,t.included)),r.relationships&&(r=l(r)),r.attributes&&(r=e(r)),t.data[t.data.indexOf(r)]=r;return t}(t):t.included?t.data=l(t.data,t.included):(null===(r=t.data)||void 0===r?void 0:r.constructor)===Object&&(t.data=l(t.data)),delete t.included,(null===(n=t.data)||void 0===n?void 0:n.attributes)&&(t.data=e(t.data)),t},t.error=r,t.filterIncludes=n,t.kebab=t=>t.charAt(0).toLowerCase()+t.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,t=>"-"+t.toLowerCase()),t.linkRelationships=l,t.query=u,t.serialise=function(t,e={},n="POST",i={}){try{return i.camelCaseTypes||(i.camelCaseTypes=t=>t),i.pluralTypes||(i.pluralTypes=t=>t),null===e||Array.isArray(e)&&0===e.length?{data:e}:Array.isArray(e)&&(null==e?void 0:e.length)>0?function(t,e,r,n){c(!0,t,e,r);const i=[];for(const a of e)i.push(h(t,a,r,n).data);return{data:i}}(t,e,n,i):h(t,e,n,i)}catch(t){throw r(t)}},t.snake=t=>t.charAt(0).toLowerCase()+t.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,t=>"_"+t.toLowerCase()),t.splitModel=function(t,e={}){e.pluralModel||(e.pluralModel=t=>t),e.resourceCase||(e.resourceCase=t=>t);const r=t.split("/"),n=r.pop();return r.push(e.pluralModel(e.resourceCase(n))),[n,r.join("/")]},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).kitsuCore={})}(this,(function(t){"use strict";function e(t){var r;if("object"==typeof t&&null!==t)if(Array.isArray(t))t.map(t=>e(t));else if((null===(r=t.attributes)||void 0===r?void 0:r.constructor)===Object){for(const e of Object.keys(t.attributes))t.attributes.attributes||(t[e]=t.attributes[e]);t.attributes.attributes?t.attributes=t.attributes.attributes:delete t.attributes}return t}function r(t){if(t.response){const e=t.response.data;(null==e?void 0:e.errors)&&(t.errors=e.errors)}throw t}function n(t,{id:e,type:n}){try{if(e&&n){const r=t.filter(t=>t.id===e&&t.type===n)[0]||{id:e,type:n};return Object.assign({},r)}return{}}catch(t){r(t)}}function i({id:t,type:r,meta:i},o){const a=n(o,{id:t,type:r});return a.relationships&&l(a,o),i&&(a.meta=i),e(a)}function o(t,e,r){t[r]={},t.relationships[r].links&&(t[r].links=t.relationships[r].links),t[r].data=[];for(const n of t.relationships[r].data)t[r].data.push(i(n,e));delete t.relationships[r]}function a(t,e,r){t[r]={},t[r].data=i(t.relationships[r].data,e),t.relationships[r].links&&(t[r].links=t.relationships[r].links),delete t.relationships[r]}function s(t,e){t[e]={},t.relationships[e].links&&(t[e].links=t.relationships[e].links),delete t.relationships[e]}function l(t,e=[]){const{relationships:r}=t;for(const i in r){var n;Array.isArray(null===(n=r[i])||void 0===n?void 0:n.data)?o(t,e,i):r[i].data?a(t,e,i):s(t,i)}return 0===Object.keys(r||[]).length&&(null==r?void 0:r.constructor)===Object&&delete t.relationships,t}function u(t,e=null){const r=[];for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.push((n=t[o],i=e?"".concat(e,"[").concat(o,"]"):o,null!==n&&"object"==typeof n?u(n,i):encodeURIComponent(i)+"="+encodeURIComponent(n)));var n,i;return r.join("&")}function c(t,e,r,n){const i=new Error("".concat(n," requires an ID for the ").concat(e," type"));if(void 0===e)throw new Error("".concat(n," requires a resource type"));if(t){if("POST"!==n&&r.length>0)for(const t of r)if(!t.id)throw i}else{if((null==r?void 0:r.constructor)!==Object||0===Object.keys(r).length)throw new Error("".concat(n," requires an object or array body"));if("POST"!==n&&!r.id)throw i}}function d(t,e,r,n){return n.relationships||(n.relationships={}),t.type||(t.type=e),n.relationships[r]={data:Object.assign(t)},n}function p(t,e,r,n){return n.relationships||(n.relationships={}),n.relationships[r]={data:t.map(({id:t,type:r})=>({id:t,type:r||e}))},n}function f(t,e,r){return r.attributes||(r.attributes={}),r.attributes[e]=t,r}function y(t){return Object.prototype.hasOwnProperty.call(t,"id")}function h(t,e,r,n){c(!1,t,e,r);let i={type:t=n.pluralTypes(n.camelCaseTypes(t))};(null==e?void 0:e.id)&&(i.id=String(e.id));for(const t in e){const r=e[t],o=n.pluralTypes(n.camelCaseTypes(t));null!==r&&(null==r?void 0:r.constructor)===Object&&y(r)?i=d(r,o,t,i):null!==r&&Array.isArray(r)&&r.length>0&&y(r[0])?i=p(r,o,t,i):"id"!==t&&"type"!==t&&(i=f(r,t,i))}return{data:i}}t.camel=t=>t.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,t=>t.slice(1).toUpperCase()),t.deattribute=e,t.deserialise=function(t){var r,n;if(t)return Array.isArray(t.data)?t=function(t){for(let r of t.data)t.included&&(r=l(r,t.included)),r.relationships&&(r=l(r)),r.attributes&&(r=e(r)),t.data[t.data.indexOf(r)]=r;return t}(t):t.included?t.data=l(t.data,t.included):(null===(r=t.data)||void 0===r?void 0:r.constructor)===Object&&(t.data=l(t.data)),delete t.included,(null===(n=t.data)||void 0===n?void 0:n.attributes)&&(t.data=e(t.data)),t},t.error=r,t.filterIncludes=n,t.kebab=t=>t.charAt(0).toLowerCase()+t.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,t=>"-"+t.toLowerCase()),t.linkRelationships=l,t.query=u,t.serialise=function(t,e={},n="POST",i={}){try{return i.camelCaseTypes||(i.camelCaseTypes=t=>t),i.pluralTypes||(i.pluralTypes=t=>t),null===e||Array.isArray(e)&&0===e.length?{data:e}:Array.isArray(e)&&(null==e?void 0:e.length)>0?function(t,e,r,n){c(!0,t,e,r);const i=[];for(const o of e)i.push(h(t,o,r,n).data);return{data:i}}(t,e,n,i):h(t,e,n,i)}catch(t){throw r(t)}},t.snake=t=>t.charAt(0).toLowerCase()+t.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,t=>"_"+t.toLowerCase()),t.splitModel=function(t,e={}){e.pluralModel||(e.pluralModel=t=>t),e.resourceCase||(e.resourceCase=t=>t);const r=t.split("/"),n=r.pop();return r.push(e.pluralModel(e.resourceCase(n))),[n,r.join("/")]},Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./error.js");function t(r,t,e,n){const o=new Error("".concat(n," requires an ID for the ").concat(t," type"));if(void 0===t)throw new Error("".concat(n," requires a resource type"));if(r){if("POST"!==n&&e.length>0)for(const r of e)if(!r.id)throw o}else{if(e.constructor!==Object||0===Object.keys(e).length)throw new Error("".concat(n," requires an object or array body"));if("POST"!==n&&!e.id)throw o}}function e(r,t,e,n,o){return n.relationships||(n.relationships={}),r.type||(r.type=t),n.relationships[e]={data:Object.assign(r)},n}function n(r,t,e,n,o){return n.relationships||(n.relationships={}),n.relationships[e]={data:r.map(({id:r,type:e})=>({id:r,type:e||t}))},n}function o(r,t,e){return e.attributes||(e.attributes={}),e.attributes[t]=r,e}function a(r){return Object.prototype.hasOwnProperty.call(r,"id")}function s(r,s,i,c){t(!1,r,s,i);let l={type:r=c.pluralTypes(c.camelCaseTypes(r))};(null==s?void 0:s.id)&&(l.id=String(s.id));for(const r in s){const t=s[r],i=c.pluralTypes(c.camelCaseTypes(r));null!==t&&t.constructor===Object&&a(t)?l=e(t,i,r,l):null!==t&&Array.isArray(t)&&t.length>0&&a(t[0])?l=n(t,i,r,l):"id"!==r&&"type"!==r&&(l=o(t,r,l))}return{data:l}}exports.serialise=function(e,n={},o="POST",a={}){try{return a.camelCaseTypes||(a.camelCaseTypes=r=>r),a.pluralTypes||(a.pluralTypes=r=>r),null===n||Array.isArray(n)&&0===n.length?{data:n}:Array.isArray(n)&&(null==n?void 0:n.length)>0?function(r,e,n,o){t(!0,r,e,n);const a=[];for(const t of e)a.push(s(r,t,n,o).data);return{data:a}}(e,n,o,a):s(e,n,o,a)}catch(t){throw r.error(t)}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./error.js");function t(r,t,e,n){const o=new Error("".concat(n," requires an ID for the ").concat(t," type"));if(void 0===t)throw new Error("".concat(n," requires a resource type"));if(r){if("POST"!==n&&e.length>0)for(const r of e)if(!r.id)throw o}else{if((null==e?void 0:e.constructor)!==Object||0===Object.keys(e).length)throw new Error("".concat(n," requires an object or array body"));if("POST"!==n&&!e.id)throw o}}function e(r,t,e,n){return n.relationships||(n.relationships={}),r.type||(r.type=t),n.relationships[e]={data:Object.assign(r)},n}function n(r,t,e,n){return n.relationships||(n.relationships={}),n.relationships[e]={data:r.map(({id:r,type:e})=>({id:r,type:e||t}))},n}function o(r,t,e){return e.attributes||(e.attributes={}),e.attributes[t]=r,e}function i(r){return Object.prototype.hasOwnProperty.call(r,"id")}function a(r,a,s,l){t(!1,r,a,s);let c={type:r=l.pluralTypes(l.camelCaseTypes(r))};(null==a?void 0:a.id)&&(c.id=String(a.id));for(const r in a){const t=a[r],s=l.pluralTypes(l.camelCaseTypes(r));null!==t&&(null==t?void 0:t.constructor)===Object&&i(t)?c=e(t,s,r,c):null!==t&&Array.isArray(t)&&t.length>0&&i(t[0])?c=n(t,s,r,c):"id"!==r&&"type"!==r&&(c=o(t,r,c))}return{data:c}}exports.serialise=function(e,n={},o="POST",i={}){try{return i.camelCaseTypes||(i.camelCaseTypes=r=>r),i.pluralTypes||(i.pluralTypes=r=>r),null===n||Array.isArray(n)&&0===n.length?{data:n}:Array.isArray(n)&&(null==n?void 0:n.length)>0?function(r,e,n,o){t(!0,r,e,n);const i=[];for(const t of e)i.push(a(r,t,n,o).data);return{data:i}}(e,n,o,i):a(e,n,o,i)}catch(t){throw r.error(t)}};
{
"version": "9.1.1",
"version": "9.1.2",
"name": "kitsu-core",

@@ -18,3 +18,3 @@ "description": "Core serialisation and deserialsation functions for the kitsu JSON:API client",

"jsdelivr": "lib/index.browser.js",
"types": "index.d.ts",
"types": "types/index.d.ts",
"homepage": "https://github.com/wopian/kitsu/tree/master/packages/kitsu-core#readme",

@@ -38,2 +38,3 @@ "repository": "https://github.com/wopian/kitsu/tree/master/packages/kitsu-core",

"docs:build": "documentation readme src/index.js --section=API -g true --sort-order source",
"docs:typescript": "tsc src/index.js --declaration --emitDeclarationOnly --allowJs --outDir types",
"rollup": "cross-env NODE_ENV=production rollup -c --environment BUILD:production",

@@ -57,3 +58,3 @@ "build": "yarn rollup"

],
"gitHead": "5c9778d191d17d7c9790cfc6d0f4e983b4742a53",
"gitHead": "dd4bc433ae7bc4e620fd057db7eb1613fdb30752",
"devDependencies": {

@@ -60,0 +61,0 @@ "@size-limit/preset-small-lib": "~4.5.0"

@@ -119,3 +119,3 @@ <h1 align=center>Kitsu Core</h1>

[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub")
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub")

@@ -126,3 +126,3 @@ Hoists attributes to be top-level

- `data` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** Resource data
- `data` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>)** Resource data

@@ -161,7 +161,7 @@ #### Examples

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))** Deattributed resource data
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)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>)** Deattributed resource data
### deserialise
[packages/kitsu-core/src/deserialise/index.js:57-72](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/deserialise/index.js#L57-L72 "Source code on GitHub")
[packages/kitsu-core/src/deserialise/index.js:57-72](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/deserialise/index.js#L57-L72 "Source code on GitHub")

@@ -218,3 +218,3 @@ Deserialises a JSON-API response

[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub")
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub")

@@ -225,3 +225,3 @@ Uniform error handling for Axios, JSON:API and internal package errors. Mutated Error object is rethrown to the caller.

- `E` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The Error
- `Error` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The Error

@@ -257,3 +257,3 @@ #### Examples

[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub")
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub")

@@ -264,3 +264,3 @@ Filters includes for the specific relationship requested

- `included` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The response included object
- `included` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** The response included object
- `relationship` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**

@@ -294,7 +294,7 @@ - `relationship.id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The relationship ID

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The matched includes
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** The matched includes
### linkRelationships
[packages/kitsu-core/src/linkRelationships/index.js:97-117](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/linkRelationships/index.js#L97-L117 "Source code on GitHub")
[packages/kitsu-core/src/linkRelationships/index.js:97-117](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/linkRelationships/index.js#L97-L117 "Source code on GitHub")

@@ -306,3 +306,3 @@ Links relationships to included data

- `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The response data object
- `included` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The response included object (optional, default `[]`)
- `included` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>?** The response included object (optional, default `[]`)

@@ -338,3 +338,3 @@ #### Examples

[packages/kitsu-core/src/query/index.js:33-44](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/query/index.js#L33-L44 "Source code on GitHub")
[packages/kitsu-core/src/query/index.js:33-44](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/query/index.js#L33-L44 "Source code on GitHub")

@@ -345,4 +345,4 @@ Constructs a URL query string for JSON:API parameters

- `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Parameters to parse
- `prefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Prefix for nested parameters - used internally (default `null`) (optional, default `null`)
- `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Parameters to parse
- `prefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Prefix for nested parameters - used internally (optional, default `null`)

@@ -368,3 +368,3 @@ #### Examples

[packages/kitsu-core/src/serialise/index.js:193-204](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/serialise/index.js#L193-L204 "Source code on GitHub")
[packages/kitsu-core/src/serialise/index.js:191-202](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/serialise/index.js#L191-L202 "Source code on GitHub")

@@ -376,7 +376,7 @@ Serialises an object into a JSON-API structure

- `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Resource type
- `data` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** The data (optional, default `{}`)
- `method` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Request type (PATCH, POST, DELETE) (optional, default `'POST'`)
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional configuration for camelCase and pluralisation handling (optional, default `{}`)
- `options.camelCaseTypes` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Convert library-entries and library_entries to libraryEntries (default no conversion). To use parameter, import camel from kitsu-core
- `options.pluralTypes` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Pluralise types (default no pluralisation). To use parameter, import pluralize (or another pluralisation npm package)
- `data` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>)?** The data (optional, default `{}`)
- `method` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Request type (PATCH, POST, DELETE) (optional, default `'POST'`)
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional configuration for camelCase and pluralisation handling (optional, default `{}`)
- `options.camelCaseTypes` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Convert library-entries and library_entries to libraryEntries (default no conversion). To use parameter, import camel from kitsu-core (optional, default `s=>s`)
- `options.pluralTypes` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Pluralise types (default no pluralisation). To use parameter, import pluralize (or another pluralisation npm package) (optional, default `s=>s`)

@@ -416,3 +416,3 @@ #### Examples

[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub")
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub")

@@ -424,5 +424,5 @@ Split model name from the model's resource URL

- `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** URL path for the model
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `options.resourceCase` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Convert libraryEntries to library-entries or library_entries (default no conversion). To use parameter, import kebab or snake from kitsu-core
- `options.pluralModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Pluralise models (default no pluralisation). To use parameter, import pluralize (or another pluralisation npm package)
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional configuration for camelCase and pluralisation handling
- `options.resourceCase` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Convert libraryEntries to library-entries or library_entries (default no conversion). To use parameter, import kebab or snake from kitsu-core (optional, default `s=>s`)
- `options.pluralModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Pluralise models (default no pluralisation). To use parameter, import pluralize (or another pluralisation npm package) (optional, default `s=>s`)

@@ -457,7 +457,7 @@ #### Examples

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array containing the model name and the resource URL with pluralisation applied
Returns **\[[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)]** } Array containing the model name and the resource URL with pluralisation applied
### camel
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")

@@ -468,3 +468,3 @@ Converts kebab-case and snake_case into camelCase

- `s` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to convert
- `input` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to convert

@@ -491,3 +491,3 @@ #### Examples

[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")

@@ -498,3 +498,3 @@ Converts camelCase into kebab-case

- `s` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** camelCase string
- `input` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** camelCase string

@@ -511,3 +511,3 @@ #### Examples

[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/570ef11d4ba811a0bf77a9e018d86f87ba6da961/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")

@@ -518,3 +518,3 @@ Converts camelCase into snake_case

- `s` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** camelCase string
- `input` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** camelCase string

@@ -521,0 +521,0 @@ #### Examples

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc