API Docs for:
Show:

BaseDict Class

Extends BaseModel
Module: base-domain

dictionary-structured data model

Methods

contains

(
  • item
)
Boolean public

check if the model contains the given submodel or not

Parameters:

Returns:

Boolean:

containsEntity

() Boolean public static

returns item is Entity

Returns:

Boolean:

emitLoaded

() private

tell listeners emit loaded

get

(
  • key
)
BaseModel public

return submodel of the given key

Parameters:

  • key String | Number

Returns:

get

(
  • item
)
public

add new submodel to item(s)

Parameters:

getAnonymousClass

(
  • itemModelName
)
Function

creates child class of BaseDict

Parameters:

  • itemModelName String

Returns:

Function:

child class of BaseDict

getFacade

() Facade

Inherited from Base: src/lib/base.coffee:32

get facade

the implementation is in Facade#requre()

Returns:

getPropInfo

() PropInfo public

get an instance of PropInfo, which summarizes properties of this class

Returns:

has

(
  • key
)
Boolean public

check if the model has submodel of the given key or not

Parameters:

  • key String | Number

Returns:

Boolean:

include

(
  • [options]
)
Promise(BaseModel)

include all relational models if not set

Parameters:

  • [options] Object optional
    • [recursive] Boolean optional

      recursively include models or not

Returns:

Promise(BaseModel):

self

inherit

(
  • anotherModel
)
BaseModel

inherit value of anotherModel

Parameters:

Returns:

BaseModel:

this

key

() protected static

get unique key from item

on

() public

on addEventlisteners for 'loaded'

remove

(
  • item
)
public

remove submodel from items both acceptable, keys and submodels

Parameters:

setEntityProp

(
  • prop
  • submodel
)
BaseModel

set related model(s)

Parameters:

  • prop String

    property name of the related model

  • submodel Entity | Array

Returns:

BaseModel:

this

setIds

(
  • ids
)

set ids.

Parameters:

  • ids Array(String | Number)

setItems

(
  • models
)

set items from dic object update to new key

Parameters:

  • models Object | Array

toArray

() public

export models to Array

toPlainObject

() Object

Inherited from BaseModel but overwritten in src/lib/base-dict.coffee:245

create plain dict. if this dict contains entities, returns their ids if this dict contains non-entity models, returns their plain objects

Returns:

Object:

plainObject

unsetEntityProp

(
  • prop
)
BaseModel

unset related model(s)

Parameters:

  • prop String

    property name of the related models

Returns:

BaseModel:

this

Properties

ids

Array public

ids: get ids of items

itemFactory

BaseFactory

itemFactory: instance of factory which creates item models

itemModelName

String protected static

model name of the item

items

Objects

items: dictionary of keys - models

loaded

Boolean

loaded: is data loaded or not