Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngraph.graph

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngraph.graph - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

5

index.js

@@ -306,3 +306,6 @@ /**

fromNode.links.push(link);
toNode.links.push(link);
if (fromId !== toId) {
// make sure we are not duplicating links for self-loops
toNode.links.push(link);
}

@@ -309,0 +312,0 @@ recordLinkChange(link, 'add');

2

package.json
{
"name": "ngraph.graph",
"version": "0.0.6",
"version": "0.0.7",
"description": "Base graph structure in ngraph.*",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -40,3 +40,14 @@ ngraph.graph

``` js
g.addNode('world', 'custom data'); // Now node 'world' is associated with a string object 'custom data'
// Node 'world' is associated with a string object 'custom data'
g.addNode('world', 'custom data');
// You can associate arbitrary objects with node:
g.addNode('server', {
status: 'on',
ip: '127.0.0.1'
});
// to get data back use `data` property of node:
var server = g.getNode('server');
console.log(server.data); // prints associated object
```

@@ -43,0 +54,0 @@

@@ -22,2 +22,15 @@ var test = require('tap').test,

test('forEachLinkedNode handles self-loops', function(t) {
t.plan(1);
var graph = createGraph();
graph.addLink(1, 1);
// we should visit exactly one time
graph.forEachLinkedNode(1, function(node, link) {
t.ok(link.fromId === 1 && link.toId === 1, 'Link 1 is visited once');
});
t.end();
});
test('forEachLinkedNode will not crash on invalid node id', function(t) {

@@ -24,0 +37,0 @@ t.plan(0);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc