Skip to content

Commit

Permalink
docs: organize the structure based on MDN documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasnix committed Nov 29, 2024
1 parent 60571f7 commit 7a157bc
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions docs/object-graph.doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,116 +3,122 @@

## Constructor

### ObjectGraph()

Returns an instance of ObjectGraph.

### Parameters
#### Parameters

| 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. |

## length
## Instance Properties

### length

Returns the length of the object graph.

## keys()
## Instance Methods

### keys()

Returns an iterator object that contains the keys of the object graph.

## values()
### values()

Returns an iterator object that contains the values of the object graph.

## get()
### get()

Returns a node of the object graph.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeKey | `string` | - | __Required.__ The key of the node to return from the object graph. |

## copy()
### copy()

Returns a copy of the original object graph.

## add()
### add()

Adds a node to the object graph.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeValue | `NodeValue` | - | __Required.__ The value of the node to add to the object graph. |

## toAdded()
### toAdded()

Returns a copy of the original object graph with a received node added.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeValue | `NodeValue` | - | __Required.__ The value of the node to add to the object graph. |

## update()
### update()

Updates a node in the object graph.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeValue | `NodeValue` | - | __Required.__ The value of the node to update in the object graph. |

## toUpdated()
### toUpdated()

Returns a copy of the original object graph with a received node updated.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeValue | `NodeValue` | - | __Required.__ The value of the node to update in the object graph. |

## remove()
### remove()

Removes a node from the object graph.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeKey | `string` | - | __Required.__ The key of the node to remove from the object graph. |

## toRemoved()
### toRemoved()

Returns a copy of the original object graph with a received node removed.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| nodeKey | `string` | - | __Required.__ The key of the node to remove from the object graph. |

## valuesOf()
### valuesOf()

Returns all values of the provided property.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| propertyKey | `keyof NodeValue` | - | __Required.__ The property key of the node values to return from the object graph. |

## match()
### match()

Returns all nodes that match with the provided shape.

### Parameters
#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
Expand Down

0 comments on commit 7a157bc

Please sign in to comment.