Constructor
new MemoryStore(optionsopt)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Store options Properties
|
Classes
Methods
clear() → {void}
Remove every item.
Returns:
- Type
- void
create(body) → {object}
Create an item, assigning an identifier when the body does not carry one.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
object | Item body |
Returns:
Created item
- Type
- object
get(id) → {object|undefined}
Read one item.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* | Identifier |
Returns:
Item, or undefined when absent
- Type
- object | undefined
list(query) → {Object}
Run a collection query against the store.
Parameters:
| Name | Type | Description |
|---|---|---|
query |
object | Query from |
Returns:
Collection envelope
- Type
- Object
normalizeId(id) → {*}
Normalise an identifier so that "1" from a path matches the stored 1.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* | Raw identifier |
Returns:
Normalised identifier
- Type
- *
patch(id, body) → {object|undefined}
Merge changes into an item.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* | Identifier |
body |
object | Partial body |
Returns:
Updated item, or undefined when absent
- Type
- object | undefined
remove(id) → {boolean}
Delete an item.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* | Identifier |
Returns:
True when an item was deleted
- Type
- boolean
update(id, body) → {object|undefined}
Replace an item.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* | Identifier |
body |
object | Replacement body |
Returns:
Updated item, or undefined when absent
- Type
- object | undefined