Model factory
All common model logic (CRUD) is factored in this model factory Models are stored in State to defer all side-effects in a single place
- Source:
Methods
(inner) add() → {function}
Add a new entity to the current State
- Source:
Returns:
Function that will update model content for a new id
- Type
- function
(inner) getAll() → {Array.<Object>}
Retrieve all entities Not very useful for the moment...but will be more fun when I add filters and such :D
- Source:
Returns:
Entity list
- Type
- Array.<Object>
(inner) getById(id) → {Any}
State model getter by related id
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | Id to retrieve |
- Source:
Returns:
Value located at id for the given model
- Type
- Any
(inner) init(value) → {Void}
State model initializer
Parameters:
| Name | Type | Description |
|---|---|---|
value |
Object | Array | Value to initialize model with (default is empty object {}) |
- Source:
Returns:
Nothing
- Type
- Void
(inner) removeById(id) → {function}
State model deleter by related id
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | Id to remove |
- Source:
Returns:
Function that will remove content for given id
- Type
- function
(inner) updateById(id) → {function}
State model updater by related id
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | Id to retrieve |
- Source:
Returns:
Function that will update content for given id
- Type
- function