Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: organize the structure based on MDN documentation #58

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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