Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
210K
decreased by-11.71%
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

FAQs

Package last updated on 19 Feb 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc