Returns an instance of ObjectGraph.
Name | Type | Default | Description |
---|---|---|---|
nodeValues | Array<NodeValue> |
- | Required. The array of objects to generate the nodes of the graph. |
keyExtractor | (nodeValue: NodeValue) => string |
- | Required. The function to generate a key for each node. |
Returns the length of the object graph.
Returns the size of the object graph.
Returns an iterator object that contains the keys of the object graph.
Returns an iterator object that contains the values of the object graph.
Returns a node of the object graph.
Name | Type | Default | Description |
---|---|---|---|
nodeKey | string |
- | Required. The key of the node to return from the object graph. |
Returns a copy of the original object graph.
Returns a subgraph of the original object graph.
Name | Type | Default | Description |
---|---|---|---|
nodeKeys | Array<string> |
- | Required. The array of keys of the nodes to add to the object subgraph. |
Adds a node to the object graph.
Name | Type | Default | Description |
---|---|---|---|
nodeValue | NodeValue |
- | Required. The value of the node to add to the object graph. |
Returns a copy of the original object graph with a received node added.
Name | Type | Default | Description |
---|---|---|---|
nodeValue | NodeValue |
- | Required. The value of the node to add to the object graph. |
Updates a node in the object graph.
Name | Type | Default | Description |
---|---|---|---|
nodeValue | NodeValue |
- | Required. The value of the node to update in the object graph. |
Returns a copy of the original object graph with a received node updated.
Name | Type | Default | Description |
---|---|---|---|
nodeValue | NodeValue |
- | Required. The value of the node to update in the object graph. |
Removes a node from the object graph.
Name | Type | Default | Description |
---|---|---|---|
nodeKey | string |
- | Required. The key of the node to remove from the object graph. |
Returns a copy of the original object graph with a received node removed.
Name | Type | Default | Description |
---|---|---|---|
nodeKey | string |
- | Required. The key of the node to remove from the object graph. |
Returns a list of unique values for a specified property across selected nodes in the object graph. If no selection is made, it operates on the entire graph.
Name | Type | Default | Description |
---|---|---|---|
propertyKey | keyof NodeValue |
- | Required. The property key of the node values to return from the object graph. |
nodeKeys | Array<string> |
- | The array of nodes keys to define the selected nodes. |
Returns all nodes that match with the provided shape.
Name | Type | Default | Description |
---|---|---|---|
shape | Partial<Record<keyof NodeValue, Array<unknown>>> |
- | Required. The shape of the nodes to return from the object graph. |