A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mrichar1.github.io/jsonapi-vuex/module-jsonapi-vuex.utils.html below:

utils

Namespace

utils jsonapi-vuex.utils

A class containing utility functions for use with jsonapi-vuex

Note - an instance of this class is exported as utils from jsonapi-vuex, so it does not need to be used directly.

View Source lib.js, line 1

Methods # static Utils#addJvHelpers(obj) → {object}

Add helper functions and getters to a restructured object

Parameters: Name Type Description obj object

An object to assign helpers to

View Source lib.js, line 63

Returns:

A copy of the object with added helper functions/getters

Type: object

# static Utils#cleanPatch(patch, state, jvProps) → {object}

A function that cleans up a patch object, so that it doesn't introduce unexpected changes when sent to the API. It removes any attributes which are unchanged from the store, to minimise accidental reversions. It also strips out any of links, relationships and meta from _jv - See Configuration

Parameters: Name Type Default Description patch object

A restructured object to be cleaned

state object {}

Vuex state object (for patch comparison)

jvProps array '[]'

_jv Properties to be kept

View Source lib.js, line 170

Returns:

A cleaned copy of the patch object

Type: object

# static Utils#deepCopy(obj) → {object}

Deep copy a normalised object, then re-add helper nethods

Parameters: Name Type Description obj object

An object to be deep copied

View Source lib.js, line 206

Returns:

A deep copied object, with Helper functions added

Type: object

# static Utils#getTypeId(data, encode) → {array}

Get the type, id and relationships from a restructured object

Parameters: Name Type Default Description data object

A restructured object

encode boolean true

url-encode the returned values

View Source lib.js, line 310

Returns:

An array (optionally) containing type, id and rels

Type: array

# static Utils#getURL(data) → {string}

Return the URL path (links.self) or construct from type/id

Parameters: Name Type Description data object

A restructured object

View Source lib.js, line 333

Returns:

The record's URL path

Type: string

# static Utils#jsonapiToNorm(data) → {object}

Convert JSONAPI record(s) to restructured data

Parameters: Name Type Description data object

The data object from a JSONAPI record

View Source lib.js, line 366

Returns:

Restructured data

Type: object

# static Utils#normToJsonapi(record) → {object}

Convert one or more restructured records to jsonapi

Parameters: Name Type Description record object

A restructured record to be convert to JSONAPI

View Source lib.js, line 406

Returns:

JSONAPI record

Type: object

# static Utils#normToStore(record) → {object}

Convert one or more restructured records to nested (type & id) 'store' object

Parameters: Name Type Description record object

A restructured record to be convert to JSONAPI

View Source lib.js, line 453

Returns:

Structured 'store' object

Type: object


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4