anvaka / ngraph.graph

Graph data structure in JavaScript
BSD 3-Clause "New" or "Revised" License
520 stars 66 forks source link

Exiting `ForEach` family of functions #31

Closed nemosmithasf closed 3 years ago

nemosmithasf commented 4 years ago

Does the returning true to exit only work for .forEachNode and not forEachLink and forEachLinkedNode?

That seems to be what the typescript file suggests, but it seems like a rather odd discrepancy between functions of the same family.

PS: Also, I don't believe this feature is documented in the README

anvaka commented 4 years ago

I agree, thanks for pointing out. forEachLinkedNode() can exist fast, forEachLink() cannot. Need to update this.

anvaka commented 3 years ago

I believe this was fixed here https://github.com/anvaka/ngraph.graph/blob/e0a35bf3cf94a5a895ef7e2a235cdf772b6d07a7/index.js#L464

Added a few tests to confirm as well.

nemosmithasf commented 2 years ago

@anvaka would you be able to update the version hosted on NPM to reflect the update?

nala-two commented 2 years ago

Agree with @nemosmithasf - the NPM version doesn't currently include this change

anvaka commented 2 years ago

Published now under major (breaks backward compatibility) change: v20. Please let me know if you run into any issues so I can update the modules