🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@flatten-js/interval-tree

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flatten-js/interval-tree

Interval search tree

1.0.21
Source
npm
Version published
Weekly downloads
277K
-9.98%
Maintainers
1
Weekly downloads
 
Created

What is @flatten-js/interval-tree?

@flatten-js/interval-tree is an npm package that provides an efficient data structure for managing and querying intervals. It is particularly useful for applications that require frequent interval overlap checks, such as computational geometry, scheduling, and range queries.

What are @flatten-js/interval-tree's main functionalities?

Insert Intervals

This feature allows you to insert intervals into the interval tree. Each interval can be associated with a value, making it easy to manage and query intervals.

const IntervalTree = require('@flatten-js/interval-tree');
const tree = new IntervalTree();
tree.insert([5, 10], 'Interval 1');
tree.insert([15, 20], 'Interval 2');
console.log(tree);

Search Overlapping Intervals

This feature allows you to search for intervals that overlap with a given interval. It is useful for finding all intervals that intersect with a specific range.

const IntervalTree = require('@flatten-js/interval-tree');
const tree = new IntervalTree();
tree.insert([5, 10], 'Interval 1');
tree.insert([15, 20], 'Interval 2');
const overlapping = tree.search([7, 17]);
console.log(overlapping);

Remove Intervals

This feature allows you to remove intervals from the interval tree. It helps in maintaining the tree by removing intervals that are no longer needed.

const IntervalTree = require('@flatten-js/interval-tree');
const tree = new IntervalTree();
tree.insert([5, 10], 'Interval 1');
tree.insert([15, 20], 'Interval 2');
tree.remove([5, 10]);
console.log(tree);

Other packages similar to @flatten-js/interval-tree

Keywords

interval tree

FAQs

Package last updated on 01 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts