@tangle/graph
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -65,5 +65,4 @@ const { LinkMap, BacklinkMap } = require('./maps') | ||
get rootNodeKeys () { | ||
return this.rootKeys | ||
} | ||
get rootNodeKeys () { return this.rootKeys } | ||
get rootNodes () { return this.rootKeys.map(k => this.getNode(k)) } | ||
@@ -70,0 +69,0 @@ get raw () { |
{ | ||
"name": "@tangle/graph", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "a helper for building + updating traverseable tangle graphs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,7 +107,14 @@ # @tangle/graph | ||
### `graph.rootNodeKeys` | ||
### `graph.rootNodes => [Node]` | ||
A getter which gives you access to an Array of root nodes | ||
(i.e. are the starting points of the graph) | ||
### `graph.rootNodeKeys => [Key]` | ||
A getter which gives you access to an Array of keys for nodes which are "roots" | ||
within the graph (i.e. are the starting points of the graph) | ||
(alias: `graph.rootKeys`) | ||
### `graph.raw` | ||
@@ -114,0 +121,0 @@ |
@@ -45,4 +45,5 @@ const test = require('tape') | ||
test('Graph.rootKeys', t => { | ||
test('graph.rootKeys', t => { | ||
t.deepEqual(graph.rootKeys, ['A'], 'rootKeys') | ||
t.deepEqual(graph.rootNodeKeys, ['A'], 'alias: rootNodeKeys') | ||
@@ -52,3 +53,9 @@ t.end() | ||
test('Graph.getNode', t => { | ||
test('graph.rootNodes', t => { | ||
t.deepEqual(graph.rootNodes, [A], 'rootNodes') | ||
t.end() | ||
}) | ||
test('graph.getNode', t => { | ||
t.equal(graph.getNode('A'), A, 'getNode') | ||
@@ -62,3 +69,3 @@ t.equal(graph.getNode('W'), null, 'disconnected node not returned') | ||
test('Graph.getLinks', t => { | ||
test('graph.getLinks', t => { | ||
t.deepEqual(graph.getLinks('A'), ['B', 'C'], 'getLinks') | ||
@@ -72,3 +79,3 @@ t.deepEqual(graph.getLinks('W'), [], 'no links for disconnected') | ||
test('Graph.getBacklinks', t => { | ||
test('graph.getBacklinks', t => { | ||
/* getBacklinks */ | ||
@@ -83,3 +90,3 @@ t.deepEqual(graph.getBacklinks('B'), ['A'], 'getBacklinks') | ||
test('Graph.isBranchNode', t => { | ||
test('graph.isBranchNode', t => { | ||
/* isBranchNode */ | ||
@@ -96,3 +103,3 @@ t.equal(graph.isBranchNode('A'), true, 'A is a branchNode') | ||
test('Graph.isMergeNode', t => { | ||
test('graph.isMergeNode', t => { | ||
t.equal(graph.isMergeNode('A'), false, 'A not merge node') | ||
@@ -108,3 +115,3 @@ t.equal(graph.isMergeNode('B'), false, 'B not merge node') | ||
test('Graph.isHeadNode', t => { | ||
test('graph.isHeadNode', t => { | ||
t.equal(graph.isHeadNode('A'), false, 'A not headNode') | ||
@@ -120,3 +127,3 @@ t.equal(graph.isHeadNode('B'), false, 'B not headNode') | ||
test('Graph.invalidateKeys', t => { | ||
test('graph.invalidateKeys', t => { | ||
graph.invalidateKeys(['B']) | ||
@@ -123,0 +130,0 @@ // A (root) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24910
660
131
0