Skip to content

Commit

Permalink
refactor: add body to arrow functions to improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasnix committed Mar 3, 2024
1 parent 79fcb24 commit 347b5f3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
this.nodes = new Map();
this.keyExtractor = keyExtractor;
if (nodeValues.length > 0) {
nodeValues.forEach(nodeValue => this.nodes.set(this.keyExtractor(nodeValue), nodeValue));
nodeValues.forEach((nodeValue) => {
this.nodes.set(this.keyExtractor(nodeValue), nodeValue);
});
}
};

Expand Down Expand Up @@ -136,7 +138,9 @@ export class ObjectGraph<NodeValue extends Record<string, unknown>> {
throw new TypeError('The parameter "property" must be a string');
}
const propertyValues = new Set();
this.nodes.forEach(node => propertyValues.add(node[property]));
this.nodes.forEach((node) => {
return propertyValues.add(node[property]);
});
return Array.from(propertyValues);
};

Expand Down

0 comments on commit 347b5f3

Please sign in to comment.