Skip to main content
Version: Annotations-V1.0.0

FrostObject

@frost/frost-web / Exports / FrostObject

Class: FrostObject<C>

Type parameters​

NameType
C{ id?: string }

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new FrostObject<C>(data, ...args)

Type parameters​

NameType
C{ id?: string }

Parameters​

NameType
dataOmitAllFunctions<C> & Record<any, any>
...argsany[]

Properties​

id​

• Optional id: string

all FrostObjects should have the id property, you can override it in the derived class


collectionPath​

▪ Static collectionPath: string

Methods​

flatten​

▸ flatten(withExcluded?): any

This flattens the object and transforms into a plain js object and transforms the properties with relations from functions that return values to direct values This is beneficial in case you don't want to deal with functions that return the data.

Default Value

withExcluded true

Parameters​

NameTypeDefault valueDescription
withExcludedbooleantrueto determine whether the flattened object should contain the excluded properties or not. *

Returns​

any

plain js object containing the all the values of the main object, along with related objects as plain js arrays and maps.


getAllConnectedKeys​

▸ getAllConnectedKeys(): Record<string, string[]>

See

getConnectedKeys

Returns​

Record<string, string[]>

a map with keys being all the properties with relations and the values being an array containing the ids of the instances that are connected. if there are no connected keys there'll be no key-value pair for the specific property


getConnectedKeys​

▸ getConnectedKeys(propertyName): string[]

Parameters​

NameTypeDescription
propertyNamestringthe name of the property with the relation which keys' you require.

Returns​

string[]

an array containing the ids of the instances that are connected. if there are no connected keys or the property name is incorrect then there'll be no key-value pair for the specific property


serialize​

▸ serialize(): any

Returns​

any

plain js object containing the all the values of the main object after all the serializers have been applied. (without related objects)


getConnectedKeys​

▸ Static getConnectedKeys(propertyName, object): string[]

See

getConnectedKeys

Parameters​

NameTypeDescription
propertyNamestringthe name of the property with the relation which keys' you require.
objectanythe object instance that you want to get the keys from

Returns​

string[]

an array containing the ids of the instances that are connected. if there are no connected keys or the property name is incorrect then there'll be no key-value pair for the specific property