Socket
Socket
Sign inDemoInstall

dependency-graph

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-graph - npm Package Compare versions

Comparing version 0.10.0 to 0.11.0

4

CHANGELOG.md
# Dependency Graph Changelog
## 0.11.0 (March 5, 2021)
- Add `entryNodes` method that returns the nodes that nothing depends on - thanks [amcdnl](https://github.com/amcdnl)!
## 0.10.0 (January 9, 2021)

@@ -4,0 +8,0 @@

@@ -327,2 +327,11 @@ /**

}
},
/**
* Get an array of nodes that have no dependants (i.e. nothing depends on them).
*/
entryNodes: function () {
var self = this;
return Object.keys(this.nodes).filter(function (node) {
return self.incomingEdges[node].length === 0;
});
}

@@ -329,0 +338,0 @@ };

@@ -104,3 +104,3 @@ declare module 'dependency-graph' {

/**
* Alias of `dependentsOf`
* Alias of `dependantsOf`
*

@@ -114,2 +114,7 @@ * @see dependantsOf

/**
* Get an array of nodes that have no dependants (i.e. nothing depends on them).
*/
entryNodes(): string[];
/**
* Construct the overall processing order for the dependency graph. If leavesOnly is true, only nodes that do not depend on any other nodes will be returned.

@@ -116,0 +121,0 @@ * @param {boolean} leavesOnly

2

package.json
{
"name": "dependency-graph",
"description": "Simple dependency graph.",
"version": "0.10.0",
"version": "0.11.0",
"author": "Jim Riecken <jriecken@gmail.com>",

@@ -6,0 +6,0 @@ "keywords": [

@@ -31,2 +31,3 @@ # Dependency Graph

- `overallOrder(leavesOnly)` - construct the overall processing order for the dependency graph. If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned.
- `entryNodes()` - array of nodes that have no dependants (i.e. nothing depends on them).

@@ -55,2 +56,3 @@ Dependency Cycles are detected when running `dependenciesOf`, `dependantsOf`, and `overallOrder` and if one is found, a `DepGraphCycleError` will be thrown that includes what the cycle was in the message as well as the `cyclePath` property: e.g. `Dependency Cycle Found: a -> b -> c -> a`. If you wish to silence this error, pass `circular: true` when instantiating `DepGraph` (more below).

graph.overallOrder(true); // ['c']
graph.entryNodes(); // ['a']

@@ -57,0 +59,0 @@ graph.addNode('d', 'data');

@@ -139,2 +139,15 @@ var dep_graph = require("../lib/dep_graph");

it("should find entry nodes", function () {
var graph = new DepGraph();
graph.addNode("a");
graph.addNode("b");
graph.addNode("c");
graph.addDependency("a", "b");
graph.addDependency("a", "c");
expect(graph.entryNodes()).toEqual(["a"]);
});
it("should throw an error if a node does not exist and a dependency is added", function () {

@@ -141,0 +154,0 @@ var graph = new DepGraph();

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