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 8.0.2 to 8.0.3

17

CHANGELOG.md

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

## [8.0.3](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/compare/v8.0.2...v8.0.3) (2020-01-07)
### Chores
* **release:** update documentation ([65f0559](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/65f0559))
* improve TypeScript declarations ([#355](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/issues/355)) ([934c79e](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/934c79e))
### Documentation Changes
* remove appveyor badge [skip ci] ([8063c4a](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/commit/8063c4a))
## [8.0.2](https://github.com/wopian/kitsu/tree/master/packages/kitsu-core/compare/v8.0.1...v8.0.2) (2019-12-24)

@@ -8,0 +25,0 @@

228

index.d.ts

@@ -1,64 +0,202 @@

/** Declaration file generated by dts-gen */
declare module 'kitsu-core' {
export * from 'kitsu-core/deattribute';
export * from 'kitsu-core/deserialise';
export * from 'kitsu-core/error';
export * from 'kitsu-core/filterIncludes';
export * from 'kitsu-core/linkRelationships';
export * from 'kitsu-core/query';
export * from 'kitsu-core/serialise';
export { default as camel } from 'kitsu-core/camel';
export { default as kebab } from 'kitsu-core/kebab';
export { default as snake } from 'kitsu-core/snake';
}
export function camel(s: any): void;
declare module 'kitsu-core/deattribute' {
/**
* Hoists attributes to be top-level
*
* @param {Object|Array} data Resource data
* @returns {Object|Array} Deattributed resource data
*
* @example <caption>Deattribute an array of resources</caption>
* // JSON:API 'data' field
* const data = [
* {
* id: '1',
* type: 'users',
* attributes: { slug: 'wopian' }
* }
* ]
*
* const output = deattribute(data) // [ { id: '1', type: 'users', slug: 'wopian' } ]
*
* @example <caption>Deattribute a resource</caption>
* // JSON:API 'data' field
* const data = {
* id: '1',
* type: 'users',
* attributes: { slug: 'wopian' }
* }
*
* const output = deattribute(data) // { id: '1', type: 'users', slug: 'wopian' }
*/
export function deattribute(data: any): any;
}
export function deattribute(...args: any[]): any;
declare module 'kitsu-core/deserialise' {
/**
* Deserialises a JSON-API response
*
* @param {Object} obj The response
* @returns {Object} The deserialised response
*
* @example <caption>Deserialise with a basic data object</caption>
* deserialise({
* data: {
* id: '1',
* attributes: { liked: true }
* },
* meta: { hello: 'world' }
* }) // { data: { id: '1', liked: true }, meta: { hello: 'world' } }
*
* @example <caption>Deserialise with relationships</caption>
* deserialise({
* data: {
* id: '1',
* relationships: {
* user: {
* data: {
* type: 'users',
* id: '2' }
* }
* }
* },
* included: [
* {
* type: 'users',
* id: '2',
* attributes: { slug: 'wopian' }
* }
* ]
* }) // { data: { id: '1', user: { type: 'users', id: '2', slug: 'wopian' } } }
*/
export function deserialise(obj: any): any;
}
export function deserialise(...args: any[]): any;
declare module 'kitsu-core/error' {
/**
* Uniform error handling for Axios, JSON:API and internal package errors. Mutated Error object is rethrown to the caller.
*
* @param {Object} E The Error
* @throws {Object} The mutated Error
*/
export function error(E: any): void;
}
export function error(E: any): void;
export function filterIncludes(...args: any[]): any;
export function kebab(s: any): void;
export function linkRelationships(...args: any[]): any;
export function query(params: any, ...args: any[]): any;
export function serialise(...args: any[]): any;
export function snake(s: any): void;
export namespace deattribute {
const prototype: {
};
declare module 'kitsu-core/filterIncludes' {
/**
* Filters includes for the specific relationship
*
* @param {Object} included The response included object
* @param {Object} opts
* @param {string} opts.id The relationship ID
* @param {string} opts.type The relationship type
* @returns {Array} The matched includes
*/
export function filterIncludes(included: any, { id, type }: {
id: any;
type: any;
}): any;
}
export namespace deserialise {
const prototype: {
};
declare module 'kitsu-core/linkRelationships' {
/**
* Links relationships to included data
*
* @param {Object} data The response data object
* @param {Object} included The response included object
*/
export function linkRelationships(data: any, included: any): any;
}
export namespace error {
const prototype: {
};
declare module 'kitsu-core/query' {
/**
* Constructs a URL query string for JSON:API parameters
*
* @param {Object} params Parameters to parse
* @param {string} prefix Prefix for nested parameters - used internally (default `null`)
* @returns {string} URL query string
*/
export function query(params: any, prefix?: any): string;
}
export namespace filterIncludes {
const prototype: {
declare module 'kitsu-core/serialise' {
/**
* Serialises an object into a JSON-API structure
*
* @param {string} model Request model
* @param {Object} obj The data
* @param {string} method Request type
* @returns {Object} The serialised data
*
* @example <caption>Due to its usage in kitsu, it **MUST** be called with **this** set in 6.0.x</caption>
* import { serialise, camel, kebab } from 'kitsu-core'
* import plural from 'pluralize'
*
* const output = serialise.apply({ camel, resCase: kebab, plural }, [ model, obj, 'PATCH' ])
*/
export function serialise(model: any, obj?: {}, method?: string): {
data: {
type: any;
};
};
}
export namespace linkRelationships {
const prototype: {
};
declare module 'kitsu-core/camel' {
const _default: (s: any) => any;
/**
* Converts kebab-case and snake_case into camelCase
*
* @name camel
* @param {string} s String to convert
* @returns {string} camelCase formatted string
*
* @example <caption>Convert kebab-case</caption>
* camel('hello-world') // 'helloWorld'
*
* @example <caption>Convert snake_case</caption>
* camel('hello_world') // 'helloWorld'
*/
export default _default;
}
export namespace query {
const prototype: {
};
declare module 'kitsu-core/kebab' {
const _default: (s: any) => any;
/**
* Converts camelCase into kebab-case
*
* @name kebab
* @param {string} s camelCase string
* @returns {string} kebab-case formatted string
*
* @example
* kebab('helloWorld') // 'hello-world'
*/
export default _default;
}
export namespace serialise {
const prototype: {
};
declare module 'kitsu-core/snake' {
const _default: (s: any) => any;
/**
* Converts camelCase into snake_case
*
* @name snake
* @param {string} s camelCase string
* @returns {string} snake_case formatted string
*
* @example
* snake('helloWorld') // 'hello_world'
*/
export default _default;
}

4

package.json
{
"version": "8.0.2",
"version": "8.0.3",
"name": "kitsu-core",

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

],
"gitHead": "cb3b7ef45b0456f4e4c912c4d89e63b0c300ef75",
"gitHead": "af9ec4faf8b2cdcdc21fd58ede25903e9a1a4e2e",
"devDependencies": {

@@ -58,0 +58,0 @@ "@size-limit/preset-small-lib": "~2.2.1"

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

<a href=https://travis-ci.org/wopian/kitsu><img alt=travis src=https://flat.badgen.net/travis/wopian/kitsu></a>
<a href=https://ci.appveyor.com/project/wopian/kitsu><img alt=appveyor src=https://flat.badgen.net/appveyor/ci/wopian/kitsu></a>
<a href="https://packagephobia.now.sh/result?p=kitsu-core"><img alt=packagephobia src=https://flat.badgen.net/packagephobia/install/kitsu-core></a>

@@ -114,3 +113,3 @@ <a href=https://github.com/wopian/kitsu/graphs/contributors><img alt=contributors src=https://flat.badgen.net/github/contributors/wopian/kitsu></a>

[packages/kitsu-core/src/deattribute/index.js:29-38](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/deattribute/index.js#L29-L38 "Source code on GitHub")
[packages/kitsu-core/src/deattribute/index.js:29-38](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/deattribute/index.js#L29-L38 "Source code on GitHub")

@@ -159,3 +158,3 @@ Hoists attributes to be top-level

[packages/kitsu-core/src/deserialise/index.js:56-70](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/deserialise/index.js#L56-L70 "Source code on GitHub")
[packages/kitsu-core/src/deserialise/index.js:56-70](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/deserialise/index.js#L56-L70 "Source code on GitHub")

@@ -212,3 +211,3 @@ Deserialises a JSON-API response

[packages/kitsu-core/src/error/index.js:7-13](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/error/index.js#L7-L13 "Source code on GitHub")
[packages/kitsu-core/src/error/index.js:7-13](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/error/index.js#L7-L13 "Source code on GitHub")

@@ -226,3 +225,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:12-21](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/filterIncludes/index.js#L12-L21 "Source code on GitHub")
[packages/kitsu-core/src/filterIncludes/index.js:12-21](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/filterIncludes/index.js#L12-L21 "Source code on GitHub")

@@ -242,3 +241,3 @@ Filters includes for the specific relationship

[packages/kitsu-core/src/linkRelationships/index.js:55-74](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/linkRelationships/index.js#L55-L74 "Source code on GitHub")
[packages/kitsu-core/src/linkRelationships/index.js:55-74](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/linkRelationships/index.js#L55-L74 "Source code on GitHub")

@@ -254,3 +253,3 @@ Links relationships to included data

[packages/kitsu-core/src/query/index.js:21-32](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/query/index.js#L21-L32 "Source code on GitHub")
[packages/kitsu-core/src/query/index.js:21-32](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/query/index.js#L21-L32 "Source code on GitHub")

@@ -268,3 +267,3 @@ Constructs a URL query string for JSON:API parameters

[packages/kitsu-core/src/serialise/index.js:96-121](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu-core/src/serialise/index.js#L96-L121 "Source code on GitHub")
[packages/kitsu-core/src/serialise/index.js:96-121](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/serialise/index.js#L96-L121 "Source code on GitHub")

@@ -295,3 +294,3 @@ Serialises an object into a JSON-API structure

[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/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/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")

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

[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/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/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")

@@ -339,7 +338,7 @@ Converts camelCase into kebab-case

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** kekab-case formatted string
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** kebab-case formatted string
### snake
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/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/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")

@@ -346,0 +345,0 @@ Converts camelCase into snake_case

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