Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StaticIntervalTree intervalsOverlappingInterval is not working with a tree generated by an object #225

Open
jpbmdev opened this issue Jun 14, 2024 · 0 comments
Labels

Comments

@jpbmdev
Copy link

jpbmdev commented Jun 14, 2024

// Using specialized getters
const StaticIntervalTree = require("mnemonist/static-interval-tree");

const figures = [
{ name: "John II of Cyprus", birth: 1418, death: 1458 },
{ name: "Helena Palaiologina", birth: 1428, death: 1458 },
{ name: "Ashikaga Yoshikatsu", birth: 1434, death: 1443 },
];

const tree = StaticIntervalTree.from(figures, [(f) => f.birth, (f) => f.death]);

const result = tree.intervalsOverlappingInterval([1420, 1430]); //Expected [ { name: "Helena Palaiologina", birth: 1428, death: 1458 }, { name: "John II of Cyprus", birth: 1418, death: 1458 } ] result [ ]

console.log(result);

// Using specialized getters

const figures2 = [
[1418, 1458],
[1428, 1458],
[1434, 1443],
];

const tree2 = StaticIntervalTree.from(figures2);

const result2 = tree2.intervalsOverlappingInterval([1420, 1430]);

console.log(result2); //Expected [ [ 1428, 1458 ], [ 1418, 1458 ] ] result [ [ 1428, 1458 ], [ 1418, 1458 ] ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants