feat(tree): ✨ add applyPreOrder and applyPostOrder tree meth…#88
feat(tree): ✨ add applyPreOrder and applyPostOrder tree meth…#88LeoFeatherstone merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds two new convenience methods (applyPreOrder and applyPostOrder) to the Tree class and includes corresponding tests in the test suite.
- Introduces tree traversal methods in src/tree/tree.ts
- Adds pre-order and post-order traversal tests in test/tree/tree.spec.ts
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/tree/tree.ts | Adds applyPreOrder and applyPostOrder methods with documentation. |
| test/tree/tree.spec.ts | Introduces tests validating pre-order and post-order traversals; also note a spelling mistake in a describe block. |
Comments suppressed due to low confidence (1)
test/tree/tree.spec.ts:33
- The word 'Netowrks' appears to be misspelled. It should be corrected to 'Networks'.
describe('Netowrks', () => {
| describe('Traversal', () => { | ||
| test('applyPreOrder', () => { | ||
| // Create a tree with three tips using Newick: ((A,B),C); | ||
| const tree = readNewick('(((A,B),C);'); |
There was a problem hiding this comment.
The Newick string appears to have unbalanced parentheses. Consider correcting it to '((A,B),C);' as indicated by the comment.
| const tree = readNewick('(((A,B),C);'); | |
| const tree = readNewick('((A,B),C);'); |
| }); | ||
| test('applyPostOrder', () => { | ||
| // Create a tree with three tips using Newick: ((A,B),C); | ||
| const tree = readNewick('(((A,B),C);'); |
There was a problem hiding this comment.
The Newick string appears to have unbalanced parentheses. Consider correcting it to '((A,B),C);' as indicated by the comment.
| const tree = readNewick('(((A,B),C);'); | |
| const tree = readNewick('((A,B),C);'); |
| } | ||
|
|
||
| /** | ||
| * Convenience function applied function pre-order to all nodes in the tree. |
There was a problem hiding this comment.
[nitpick] Consider rephrasing the comment to 'Convenience function to apply the given function in pre-order to all nodes in the tree.' for better clarity.
|
🎉 This PR is included in version 1.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.