{"name":"dependency-graph","description":"Simple dependency graph.","version":"0.11.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":"072cdcc3eef1ee4531114e7a675e3cbe828fb33e","homepage":"https://github.com/jriecken/dependency-graph#readme","_id":"dependency-graph@0.11.0","_nodeVersion":"14.16.0","_npmVersion":"7.6.0","dist":{"integrity":"sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==","shasum":"ac0ce7ed68a54da22165a85e97a01d53f5eb2e27","tarball":"http://registry-npm.ywwl.com/dependency-graph/download/dependency-graph-0.11.0.tgz","fileCount":7,"unpackedSize":38560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQoU7CRA9TVsSAnZWagAATcIP/R6KAYg0U/WQFVj6L5Jo\n1lEDYTlXAtH0KdYuyLYsSLC4gh4T+Z4D5A/FQ8d8ZXHeUlUd0oWS8sSruxLf\nzPMObKIjtNDJpCe1wzgG+1RnCqIzDsb2GXjIJNWyq8WOLX854wAZSWIazqJ3\ncFGcCHj9Tn0WZNgXIT41SJTkpIDHveRDfam6vQ9nIrmJI13EUbNlodvhwWxF\nvHPzeloCy+sT9WSGOAhgHQw+A9Hyz7ZTE/2aN8GvH0PBk9hGQnsIRbtz3Z6o\n6PqU+q5OLrVpKkP4xCc4IQX1Dy7jxxri9YI9k3LG+VePQqvl0nii47ezsKBj\nEpDesVlkGcJbjUdvJgomcGZYWahFOwX9pUF0vFu8mM/yTsV5dB1Ppo/iCNyO\n2gXu74w62OqwIoD3DUAy+MmkLh+73KeMOaRvna71IfRqKebdpaScF6y2xKVQ\nccQyagtnGyu6MMemASfUwiWvmKjQXI3Tf9jal3ucdtjtk57XRiVOkGy433iH\nFl6ib+QDI10A8GGQaPmq5+ySjSx8ZkXvjdwTX9BHaYkxtToIGUn/bS2JouxK\nqQH/IzGA1ij7tUacwQe2zoIOiPpFO+rQJpGZgcpW8s3n8wx02pgN0f8dO09/\nN8fyVrkjbBeYBt0gVLOu1Dvpe9xaF0T+7KOeLzQtUBXpv+xKwPdaOJknJQUE\nVPN6\r\n=rjFT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCn89D2BvyJGMgOicOPcoGJc4UBjClUgtR5Ak4JlsJV6gIgKRtl7VIMSuoJx9GlthoZ7zyFDJJ6klq6oqq392dOLfI="}],"size":8624,"noattachment":false,"key":"/dependency-graph/-/dependency-graph-0.11.0.tgz"},"_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"directories":{},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dependency-graph_0.11.0_1614972219440_0.8274306027310341"},"_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":1614972219612,"_cnpm_publish_time":1614972219612,"dist-tags":{"latest":"1.0.0"}}