Skip to content

Commit f2ff494

Browse files
authored
fix: adjust terminology (#97)
1 parent b80ceff commit f2ff494

File tree

5 files changed

+60
-61
lines changed

5 files changed

+60
-61
lines changed

docs/object-graph.doc.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,39 @@ Returns an instance of ObjectGraph.
1818

1919
### length
2020

21-
Returns the length of the object graph.
21+
Returns the length of the graph.
2222

2323
### size
2424

25-
Returns the size of the object graph.
25+
Returns the size of the graph.
2626

2727
## Instance Methods
2828

2929
### keys()
3030

31-
Returns an iterator object that contains the keys of the object graph.
31+
Returns an iterator that contains the keys of the graph.
3232

3333
### values()
3434

35-
Returns an iterator object that contains the values of the object graph.
35+
Returns an iterator that contains the values of the graph.
3636

3737
### get()
3838

39-
Returns a node of the object graph.
39+
Returns a node of the graph.
4040

4141
#### Parameters
4242

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

4747
### copy()
4848

49-
Returns a copy of the original object graph.
49+
Returns a copy of the original graph.
5050

5151
### subgraph()
5252

53-
Returns a subgraph of the original object graph.
53+
Returns a subgraph of the original graph.
5454

5555
#### Parameters
5656

@@ -60,73 +60,73 @@ Returns a subgraph of the original object graph.
6060

6161
### add()
6262

63-
Adds a node to the object graph.
63+
Adds a node to the graph.
6464

6565
#### Parameters
6666

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

7171
### toAdded()
7272

73-
Returns a copy of the original object graph with a received node added.
73+
Returns a copy of the original graph with a received node added.
7474

7575
#### Parameters
7676

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

8181
### update()
8282

83-
Updates a node in the object graph.
83+
Updates a node in the graph.
8484

8585
#### Parameters
8686

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

9191
### toUpdated()
9292

93-
Returns a copy of the original object graph with a received node updated.
93+
Returns a copy of the original graph with a received node updated.
9494

9595
#### Parameters
9696

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

101101
### remove()
102102

103-
Removes a node from the object graph.
103+
Removes a node from the graph.
104104

105105
#### Parameters
106106

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

111111
### toRemoved()
112112

113-
Returns a copy of the original object graph with a received node removed.
113+
Returns a copy of the original graph with a received node removed.
114114

115115
#### Parameters
116116

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

121121
### valuesOf()
122122

123-
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.
123+
Returns a list of unique values for a specified property across selected nodes in the graph. If no selection is made, it operates on the entire graph.
124124

125125
#### Parameters
126126

127127
| Name | Type | Default | Description |
128128
| --- | --- | --- | --- |
129-
| propertyKey | `keyof NodeValue` | - | __Required.__ The property key of the node values to return from the object graph. |
129+
| propertyKey | `keyof NodeValue` | - | __Required.__ The property key of the node values to return from the graph. |
130130
| nodeKeys | `Array<string>` | - | The array of nodes keys to define the selected nodes. |
131131

132132
### valuesBy()
@@ -141,4 +141,4 @@ Returns all nodes that match with the provided shape.
141141

142142
| Name | Type | Default | Description |
143143
| --- | --- | --- | --- |
144-
| shape | `Partial<Record<keyof NodeValue, unknown>>` | - | __Required.__ The shape of the nodes to return from the object graph. |
144+
| shape | `Partial<Record<keyof NodeValue, unknown>>` | - | __Required.__ The shape of the nodes to return from the graph. |

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@kasnix/structured-objects",
33
"description": "A lightweight and powerful library for manipulating objects in JavaScript and TypeScript across different types of data structures.",
44
"author": "Kasnix",
5-
"version": "1.7.0",
5+
"version": "1.7.1",
66
"repository": {
77
"type": "git",
88
"url": "git+https://github.com/luckasnix/structured-objects.git"

src/object-graph.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
2626
}
2727

2828
/**
29-
* @description Returns the length of the object graph.
29+
* @description Returns the length of the graph.
3030
* @since 1.0.0
3131
* @deprecated Since version 1.2.0. Will be removed in version 2.0.0. Use "size" instead.
3232
*/
@@ -35,31 +35,31 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
3535
}
3636

3737
/**
38-
* @description Returns the size of the object graph.
38+
* @description Returns the size of the graph.
3939
* @since 1.2.0
4040
*/
4141
public get size(): number {
4242
return this.nodes.size;
4343
}
4444

4545
/**
46-
* @description Returns an iterator object that contains the keys of the object graph.
46+
* @description Returns an iterator that contains the keys of the graph.
4747
* @since 1.0.0
4848
*/
4949
public keys(): IterableIterator<string> {
5050
return this.nodes.keys();
5151
}
5252

5353
/**
54-
* @description Returns an iterator object that contains the values of the object graph.
54+
* @description Returns an iterator that contains the values of the graph.
5555
* @since 1.0.0
5656
*/
5757
public values(): IterableIterator<NodeValue> {
5858
return this.nodes.values();
5959
}
6060

6161
/**
62-
* @description Returns a node of the object graph.
62+
* @description Returns a node of the graph.
6363
* @since 1.0.0
6464
*/
6565
public get(nodeKey: string): NodeValue | undefined {
@@ -71,21 +71,21 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
7171
}
7272
const nodeValue = this.nodes.get(nodeKey);
7373
if (!nodeValue) {
74-
console.error("A node with this key does not exist in the object graph");
74+
console.error("A node with this key does not exist in the graph");
7575
}
7676
return nodeValue;
7777
}
7878

7979
/**
80-
* @description Returns a copy of the original object graph.
80+
* @description Returns a copy of the original graph.
8181
* @since 1.0.0
8282
*/
8383
public copy(): ObjectGraph<NodeValue> {
8484
return new ObjectGraph(Array.from(this.nodes.values()), this.keyExtractor);
8585
}
8686

8787
/**
88-
* @description Returns a subgraph of the original object graph.
88+
* @description Returns a subgraph of the original graph.
8989
* @since 1.3.0
9090
*/
9191
public subgraph(nodeKeys: Array<string>): ObjectGraph<NodeValue> {
@@ -110,7 +110,7 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
110110
}
111111

112112
/**
113-
* @description Adds a node to the object graph.
113+
* @description Adds a node to the graph.
114114
* @since 1.0.0
115115
*/
116116
public add(nodeValue: NodeValue): void {
@@ -119,15 +119,13 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
119119
}
120120
const nodeKey = this.keyExtractor(nodeValue);
121121
if (this.nodes.get(nodeKey)) {
122-
throw new Error(
123-
"A node with the same key already exists in the object graph",
124-
);
122+
throw new Error("A node with the same key already exists in the graph");
125123
}
126124
this.nodes.set(nodeKey, nodeValue);
127125
}
128126

129127
/**
130-
* @description Returns a copy of the original object graph with a received node added.
128+
* @description Returns a copy of the original graph with a received node added.
131129
* @since 1.0.0
132130
*/
133131
public toAdded(nodeValue: NodeValue): ObjectGraph<NodeValue> {
@@ -137,7 +135,7 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
137135
}
138136

139137
/**
140-
* @description Updates a node in the object graph.
138+
* @description Updates a node in the graph.
141139
* @since 1.0.0
142140
*/
143141
public update(nodeValue: NodeValue): void {
@@ -147,14 +145,14 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
147145
const nodeKey = this.keyExtractor(nodeValue);
148146
if (!this.nodes.get(nodeKey)) {
149147
throw new Error(
150-
"A node with the provided key does not exist in the object graph",
148+
"A node with the provided key does not exist in the graph",
151149
);
152150
}
153151
this.nodes.set(nodeKey, nodeValue);
154152
}
155153

156154
/**
157-
* @description Returns a copy of the original object graph with a received node updated.
155+
* @description Returns a copy of the original graph with a received node updated.
158156
* @since 1.0.0
159157
*/
160158
public toUpdated(nodeValue: NodeValue): ObjectGraph<NodeValue> {
@@ -164,7 +162,7 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
164162
}
165163

166164
/**
167-
* @description Removes a node from the object graph.
165+
* @description Removes a node from the graph.
168166
* @since 1.0.0
169167
*/
170168
public remove(nodeKey: string): void {
@@ -178,7 +176,7 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
178176
}
179177

180178
/**
181-
* @description Returns a copy of the original object graph with a received node removed.
179+
* @description Returns a copy of the original graph with a received node removed.
182180
* @since 1.0.0
183181
*/
184182
public toRemoved(nodeKey: string): ObjectGraph<NodeValue> {
@@ -188,7 +186,7 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
188186
}
189187

190188
/**
191-
* @description 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.
189+
* @description Returns a list of unique values for a specified property across selected nodes in the graph. If no selection is made, it operates on the entire graph.
192190
* @since 1.0.0
193191
*/
194192
public valuesOf<NodeValueKey extends keyof NodeValue>(

0 commit comments

Comments
 (0)