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 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.
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 all values of the provided property.
Name | Type | Default | Description |
---|---|---|---|
propertyKey | keyof NodeValue |
- | Required. The property key of the node values to return from the object graph. |
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. |