@tangle/graph
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -30,2 +30,6 @@ const { LinkMap, BacklinkMap } = require('./maps') | ||
this.tipKeys = this.nodes | ||
.filter(node => this.isTipNode(node.key)) | ||
.map(node => node.key) | ||
// if (containsCycles(this.lookup.connected, this._getBacklinks)) throw new Error('there is a cycle in connected nodes') | ||
@@ -89,2 +93,5 @@ } | ||
get tipNodeKeys () { return this.tipKeys } | ||
get tipNodes () { return this.tipKeys.map(k => this.getNode(k)) } | ||
get raw () { | ||
@@ -91,0 +98,0 @@ return { |
{ | ||
"name": "@tangle/graph", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "a helper for building + updating traverseable tangle graphs", | ||
@@ -31,7 +31,7 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@tangle/test": "^1.2.0", | ||
"standard": "^16.0.3", | ||
"@tangle/test": "^2.1.1", | ||
"standard": "^17.0.0", | ||
"tap-arc": "^0.3.5", | ||
"tape": "^5.0.1" | ||
"tape": "^5.6.3" | ||
} | ||
} |
@@ -88,3 +88,2 @@ # @tangle/graph | ||
### `graph.getPrevious(key) => [key]` | ||
@@ -126,3 +125,3 @@ | ||
### `graph.rootNodeKeys => [Key]` | ||
### `graph.rootKeys => [Key]` | ||
@@ -132,4 +131,16 @@ A getter which gives you access to an Array of keys for nodes which are "roots" | ||
(alias: `graph.rootKeys`) | ||
(alias: `graph.rootNodeKeys`) | ||
### `graph.tipNodes => [Node]` | ||
A getter which gives you access to an Array of tip nodes | ||
(i.e. are the ending points of the graph) | ||
### `graph.tipKeys => [Key]` | ||
A getter which gives you access to an Array of keys for nodes which are "tips" | ||
within the graph (i.e. are the ending points of the graph) | ||
(alias: `graph.tipNodeKeys`) | ||
### `graph.raw` | ||
@@ -136,0 +147,0 @@ |
@@ -62,2 +62,15 @@ const test = require('tape') | ||
test('graph.tipKeys', t => { | ||
t.deepEqual(graph.tipKeys, ['D'], 'tipKeys') | ||
t.deepEqual(graph.tipNodeKeys, ['D'], 'alias: tipNodeKeys') | ||
t.end() | ||
}) | ||
test('graph.tipNodes', t => { | ||
t.deepEqual(graph.tipNodes, [D], 'tipNodes') | ||
t.end() | ||
}) | ||
test('graph.getNode', t => { | ||
@@ -64,0 +77,0 @@ t.equal(graph.getNode('A'), A, 'getNode') |
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
50955
1146
159