-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjgfNode.js
More file actions
32 lines (27 loc) · 767 Bytes
/
Copy pathjgfNode.js
File metadata and controls
32 lines (27 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { Guard } = require('./guard');
/**
* A node object represents a node in a graph. In graph theory, nodes are also called points or vertices.
*/
class JgfNode {
/**
* Constructor
* @param {string} id Primary key for the node, that is unique for the object type.
* @param {string} label A text display for the node.
* @param {object|null} metadata Metadata about the node.
*/
constructor(id, label, metadata = null) {
this.id = id;
this.label = label;
this.metadata = metadata;
}
set metadata(metadata) {
Guard.assertValidMetadataOrNull(metadata);
this._metadata = metadata;
}
get metadata() {
return this._metadata;
}
}
module.exports = {
JgfNode,
};