Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/rbush

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/rbush

TypeScript definitions for rbush

  • 4.0.0
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/rbush?

@types/rbush provides TypeScript type definitions for the rbush library, which is a high-performance JavaScript library for spatial indexing of 2D geometries. It allows for efficient querying and manipulation of spatial data structures such as points, rectangles, and polygons.

What are @types/rbush's main functionalities?

Inserting Items

This feature allows you to insert items into the spatial index. The items are typically bounding boxes defined by their minimum and maximum X and Y coordinates.

const RBush = require('rbush');
const tree = new RBush();
tree.insert({ minX: 20, minY: 40, maxX: 30, maxY: 50 });

Bulk Insertion

This feature allows for bulk insertion of multiple items into the spatial index, which is more efficient than inserting items one by one.

const items = [
  { minX: 20, minY: 40, maxX: 30, maxY: 50 },
  { minX: 10, minY: 20, maxX: 15, maxY: 25 }
];
tree.load(items);

Searching

This feature allows you to search for items within a given bounding box. The search returns all items that intersect with the specified bounding box.

const searchResult = tree.search({ minX: 15, minY: 25, maxX: 35, maxY: 45 });

Removing Items

This feature allows you to remove items from the spatial index. The item to be removed must match exactly with an item in the index.

tree.remove({ minX: 20, minY: 40, maxX: 30, maxY: 50 });

Bounding Box Calculation

This feature allows you to calculate the bounding box of an item. This is useful for custom data structures where you need to define how to extract the bounding box.

const bbox = tree.toBBox({ minX: 20, minY: 40, maxX: 30, maxY: 50 });

Other packages similar to @types/rbush

FAQs

Package last updated on 26 Sep 2024

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