{"name":"dependency-graph","description":"Simple dependency graph.","version":"0.9.0","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["dependency","graph"],"license":"MIT","repository":{"type":"git","url":"git://github.com/jriecken/dependency-graph.git"},"bugs":{"url":"http://github.com/jriecken/dependency-graph/issues"},"main":"./lib/dep_graph.js","scripts":{"test":"jasmine specs/**/*.js"},"dependencies":{},"optionalDependencies":{},"devDependencies":{"jasmine":"3.5.0"},"engines":{"node":">= 0.6.0"},"types":"./lib/index.d.ts","gitHead":"f05d8fc0fa970d27f6bc20ea90b84754347f095d","homepage":"https://github.com/jriecken/dependency-graph#readme","_id":"dependency-graph@0.9.0","_nodeVersion":"10.16.3","_npmVersion":"6.13.1","dist":{"integrity":"sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w==","shasum":"11aed7e203bc8b00f48356d92db27b265c445318","tarball":"http://registry-npm.ywwl.com/dependency-graph/download/dependency-graph-0.9.0.tgz","fileCount":7,"unpackedSize":34127,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeQjTYCRA9TVsSAnZWagAAEJYP/RqzDHftcjQ+EukpzrBh\nOXTSV+twvNJTM5URsXLTU3wl0CsGuThml0cPzpXOy8V2GeX3icbjThTwprjJ\nKzkL59m9DRSiQimbQOsiuHP+HX6DDt0s48f/xPP3HzBK8WjUd6KW6jeQ3Eq4\nP+ykmC2h7e9X7WRdAe+gs8DfdP/YWPnGdNHJk96dMWYRcjEufHJfopz+0vjD\nLiaTPH9HYeQsm9wtOFyfLzcA3A2eujTmOjYtP5M3zipeFizLH1mSN0H1wrC0\nTMuOoFrmVfpGQqi99wFq3P9d4D1Vxvr1MxtIKRWxqmZ1fHuRlYdbvJVljVwk\nqmn/44cbwXtIkGLhqaUfE1QhRBAKn0awl8Pmcws6RR86zjAffAwZWIeLyWZV\nJXhBT26+jzcPa0ZO37xSBDQL0+nTeWlg6bhpLvHA2kqmrxMCGbCphBOkAARf\ne5PPc8E98qvujHVjGb8mYT8rYXK9RIZnkWy20h9DQnTdIh6VciHNX3xSxgB6\ndDf40SPaYTYryNlnXNrTpY0EQYWy5kUwD85UDteD59mlaYiaMPSDPxv43+/B\nRkXh7o4tLgTUVayvx5W68O9fjTbMgNDqQXKwefm0KhRLEkRsXL7qOn9X5CcF\nTGGsM3icH9uAV3P/kPyuLINEJlQLx4KPuIb3e9cjdtVyaGXjTkez6oj2AnXj\nlzsm\r\n=02hO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOVuDpggAz+ENTrkgX+5da0uCd4EYj4xHbVPzveCN91AIgNGQZL/8fYuGMrN57fRvN0sqnUAZx/5GTX4hVJ4C/a2c="}],"size":8107,"noattachment":false,"key":"/dependency-graph/-/dependency-graph-0.9.0.tgz"},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dependency-graph_0.9.0_1581397208011_0.9526576161628739"},"_hasShrinkwrap":false,"readme":"# Dependency Graph\n\nSimple dependency graph\n\n## Overview\n\nThis is a simple dependency graph useful for determining the order to do a list of things that depend on certain items being done before they are.\n\nTo use, `npm install dependency-graph` and then `require('dependency-graph').DepGraph`\n\n## API\n\n### DepGraph\n\nNodes in the graph are just simple strings with optional data associated with them.\n\n - `addNode(name, data)` - add a node in the graph with optional data. If `data` is not given, `name` will be used as data\n - `removeNode(name)` - remove a node from the graph\n - `hasNode(name)` - check if a node exists in the graph\n - `size()` - return the number of nodes in the graph\n - `getNodeData(name)` - get the data associated with a node (will throw an `Error` if the node does not exist)\n - `setNodeData(name, data)` - set the data for an existing node (will throw an `Error` if the node does not exist)\n - `addDependency(from, to)` - add a dependency between two nodes (will throw an `Error` if one of the nodes does not exist)\n - `removeDependency(from, to)` - remove a dependency between two nodes\n - `clone()` - return a clone of the graph. Any data attached to the nodes will only be *shallow-copied*\n - `dependenciesOf(name, leavesOnly)` - get an array containing the nodes that the specified node depends on (transitively). If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned in the array.\n - `dependantsOf(name, leavesOnly)` (aliased as `dependentsOf`) - get an array containing the nodes that depend on the specified node (transitively). If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array.\n - `directDependenciesOf(name)` - get an array containing the direct dependencies of the specified node\n - `directDependantsOf(name)` (aliased as `directDependentsOf`) - get an array containing the nodes that directly depend on the specified node\n - `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.\n - `entryNodes()` - array of nodes that have no dependants (i.e. nothing depends on them).\n\nDependency 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).\n\n## Examples\n\n    var DepGraph = require('dependency-graph').DepGraph;\n\n    var graph = new DepGraph();\n    graph.addNode('a');\n    graph.addNode('b');\n    graph.addNode('c');\n\n    graph.size() // 3\n\n    graph.addDependency('a', 'b');\n    graph.addDependency('b', 'c');\n\n    graph.dependenciesOf('a'); // ['c', 'b']\n    graph.dependenciesOf('b'); // ['c']\n    graph.dependantsOf('c'); // ['a', 'b']\n\n    graph.overallOrder(); // ['c', 'b', 'a']\n    graph.overallOrder(true); // ['c']\n    graph.entryNodes(); // ['a']\n\n    graph.addNode('d', 'data');\n\n    graph.getNodeData('d'); // 'data'\n\n    graph.setNodeData('d', 'newData');\n\n    graph.getNodeData('d'); // 'newData'\n\n    var circularGraph = new DepGraph({ circular: true });\n\n    circularGraph.addNode('a');\n    circularGraph.addNode('b');\n    circularGraph.addNode('c');\n    circularGraph.addNode('d');\n\n    circularGraph.addDependency('a', 'b');\n    circularGraph.addDependency('b', 'c'); // b depends on c\n    circularGraph.addDependency('c', 'a'); // c depends on a, which depends on b\n    circularGraph.addDependency('d', 'a');\n\n    circularGraph.dependenciesOf('b'); // ['a', 'c']\n    circularGraph.overallOrder(); // ['c', 'b', 'a', 'd']\n","publish_time":1581397208108,"_cnpm_publish_time":1581397208108,"dist-tags":{"latest":"1.0.0"}}