kitsu-core
Advanced tools
Comparing version 9.1.26 to 9.1.27
@@ -6,2 +6,11 @@ # Change Log | ||
## [9.1.27](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/compare/v9.1.26...v9.1.27) (2022-08-11) | ||
**Note:** Version bump only for package kitsu-core | ||
## [9.1.26](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/compare/v9.1.25...v9.1.26) (2022-08-11) | ||
@@ -8,0 +17,0 @@ |
@@ -6,5 +6,5 @@ 'use strict'; | ||
var deattribute = require('./deattribute.js'); | ||
var linkRelationships = require('./linkRelationships.js'); | ||
require('./filterIncludes.js'); | ||
require('./error.js'); | ||
require('./filterIncludes.js'); | ||
var linkRelationships = require('./linkRelationships.js'); | ||
@@ -11,0 +11,0 @@ function deserialiseArray(array) { |
@@ -7,6 +7,8 @@ 'use strict'; | ||
function filterIncludes(included, { | ||
id, | ||
type | ||
}) { | ||
function filterIncludes(included, _ref) { | ||
let { | ||
id, | ||
type | ||
} = _ref; | ||
try { | ||
@@ -13,0 +15,0 @@ if (id && type) { |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.kitsuCore = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.kitsuCore = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
@@ -36,6 +36,8 @@ function deattribute(data) { | ||
function filterIncludes(included, { | ||
id, | ||
type | ||
}) { | ||
function filterIncludes(included, _ref) { | ||
let { | ||
id, | ||
type | ||
} = _ref; | ||
try { | ||
@@ -58,7 +60,8 @@ if (id && type) { | ||
function link({ | ||
id, | ||
type, | ||
meta | ||
}, included) { | ||
function link(_ref, included) { | ||
let { | ||
id, | ||
type, | ||
meta | ||
} = _ref; | ||
const filtered = filterIncludes(included, { | ||
@@ -98,3 +101,4 @@ id, | ||
function linkRelationships(data, included = []) { | ||
function linkRelationships(data) { | ||
let included = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
const { | ||
@@ -148,3 +152,4 @@ relationships | ||
function query(params, prefix = null) { | ||
function query(params) { | ||
let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
const str = []; | ||
@@ -238,7 +243,8 @@ | ||
data.relationships[key] = { | ||
data: node.map(({ | ||
id, | ||
type, | ||
...attributes | ||
}) => { | ||
data: node.map(_ref => { | ||
let { | ||
id, | ||
type, | ||
...attributes | ||
} = _ref; | ||
return { | ||
@@ -304,3 +310,7 @@ id, | ||
function serialise(type, data = {}, method = 'POST', options = {}) { | ||
function serialise(type) { | ||
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
let method = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'POST'; | ||
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
try { | ||
@@ -318,3 +328,4 @@ if (!options.camelCaseTypes) options.camelCaseTypes = s => s; | ||
function splitModel(url, options = {}) { | ||
function splitModel(url) { | ||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (!options.pluralModel) options.pluralModel = s => s; | ||
@@ -329,9 +340,9 @@ if (!options.resourceCase) options.resourceCase = s => s; | ||
var index = (input => input.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g, match => match.slice(1).toUpperCase())); | ||
var index$2 = (input => input.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g, match => match.slice(1).toUpperCase())); | ||
var index$1 = (input => input.charAt(0).toLowerCase() + input.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, match => '-' + match.toLowerCase())); | ||
var index$2 = (input => input.charAt(0).toLowerCase() + input.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, match => '_' + match.toLowerCase())); | ||
var index = (input => input.charAt(0).toLowerCase() + input.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, match => '_' + match.toLowerCase())); | ||
exports.camel = index; | ||
exports.camel = index$2; | ||
exports.deattribute = deattribute; | ||
@@ -345,3 +356,3 @@ exports.deserialise = deserialise; | ||
exports.serialise = serialise; | ||
exports.snake = index$2; | ||
exports.snake = index; | ||
exports.splitModel = splitModel; | ||
@@ -351,2 +362,2 @@ | ||
}))); | ||
})); |
@@ -6,6 +6,6 @@ 'use strict'; | ||
var deattribute = require('./deattribute.js'); | ||
var deserialise = require('./deserialise.js'); | ||
var error = require('./error.js'); | ||
var filterIncludes = require('./filterIncludes.js'); | ||
var linkRelationships = require('./linkRelationships.js'); | ||
var deserialise = require('./deserialise.js'); | ||
var query = require('./query.js'); | ||
@@ -17,3 +17,4 @@ var serialise = require('./serialise.js'); | ||
function splitModel(url, options = {}) { | ||
function splitModel(url) { | ||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (!options.pluralModel) options.pluralModel = s => s; | ||
@@ -29,6 +30,6 @@ if (!options.resourceCase) options.resourceCase = s => s; | ||
exports.deattribute = deattribute.deattribute; | ||
exports.deserialise = deserialise.deserialise; | ||
exports.error = error.error; | ||
exports.filterIncludes = filterIncludes.filterIncludes; | ||
exports.linkRelationships = linkRelationships.linkRelationships; | ||
exports.deserialise = deserialise.deserialise; | ||
exports.query = query.query; | ||
@@ -35,0 +36,0 @@ exports.serialise = serialise.serialise; |
@@ -6,10 +6,11 @@ 'use strict'; | ||
var deattribute = require('./deattribute.js'); | ||
var filterIncludes = require('./filterIncludes.js'); | ||
require('./error.js'); | ||
var filterIncludes = require('./filterIncludes.js'); | ||
function link({ | ||
id, | ||
type, | ||
meta | ||
}, included) { | ||
function link(_ref, included) { | ||
let { | ||
id, | ||
type, | ||
meta | ||
} = _ref; | ||
const filtered = filterIncludes.filterIncludes(included, { | ||
@@ -49,3 +50,4 @@ id, | ||
function linkRelationships(data, included = []) { | ||
function linkRelationships(data) { | ||
let included = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
const { | ||
@@ -52,0 +54,0 @@ relationships |
@@ -9,3 +9,4 @@ 'use strict'; | ||
function query(params, prefix = null) { | ||
function query(params) { | ||
let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
const str = []; | ||
@@ -12,0 +13,0 @@ |
@@ -84,7 +84,8 @@ 'use strict'; | ||
data.relationships[key] = { | ||
data: node.map(({ | ||
id, | ||
type, | ||
...attributes | ||
}) => { | ||
data: node.map(_ref => { | ||
let { | ||
id, | ||
type, | ||
...attributes | ||
} = _ref; | ||
return { | ||
@@ -150,3 +151,7 @@ id, | ||
function serialise(type, data = {}, method = 'POST', options = {}) { | ||
function serialise(type) { | ||
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
let method = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'POST'; | ||
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
try { | ||
@@ -153,0 +158,0 @@ if (!options.camelCaseTypes) options.camelCaseTypes = s => s; |
{ | ||
"version": "9.1.26", | ||
"version": "9.1.27", | ||
"name": "kitsu-core", | ||
@@ -46,3 +46,3 @@ "description": "Simple, lightweight & framework agnostic JSON:API (de)serialsation components", | ||
"path": "./lib/index.js", | ||
"limit": "2 kb", | ||
"limit": "2.5 kb", | ||
"brotli": true | ||
@@ -52,3 +52,3 @@ }, | ||
"path": "./lib/index.mjs", | ||
"limit": "2 kb", | ||
"limit": "2.5 kb", | ||
"brotli": true | ||
@@ -58,3 +58,3 @@ }, | ||
"path": "./lib/index.browser.js", | ||
"limit": "2 kb", | ||
"limit": "2.5 kb", | ||
"brotli": true | ||
@@ -65,3 +65,3 @@ } | ||
"devDependencies": { | ||
"@size-limit/preset-small-lib": "~4.5.0" | ||
"@size-limit/preset-small-lib": "~8.0.0" | ||
}, | ||
@@ -68,0 +68,0 @@ "exports": { |
@@ -6,3 +6,2 @@ <h1 align=center>Kitsu Core</h1> | ||
<a href=https://www.npmjs.com/package/kitsu-core><img alt=npm src=https://flat.badgen.net/npm/dt/kitsu-core></a> | ||
<a href="https://david-dm.org/wopian/kitsu?path=packages/kitsu-core"><img alt=deps src="https://flat.badgen.net/david/dep/wopian/kitsu/packages/kitsu-core"></a> | ||
<a href="https://bundlephobia.com/result?p=kitsu-core"><img alt=bundlephobia src='https://flat.badgen.net/bundlephobia/minzip/kitsu-core?label=library%20size'></a> | ||
@@ -118,3 +117,3 @@ <img alt=types src='https://flat.badgen.net/npm/types/kitsu-core'> | ||
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub") | ||
@@ -161,3 +160,3 @@ Hoists attributes to be top-level | ||
[packages/kitsu-core/src/deserialise/index.js:57-72](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/deserialise/index.js#L57-L72 "Source code on GitHub") | ||
@@ -212,3 +211,3 @@ Deserialises a JSON-API response | ||
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub") | ||
@@ -250,3 +249,3 @@ Uniform error handling for Axios, JSON:API and internal package errors. Mutated Error object is rethrown to the caller. | ||
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub") | ||
@@ -291,3 +290,3 @@ Filters includes for the specific relationship requested | ||
[packages/kitsu-core/src/linkRelationships/index.js:97-117](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/linkRelationships/index.js#L97-L117 "Source code on GitHub") | ||
@@ -330,3 +329,3 @@ Links relationships to included data | ||
[packages/kitsu-core/src/query/index.js:33-44](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/query/index.js#L33-L44 "Source code on GitHub") | ||
@@ -359,3 +358,3 @@ Constructs a URL query string for JSON:API parameters | ||
[packages/kitsu-core/src/serialise/index.js:249-260](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/packages/kitsu-core/src/serialise/index.js#L249-L260 "Source code on GitHub") | ||
[packages/kitsu-core/src/serialise/index.js:249-260](https://github.com/wopian/kitsu/blob/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/serialise/index.js#L249-L260 "Source code on GitHub") | ||
@@ -405,3 +404,3 @@ Serialises an object into a JSON-API structure | ||
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub") | ||
@@ -448,3 +447,3 @@ Split model name from the model's resource URL | ||
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub") | ||
@@ -475,3 +474,3 @@ Converts kebab-case and snake_case into camelCase | ||
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub") | ||
@@ -494,3 +493,3 @@ Converts camelCase into kebab-case | ||
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/d0a0faa5db058d5a61d4be1dc10fd64d0d9193db/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/71ebcd7f6241d5a4833360a1271bbb334bfd8f08/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub") | ||
@@ -497,0 +496,0 @@ Converts camelCase into snake_case |
@@ -32,4 +32,4 @@ /** | ||
export function serialise(type: string, data?: any | any[], method?: string, options?: { | ||
camelCaseTypes: Function; | ||
pluralTypes: Function; | ||
camelCaseTypes?: Function; | ||
pluralTypes?: Function; | ||
}): any; |
@@ -29,4 +29,4 @@ /** | ||
export function splitModel(url: string, options?: { | ||
resourceCase: Function; | ||
pluralModel: Function; | ||
resourceCase?: Function; | ||
pluralModel?: Function; | ||
}): [string, string]; |
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
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
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
83781
1194
515