mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
22 lines
458 B
JavaScript
22 lines
458 B
JavaScript
'use strict';
|
|
|
|
class Node {
|
|
constructor(id, seq, ver, data, next) {
|
|
this.id = id;
|
|
this.seq = seq;
|
|
this.ver = ver;
|
|
this.data = data || null;
|
|
this.next = next ? next.map((f) => f.compactId ? f.compactId : f) : [];
|
|
}
|
|
|
|
get compactId() {
|
|
return "" + this.id + "." + this.seq + "." + this.ver;
|
|
}
|
|
|
|
compact() {
|
|
return { id: this.id, seq: this.seq, ver: this.ver, data: this.data, next: this.next }
|
|
}
|
|
}
|
|
|
|
module.exports = Node;
|