-
-
Save isaacs/40ea407fc3f41080fd2a3d2475dc8946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Node = require('./lib/node.js') | |
const gatherDepSet = require('./lib/gather-dep-set.js') | |
const tree = new Node({ | |
path: '/some/path', | |
pkg: { name: 'root', version: '1.0.0', dependencies: { a: '', e: '' }}, | |
children: [ | |
{ pkg: { name: 'a', version: '1.0.0', dependencies: { b: '', c: '' }}}, | |
{ pkg: { name: 'b', version: '1.0.0', dependencies: { d: '' }}}, | |
{ pkg: { name: 'c', version: '1.0.0' }}, | |
{ pkg: { name: 'd', version: '1.0.0' }}, | |
{ pkg: { name: 'e', version: '1.0.0', dependencies: { d: '' }}}, | |
], | |
}) | |
const a = tree.children.get('a') | |
const aSet = gatherDepSet([a], edge => edge.to !== a) | |
console.error([...aSet].map(n => n.name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment