The state class will hold the state of the model.


Methods

get (key)

The get method will return the value of the state.

Parameters

Name Type Description
key String The name of the state.

Returned Value

: The value of the state.


insert (key, filter, unique, value)

The insert method will create a new state.

Parameters

Name Type Description
key String The name of the state.
filter String The filter to use for the state.
unique Boolean A boolean to set the state to true.
value * The default value of the state.

Returned Value

State: The current State object for chaining.


isUnique ()

The isUnique method will check if all the unique states have a value, if not the current state is not unique and false will be returned.

Returned Value

Boolean: True if all the unique states have a value, false otherwise.


set (key, value)

This method will set the value of the state. Also a validate and sanitize will be done over the value.

Parameters

Name Type Description
key String The name of the state to set.
value * The value to set to the state.

Returned Value

State: The current State object for chaining.